Skip to content

Commit

Permalink
Update rc.qc.R
Browse files Browse the repository at this point in the history
add flexibility to enable searching for qc.tag in specific column by allowing qc.tag to be a vector of length 2, c('tag', 'pheno.column')
  • Loading branch information
cbroeckl committed May 8, 2024
1 parent 62436b3 commit 27c7aa9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions R/rc.qc.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,19 @@ rc.qc<-function(ramclustObj=NULL,
stop("no tag provided", "\n")
}

samples <- grep(tag[1], ramclustObj$phenoData$sample.names)
samples <- samples[which(samples <= nrow(ramclustObj$MSdata))]
if(length(tag) == 1) {
samples <- grep(tag[1], ramclustObj$phenoData$sample.names)
samples <- samples[which(samples <= nrow(ramclustObj$MSdata))]
}

if(length(tag) == 2) {
samples <- grep(tag[1], ramclustObj$phenoData[,tag[2]])
samples <- samples[which(samples <= nrow(ramclustObj$MSdata))]
}


if (length(samples) == 0) {
stop("no ", tag, " samples found using the tag ", "'", tag, "'", "\n")
stop("no QC samples found using the tag ", "'", tag, "'", "\n")
}
return(samples)
}
Expand Down

0 comments on commit 27c7aa9

Please sign in to comment.