Skip to content

Commit

Permalink
fixing handling of nanopore samplesheets for viralrecon
Browse files Browse the repository at this point in the history
  • Loading branch information
nrminor committed Apr 7, 2024
1 parent cd9e25c commit 00bf580
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/viralrecon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,15 @@ impl CollectByPlatform for SeqPlatform {
Ok(vec![sample_id, fastq1, fastq2].join(","))
}
SeqPlatform::Nanopore => {
// figure out which FASTQ files go with the provided sample_id
let barcode_fastq = fastq_paths
.iter()
.filter_map(|x| x.to_str())
.find(|x| x.contains(sample_id.as_ref()))
.ok_or("Sample ID no longer matches a FASTQ.")
.unwrap_or("");
// pull out the barcode
let barcode = if sample_id.starts_with("0") {
sample_id.replace("barcode", "").chars().skip(1).collect()
} else {
sample_id.replace("barcode", "")
};

// instantiate an illumina line and return it
Ok(vec![sample_id.as_ref(), barcode_fastq].join(","))
// instantiate a Nanopore line and return it
Ok(vec![sample_id.as_ref(), &barcode].join(","))
}
}
}
Expand Down

0 comments on commit 00bf580

Please sign in to comment.