@@ -28,6 +28,7 @@ struct FilterProcessorConfig {
2828 deplete : bool ,
2929 rename : bool ,
3030 rename_random : bool ,
31+ output_fasta : bool ,
3132 debug : bool ,
3233}
3334
@@ -114,9 +115,10 @@ fn format_record_to_buffer<R: Record>(
114115 counter : u64 ,
115116 rename : bool ,
116117 rename_random : bool ,
118+ output_fasta : bool ,
117119 buffer : & mut Vec < u8 > ,
118120) -> Result < ( ) > {
119- let is_fasta = record. qual ( ) . is_none ( ) ;
121+ let is_fasta = output_fasta || record. qual ( ) . is_none ( ) ;
120122
121123 // Header
122124 buffer. write_all ( if is_fasta { b">" } else { b"@" } ) ?;
@@ -290,6 +292,7 @@ struct FilterProcessor {
290292 deplete : bool ,
291293 rename : bool ,
292294 rename_random : bool ,
295+ output_fasta : bool ,
293296 debug : bool ,
294297
295298 hasher : KmerHasher ,
@@ -394,6 +397,7 @@ impl FilterProcessor {
394397 deplete : config. deplete ,
395398 rename : config. rename ,
396399 rename_random : config. rename_random ,
400+ output_fasta : config. output_fasta ,
397401 debug : config. debug ,
398402 hasher : KmerHasher :: new ( kmer_length as usize ) ,
399403 local_buffer : Vec :: with_capacity ( DEFAULT_BUFFER_SIZE ) ,
@@ -569,6 +573,7 @@ impl FilterProcessor {
569573 self . local_stats . output_seq_counter ,
570574 self . rename ,
571575 self . rename_random ,
576+ self . output_fasta ,
572577 & mut self . local_buffer ,
573578 )
574579 }
@@ -581,6 +586,7 @@ impl FilterProcessor {
581586 self . local_stats . output_seq_counter ,
582587 self . rename ,
583588 self . rename_random ,
589+ self . output_fasta ,
584590 & mut self . local_buffer2 ,
585591 )
586592 }
@@ -928,6 +934,7 @@ pub fn run(config: &FilterConfig) -> Result<()> {
928934 deplete : config. deplete ,
929935 rename : config. rename ,
930936 rename_random : config. rename_random ,
937+ output_fasta : config. output_fasta ,
931938 debug : config. debug ,
932939 } ;
933940 let mut processor = FilterProcessor :: new (
0 commit comments