/// Writes output record into output files
Writes output record into output files
Writes output record into output files
fn write_impl(&mut self, record: NextcladeRecord) -> Result<(), Report> {
    let NextcladeRecord {
      index,
      seq_name,
      outputs_or_err,
    } = record;
    match outputs_or_err {
      Ok((qry_seq_stripped, translations, nextclade_outputs)) => {
        let NextcladeOutputs {
          warnings,
          insertions,
          missing_genes,
          ..
        } = &nextclade_outputs;
        if let Some(fasta_writer) = &mut self.fasta_writer {
          fasta_writer.write(&seq_name, &from_nuc_seq(&qry_seq_stripped))?;
        }
        if let Some(fasta_peptide_writer) = &mut self.fasta_peptide_writer {
          for translation in &translations {
            fasta_peptide_writer.write(&seq_name, translation)?;
          }
        }
        if let Some(insertions_csv_writer) = &mut self.insertions_csv_writer {
          insertions_csv_writer.write(&seq_name, insertions, &translations)?;
        }
        if let Some(errors_csv_writer) = &mut self.errors_csv_writer {
          errors_csv_writer.write_aa_errors(&seq_name, warnings, missing_genes)?;
        }
        if let Some(output_csv_writer) = &mut self.output_csv_writer {
          output_csv_writer.write(&nextclade_outputs)?;
        }
        if let Some(output_tsv_writer) = &mut self.output_tsv_writer {
          output_tsv_writer.write(&nextclade_outputs)?;
        }
        if let Some(output_ndjson_writer) = &mut self.output_ndjson_writer {
          output_ndjson_writer.write(&nextclade_outputs)?;
        }
        if let Some(output_json_writer) = &mut self.output_json_writer {
          output_json_writer.write(nextclade_outputs);
        }
      }
      Err(report) => {
        let cause = report_to_string(&report);
        let message = format!(
          "In sequence #{index} '{seq_name}': {cause}. Note that this sequence will not be included in the results."
        );
        warn!("{message}");
        if let Some(errors_csv_writer) = &mut self.errors_csv_writer {
          errors_csv_writer.write_nuc_error(&seq_name, &message)?;
        }
      }
    }
    Ok(())
  }
fn write_impl ( & mut self , record : NextcladeRecord ) -> Result < ( ) , Report > { let NextcladeRecord { index , seq_name , outputs_or_err , } = record ; match outputs_or_err { Ok ( ( qry_seq_stripped , translations , nextclade_outputs ) ) => { let NextcladeOutputs { warnings , insertions , missing_genes , .. } = & nextclade_outputs ; if let Some ( fasta_writer ) = & mut self . fasta_writer { fasta_writer . write ( & seq_name , & from_nuc_seq ( & qry_seq_stripped ) ) ? ; } if let Some ( fasta_peptide_writer ) = & mut self . fasta_peptide_writer { for translation in & translations { fasta_peptide_writer . write ( & seq_name , translation ) ? ; } } if let Some ( insertions_csv_writer ) = & mut self . insertions_csv_writer { insertions_csv_writer . write ( & seq_name , insertions , & translations ) ? ; } if let Some ( errors_csv_writer ) = & mut self . errors_csv_writer { errors_csv_writer . write_aa_errors ( & seq_name , warnings , missing_genes ) ? ; } if let Some ( output_csv_writer ) = & mut self . output_csv_writer { output_csv_writer . write ( & nextclade_outputs ) ? ; } if let Some ( output_tsv_writer ) = & mut self . output_tsv_writer { output_tsv_writer . write ( & nextclade_outputs ) ? ; } if let Some ( output_ndjson_writer ) = & mut self . output_ndjson_writer { output_ndjson_writer . write ( & nextclade_outputs ) ? ; } if let Some ( output_json_writer ) = & mut self . output_json_writer { output_json_writer . write ( nextclade_outputs ) ; } } Err ( report ) => { let cause = report_to_string ( & report ) ; let message = format ! ( " " ) ; warn ! ( " " ) ; if let Some ( errors_csv_writer ) = & mut self . errors_csv_writer { errors_csv_writer . write_nuc_error ( & seq_name , & message ) ? ; } } } Ok ( ( ) ) }
Writes output record into output files
Writes output record into output files
&mut self
record
NextcladeRecord