@@ -20,7 +20,6 @@ process BAMBU_TRANSCRIPT_DISCOVERY{
2020 path (' gene_counts/se_gene_counts.rds' ), emit: se_gene_counts
2121 path (' extended_annotations.rds' ), emit: extended_annotations
2222 path (' extended_annotations.gtf' )
23- path (' sample_names.rds' ), emit: sample_names
2423 path (' unique_counts' )
2524 path (' gene_counts' )
2625 path " versions.yml" , topic: ' versions'
@@ -33,26 +32,26 @@ process BAMBU_TRANSCRIPT_DISCOVERY{
3332 source(Sys.which("save_counts.R"))
3433
3534 annotation <- readRDS("$bambu_annotation ")
36- readClassFile <- strsplit("${ rds_files.join(',')} ", ",")[[1]]
3735 sampleNames <- strsplit("${ sample.join(',')} ", ",")[[1]]
36+ readClassFile <- setNames(strsplit("${ rds_files.join(',')} ", ",")[[1]], sampleNames)
3837 sampleData <- strsplit("${ spatial_metadata_files.join(',')} ", ",")[[1]]
3938 chemistry <- setNames(strsplit("${ meta.collect { m -> m.chemistry }.join(',')} ", ",")[[1]], sampleNames)
4039 technology <- setNames(strsplit("${ meta.collect { m -> m.technology }.join(',')} ", ",")[[1]], sampleNames)
4140
4241 # Transcript discovery
43- extendedAnno <- bambu.singlecell(reads = readClassFile, annotations = annotation, genome = " $g enome ", ncore = $t ask . cpus ,
44- discovery = TRUE, quant = FALSE, verbose = FALSE, assignDist = FALSE, NDR = $ndr )
42+ extendedAnno <- bambu.singlecell(reads = readClassFile, output = "extendedAnnotations" ,
43+ annotations = annotation, genome = " $g enome ", ncore = $t ask . cpus , verbose = FALSE, NDR = $ndr )
4544 saveRDS(extendedAnno, "extended_annotations.rds")
4645 writeToGTF(extendedAnno, "extended_annotations.gtf")
4746
48- # Quantification without EM
47+ # Read to transcript assignment
4948 sampleData <- if (any(startsWith(chemistry, "visium-v"))) sampleData else NULL # Add spatial metadata for visium samples
50- quantData <- bambu.singlecell(reads = readClassFile, annotations = extendedAnno, genome = " $g enome ", ncore = $t ask . cpus ,
51- discovery = FALSE, quant = FALSE, verbose = FALSE, opt.em = list(degradationBias = FALSE), assignDist = TRUE , sampleData = sampleData)
49+ quantData <- bambu.singlecell(reads = readClassFile, output = "quantData" ,
50+ annotations = extendedAnno, genome = " $g enome ", ncore = $t ask . cpus , verbose = FALSE , sampleData = sampleData)
5251 saveRDS(quantData, "quant_data.rds")
5352
54- # Generate unique counts SE from quantData
55- seDiscovery <- generateUniqueCountsSEFromQuantData( quantData, extendedAnno)
53+ # Quantification without EM
54+ seDiscovery <- bambu.singlecell(reads = quantData, output = "uniqueCounts", annotations = extendedAnno)
5655 colData(seDiscovery)\$ chemistry <- unname(chemistry[colData(seDiscovery)\$ sampleName]) # Add chemistry into colData (for subsequent batch correction)
5756 colData(seDiscovery)\$ technology <- unname(technology[colData(seDiscovery)\$ sampleName]) # Add technology into colData (for subsequent batch correction)
5857 save_counts(seDiscovery, "unique_counts", "Transcript Expression")
@@ -61,9 +60,6 @@ process BAMBU_TRANSCRIPT_DISCOVERY{
6160 seDiscovery.gene <- transcriptToGeneExpression(seDiscovery)
6261 save_counts(seDiscovery.gene, "gene_counts")
6362
64- # Save sampleNames (required for multi-sample Seurat clustering)
65- saveRDS(sampleNames, "sample_names.rds")
66-
6763 writeLines(c('"${ task.process} ":', paste0(' R: ', R.Version()\$ version.string), paste0(' bambu: ', as.character(packageVersion("bambu")))), "versions.yml")
6864 """
6965}
0 commit comments