Skip to content

Commit a4c3179

Browse files
author
suiyue
committed
fix importBambuResults
1 parent 7315f89 commit a4c3179

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

R/readWrite.R

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,19 +328,26 @@ readFromGTF <- function(file, keep.extra.columns = NULL){
328328
#' path <- tempdir()
329329
#' writeBambuOutput(se, path)
330330
importBambuResults <- function(path, prefixes = NA){
331-
annotations = prepareAnnotations(paste0(path, "/extended_annotations.gtf"))
332-
counts = readMM(paste0(path, "/counts_transcript.mtx"))
333-
CPM = readMM(paste0(path, "/CPM_transcript.mtx"))
334-
fullLengthCounts = readMM(paste0(path, "/fullLengthCounts_transcript.mtx"))
335-
uniqueCounts = readMM(paste0(path, "/uniqueCounts_transcript.mtx"))
331+
if(is.na(prefixes)){
332+
path <- paste0(path,"/")
333+
} else{
334+
path <- paste0(path,"/",prefixes,"_")
335+
}
336+
annotations = prepareAnnotations(paste0(path, "extendedAnnotations.gtf"))
337+
counts = readMM(paste0(path, "counts_transcript.mtx"))
338+
CPM = readMM(paste0(path, "CPM_transcript.mtx"))
339+
fullLengthCounts = readMM(paste0(path, "fullLengthCounts_transcript.mtx"))
340+
uniqueCounts = readMM(paste0(path, "uniqueCounts_transcript.mtx"))
336341
incompatibleCounts = NULL
337-
if(file.exists(paste0(path, "/incompatibleCounts.mtx"))){
338-
incompatibleCounts = readMM(paste0(path, "/incompatibleCounts.mtx"))
342+
if(file.exists(paste0(path, "incompatibleCounts.mtx"))){
343+
incompatibleCounts = readMM(paste0(path, "incompatibleCounts.mtx"))
344+
}
345+
if(file.exists(paste0(path, "barcodes.tsv"))){
346+
incompatibleCounts = readMM(paste0(path, "barcodes.tsv"))
339347
}
340-
barcodes = read.table(paste0(path, "/barcodes.tsv"))
341-
geneIds = read.table(paste0(path, "/genes.tsv"))
342-
txIds = read.table(paste0(path, "/txANDgenes.tsv"))
343-
colData = read.table(paste0(path, "/sampleData.tsv"), header = TRUE)
348+
geneIds = read.table(paste0(path, "genes.tsv"))
349+
txIds = read.table(paste0(path, "txANDgenes.tsv"))
350+
colData = read.table(paste0(path, "sampleData.tsv"), header = TRUE)
344351
rownames(incompatibleCounts) = geneIds[,1]
345352

346353
countsSe <- SummarizedExperiment(assays = SimpleList(counts = counts,

0 commit comments

Comments
 (0)