@@ -273,7 +273,7 @@ fn align_reads(params: &Parameters) -> anyhow::Result<()> {
273273 let time_finish = chrono:: Local :: now ( ) ;
274274
275275 // Write Log.final.out
276- let log_path = params. out_file_name_prefix . join ( "Log.final.out" ) ;
276+ let log_path = params. output_path ( "Log.final.out" ) ;
277277 if let Some ( parent) = log_path. parent ( ) {
278278 std:: fs:: create_dir_all ( parent) ?;
279279 }
@@ -282,7 +282,7 @@ fn align_reads(params: &Parameters) -> anyhow::Result<()> {
282282
283283 // Write ReadsPerGene.out.tab if quantMode GeneCounts was requested.
284284 if let Some ( ref ctx) = quant_ctx {
285- let quant_path = params. out_file_name_prefix . join ( "ReadsPerGene.out.tab" ) ;
285+ let quant_path = params. output_path ( "ReadsPerGene.out.tab" ) ;
286286 ctx. counts . write_output ( & quant_path, & ctx. gene_ann ) ?;
287287 info ! ( "Wrote {}" , quant_path. display( ) ) ;
288288 }
@@ -313,9 +313,7 @@ fn run_single_pass(
313313
314314 // Open transcriptome BAM writer if requested.
315315 let mut tr_writer: Option < BamWriter > = if let Some ( tidx) = tr. as_ref ( ) {
316- let path = params
317- . out_file_name_prefix
318- . join ( "Aligned.toTranscriptome.out.bam" ) ;
316+ let path = params. output_path ( "Aligned.toTranscriptome.out.bam" ) ;
319317 info ! ( "Writing transcriptome BAM to {}" , path. display( ) ) ;
320318 if let Some ( parent) = path. parent ( ) {
321319 std:: fs:: create_dir_all ( parent) ?;
@@ -332,15 +330,15 @@ fn run_single_pass(
332330 let is_paired = params. read_files_in . len ( ) == 2 ;
333331 let mut unmapped_w1: Option < UnmappedFastqWriter > =
334332 if params. out_reads_unmapped == OutReadsUnmapped :: Fastx {
335- let path = params. out_file_name_prefix . join ( "Unmapped.out.mate1" ) ;
333+ let path = params. output_path ( "Unmapped.out.mate1" ) ;
336334 info ! ( "Writing unmapped reads to {}" , path. display( ) ) ;
337335 Some ( UnmappedFastqWriter :: create ( & path) ?)
338336 } else {
339337 None
340338 } ;
341339 let mut unmapped_w2: Option < UnmappedFastqWriter > =
342340 if params. out_reads_unmapped == OutReadsUnmapped :: Fastx && is_paired {
343- let path = params. out_file_name_prefix . join ( "Unmapped.out.mate2" ) ;
341+ let path = params. output_path ( "Unmapped.out.mate2" ) ;
344342 info ! ( "Writing unmapped mate2 reads to {}" , path. display( ) ) ;
345343 Some ( UnmappedFastqWriter :: create ( & path) ?)
346344 } else {
@@ -379,7 +377,7 @@ fn run_single_pass(
379377 }
380378 OutStd :: None => match out_type. format {
381379 OutSamFormat :: Sam => {
382- let output_path = params. out_file_name_prefix . join ( "Aligned.out.sam" ) ;
380+ let output_path = params. output_path ( "Aligned.out.sam" ) ;
383381 info ! ( "Writing SAM to {}" , output_path. display( ) ) ;
384382 if let Some ( parent) = output_path. parent ( ) {
385383 std:: fs:: create_dir_all ( parent) ?;
@@ -389,11 +387,9 @@ fn run_single_pass(
389387 OutSamFormat :: Bam => {
390388 let sorted = out_type. sort_order == Some ( OutSamSortOrder :: SortedByCoordinate ) ;
391389 let output_path = if sorted {
392- params
393- . out_file_name_prefix
394- . join ( "Aligned.sortedByCoord.out.bam" )
390+ params. output_path ( "Aligned.sortedByCoord.out.bam" )
395391 } else {
396- params. out_file_name_prefix . join ( "Aligned.out.bam" )
392+ params. output_path ( "Aligned.out.bam" )
397393 } ;
398394 info ! ( "Writing BAM to {}" , output_path. display( ) ) ;
399395 if let Some ( parent) = output_path. parent ( ) {
@@ -451,7 +447,7 @@ fn run_single_pass(
451447 }
452448
453449 // 5. Write SJ.out.tab file
454- let sj_output_path = params. out_file_name_prefix . join ( "SJ.out.tab" ) ;
450+ let sj_output_path = params. output_path ( "SJ.out.tab" ) ;
455451 if !sj_stats. is_empty ( ) {
456452 info ! (
457453 "Writing splice junction statistics to {}" ,
@@ -480,7 +476,7 @@ fn run_two_pass(
480476 let ( sj_stats_pass1, novel_junctions) = run_pass1 ( index, params) ?;
481477
482478 // Write SJ.pass1.out.tab
483- let pass1_path = params. out_file_name_prefix . join ( "SJ.pass1.out.tab" ) ;
479+ let pass1_path = params. output_path ( "SJ.pass1.out.tab" ) ;
484480
485481 // Create output directory if it doesn't exist
486482 if let Some ( parent) = pass1_path. parent ( ) {
@@ -878,12 +874,11 @@ fn align_reads_single_end<W: AlignmentWriter + ?Sized>(
878874 // Create chimeric output writer if enabled
879875 let mut chimeric_writer = if params. chim_segment_min > 0 && params. chim_out_junctions ( ) {
880876 use crate :: chimeric:: ChimericJunctionWriter ;
881- let prefix = params. out_file_name_prefix . to_str ( ) . unwrap_or ( "." ) ;
882877 info ! (
883878 "Chimeric detection enabled (chimSegmentMin={})" ,
884879 params. chim_segment_min
885880 ) ;
886- Some ( ChimericJunctionWriter :: new ( prefix ) ?)
881+ Some ( ChimericJunctionWriter :: new ( & params . out_file_name_prefix ) ?)
887882 } else {
888883 None
889884 } ;
@@ -1309,12 +1304,11 @@ fn align_reads_paired_end<W: AlignmentWriter + ?Sized>(
13091304 // Create chimeric output writer if enabled
13101305 let mut chimeric_writer = if params. chim_segment_min > 0 && params. chim_out_junctions ( ) {
13111306 use crate :: chimeric:: ChimericJunctionWriter ;
1312- let prefix = params. out_file_name_prefix . to_str ( ) . unwrap_or ( "." ) ;
13131307 info ! (
13141308 "Chimeric detection enabled (chimSegmentMin={})" ,
13151309 params. chim_segment_min
13161310 ) ;
1317- Some ( ChimericJunctionWriter :: new ( prefix ) ?)
1311+ Some ( ChimericJunctionWriter :: new ( & params . out_file_name_prefix ) ?)
13181312 } else {
13191313 None
13201314 } ;
0 commit comments