Skip to content

Instantly share code, notes, and snippets.

@clintval
Created January 26, 2021 05:50
Show Gist options
  • Select an option

  • Save clintval/f1a0e5d30b08f490fca4ec308a5d9c87 to your computer and use it in GitHub Desktop.

Select an option

Save clintval/f1a0e5d30b08f490fca4ec308a5d9c87 to your computer and use it in GitHub Desktop.
An amplicon record for VarDictJava's amplicon-mode
/// A record of output from VarDict/VarDictJava run in amplicon-aware mode.
#[derive(Debug, Deserialize)]
struct AmpliconVariant<'a> {
pub sample: &'a str,
pub interval_name: &'a str,
pub contig: &'a str,
pub start: u64,
pub end: u64,
pub ref_allele: &'a str,
pub alt_allele: &'a str,
pub depth: u32,
pub alt_depth: u32,
pub ref_forward: u32,
pub ref_reverse: u32,
pub alt_forward: u32,
pub alt_reverse: u32,
pub gt: &'a str,
pub af: f32,
pub strand_bias: &'a str,
pub mean_position_in_read: f32,
pub stdev_position_in_read: f32,
pub mean_base_quality: f32,
pub stdev_base_quality: f32,
pub strand_bias_p_value: f32,
#[serde(deserialize_with = "maybe_infinite_f32")]
pub strand_bias_odds_ratio: f32,
pub mean_mapping_quality: f32,
pub signal_to_noise: u32,
pub af_high_quality_bases: f32,
pub af_adjusted: f32,
pub num_bases_3_prime_shift_for_deletions: u32,
pub microsatellite: u32,
pub microsatellite_length: u32,
pub mean_mismatches_in_reads: f32,
pub high_quality_variant_reads: u32,
pub high_quality_total_reads: u32,
pub flank_seq_5_prime: &'a str,
pub flank_seq_3_prime: &'a str,
// Position format, unused in VCF.
pub segment: &'a str,
pub variant_type: &'a str,
pub num_amplicons_supporting_variant: u32,
pub total_amplicons_overlapping: u32,
pub num_amplicons_rare: u32,
// A zero or one, need a custom deserializer.
pub top_variant_in_amplicon_does_not_match: bool,
}
impl<'a> AbstractInterval for AmpliconVariant<'a> {
fn contig(&self) -> &str {
&self.contig
}
fn range(&self) -> Range<Position> {
Range { start: self.start, end: self.end }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment