Skip to content

Commit

Permalink
multi_covar_pca doesn't create PDF if name is NA
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreyf committed Jan 15, 2024
1 parent 7defdf6 commit 482ac37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ezlimmaplot
Title: Bioinformatics plots using limma and ggplot2, some from output of ezlimma
Version: 0.0.2.9003
Version: 0.0.2.9004
Authors@R: c(person("Jonathan", "Dreyfuss", role = c("aut", "cre"), email = "[email protected]"),
person("Hui", "Pan", role = "aut"),
person("Grace", "Daher", role="ctb"))
Expand Down
8 changes: 6 additions & 2 deletions R/multi_covar_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ multi_covar_pca <- function(object, pheno.df, name='covar_pca', grp.var='grp', c
manual.shape = NULL, plot=TRUE){
stopifnot(c(grp.var, covars) %in% colnames(pheno.df))
pca.lst <- list()
grDevices::pdf(paste0(name, ".pdf"))
on.exit(grDevices::dev.off())

if (!is.na(name)){
grDevices::pdf(paste0(name, ".pdf"))
on.exit(grDevices::dev.off())
}

for (cvr.ind in 1:length(covars)){
pca.lst[[ covars[cvr.ind] ]] <- ezpca(object=object, pheno.df=pheno.df, shape=grp.var, color=covars[cvr.ind], name=NA,
alpha=alpha, all.size=all.size, facet=facet, rm.leg.title=rm.leg.title, labels=labels,
Expand Down

0 comments on commit 482ac37

Please sign in to comment.