Skip to content

Commit 7d60435

Browse files
committed
allow . csv/.tsv/.txt file input type in sampleData
1 parent e80cb39 commit 7d60435

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

R/bambu_utilityFunctions.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ checkInputs <- function(annotations, reads, readClass.outputDir, genomeSequence,
157157
}
158158

159159
if(!is.null(sampleData)){
160-
if (!all(grepl("\\.csv$", na.omit(sampleData)))){
161-
stop("Not all paths for sample metadata files are .csv files")
160+
if (!all(grepl("\\.(csv|tsv|txt)$", na.omit(sampleData), ignore.case = TRUE))){
161+
stop("Not all paths for sample metadata files are .csv/.tsv/.txt files")
162162
}
163-
if(length(sampleData)==1 & length(reads)>1){ # normally used for bulk samples
163+
if(length(sampleData)==1 & length(reads)>1){ # one sample metadata for all samples
164164
message("Using the same sample metadata file for all input samples")
165-
} else if(length(reads)!=length(sampleData)){ # normally used for single-cell/spatial samples
165+
} else if(length(reads)!=length(sampleData)){ # multiple sample metadatas for multiple samples
166166
stop(
167167
"The number of sample metadata files does not match the number of input read files. ",
168168
"These two arguments (sampleData & reads) must be vectors of the same length. ",
@@ -305,7 +305,7 @@ generateColData <- function(readClassList, sampleMetadata, demultiplexed) {
305305
sampleMetadataDf <- if (is.null(sampleMetadata) || is.na(sampleMetadata)) {
306306
if (demultiplexed) tibble(barcode = character()) else tibble(sampleName = character())
307307
} else {
308-
read.csv(sampleMetadata)
308+
fread(sampleMetadata)
309309
}
310310
samples <- metadata(readClassList)$samples
311311
joinKey <- if (demultiplexed) "barcode" else "sampleName"

0 commit comments

Comments
 (0)