@@ -33,7 +33,7 @@ writeBambuOutput <- function(se, path, prefix = "", outputExtendedAnno = TRUE,
3333 file = transcript_gtffn , outputExtendedAnno = outputExtendedAnno ,
3434 outputAll = outputAll , outputBambuModels = outputBambuModels , outputNovelOnly = outputNovelOnly )
3535
36- utils :: write.table(colData(se ), file = paste0(outdir , " / " , prefix , " sampleData.tsv" ),
36+ utils :: write.table(colData(se ), file = paste0(transcript_gtffn , " sampleData.tsv" ),
3737 sep = " \t " , quote = FALSE , row.names = FALSE , col.names = TRUE )
3838 for (d in names(assays(se ))){
3939 writeCountsOutput(se , varname = d ,
@@ -43,17 +43,17 @@ writeBambuOutput <- function(se, path, prefix = "", outputExtendedAnno = TRUE,
4343 # write incompatible counts
4444 if (! is.null(metadata(se )$ incompatibleCounts )){
4545 estimates = metadata(se )$ incompatibleCounts
46- estimatesfn <- paste(outdir , prefix , " incompatibleCounts.mtx" , sep = " " )
46+ estimatesfn <- paste(transcript_gtffn , " incompatibleCounts.mtx" , sep = " " )
4747 Matrix :: writeMM(estimates , estimatesfn )
4848 }
4949 seGene <- transcriptToGeneExpression(se )
5050 writeCountsOutput(seGene , varname = ' counts' , feature = ' gene' ,outdir , prefix )
5151 # utils::write.table(paste0(colnames(se), "-1"), file = paste0(outdir, "barcodes.tsv"), quote = FALSE, row.names = FALSE, col.names = FALSE)
5252 # R.utils::gzip(paste0(outdir, "barcodes.tsv"))
5353 txANDGenes <- data.table(as.data.frame(rowData(se ))[,c(" TXNAME" ," GENEID" )])
54- utils :: write.table(txANDGenes , file = paste0(outdir , prefix , " txANDgenes.tsv" ),
54+ utils :: write.table(txANDGenes , file = paste0(transcript_gtffn , " txANDgenes.tsv" ),
5555 sep = " \t " , quote = FALSE , row.names = FALSE , col.names = FALSE )
56- utils :: write.table(names(seGene ), file = paste0(outdir , prefix , " genes.tsv" ),
56+ utils :: write.table(names(seGene ), file = paste0(transcript_gtffn , " genes.tsv" ),
5757 sep = " \t " , quote = FALSE , row.names = FALSE , col.names = FALSE )
5858
5959 # R.utils::gzip(paste0(outdir, "txANDgenes.tsv"))
@@ -105,14 +105,8 @@ writeCountsOutput <- function(se, varname = "counts",
105105
106106 } else {
107107 estimates <- assays(se )[[varname ]]
108- if (feature == " transcript" ){
109- estimatesfn <- paste(outdir , prefix , varname ," _" ,feature ," .mtx" , sep = " " )
110- Matrix :: writeMM(estimates , estimatesfn )
111- # R.utils::gzip(estimatesfn)
112-
113- } else {
114- estimatesfn <- paste(outdir , prefix , varname ," _" ,feature ," .mtx" , sep = " " )
115- Matrix :: writeMM(estimates , estimatesfn )
108+ estimatesfn <- paste(outdir , prefix , varname ," _" ,feature ," .mtx" , sep = " " )
109+ Matrix :: writeMM(estimates , estimatesfn )
116110 # R.utils::gzip(estimatesfn)
117111 }
118112 }
@@ -327,8 +321,8 @@ readFromGTF <- function(file, keep.extra.columns = NULL){
327321# ' ))
328322# ' path <- tempdir()
329323# ' writeBambuOutput(se, path)
330- importBambuResults <- function (path , prefixes ){
331- if (is.na( prefixes ) ){
324+ importBambuResults <- function (path , prefixes = " " ){
325+ if (prefixes == " " ){
332326 path <- paste0(path ," /" )
333327 } else {
334328 path <- paste0(path ," /" ,prefixes ," _" )
@@ -343,7 +337,7 @@ importBambuResults <- function(path, prefixes){
343337 incompatibleCounts = readMM(paste0(path , " incompatibleCounts.mtx" ))
344338 }
345339 if (file.exists(paste0(path , " barcodes.tsv" ))){
346- incompatibleCounts = readMM (paste0(path , " barcodes.tsv" ))
340+ incompatibleCounts = read.table (paste0(path , " barcodes.tsv" ))
347341 }
348342 geneIds = read.table(paste0(path , " genes.tsv" ))
349343 txIds = read.table(paste0(path , " txANDgenes.tsv" ))
0 commit comments