Skip to content

Commit

Permalink
Handle #N/A values
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwang401 committed Mar 29, 2024
1 parent 30c5659 commit eba1b8b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src-tauri/src/serializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,19 @@ fn serialize_peptides(
wtr.write_record(&headers_str)?;

for peptide in peptides {
let intensities = peptide
.intensities
.iter()
.map(|i| {
match i {
None => "#N/A".to_string(),
Some(i) => i.to_string(),
}
}).collect();

let record = [
vec![peptide.protein, peptide.name, peptide.mass_charge_ratio.to_string()],
peptide.intensities.iter().map(|i| i.unwrap().to_string()).collect()
intensities
].concat();
wtr.write_record(&record)?;
}
Expand Down

0 comments on commit eba1b8b

Please sign in to comment.