Skip to content

Commit

Permalink
feat: bump dependencies (especially noodles) (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Sep 18, 2023
1 parent 9cd76e3 commit 34b540c
Show file tree
Hide file tree
Showing 12 changed files with 496 additions and 610 deletions.
808 changes: 351 additions & 457 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ path = "src/main.rs"

[dependencies]
actix-web = "4.4"
annonars = "0.14"
annonars = "0.20"
anyhow = "1.0"
bgzip = "0.3"
bio = "1.3"
Expand All @@ -40,28 +40,28 @@ csv = "1.2"
derivative = "2.2"
env_logger = "0.10"
flate2 = "1.0"
hgvs = "0.10"
hgvs = "0.11"
indexmap = "2.0"
indicatif = "0.17"
jsonl = "4.0"
lazy_static = "1.4"
log = "0.4"
nom = "7.1"
noodles-bgzf = "0.22"
noodles-bgzf = "0.24"
noodles-core = "0.12"
noodles-csi = "0.22"
noodles-fasta = "0.27"
noodles-tabix = "0.25"
noodles-vcf = "0.34"
noodles-csi = "0.24"
noodles-fasta = "0.29"
noodles-tabix = "0.29"
noodles-vcf = "0.39"
parse-display = "0.8"
procfs = "0.15"
prost = "0.11"
quick_cache = "0.3"
prost = "0.12"
quick_cache = "0.4"
rand = "0.8"
rand_core = "0.6"
rocksdb = { version = "0.21", features = ["multi-threaded-cf"] }
rustc-hash = "1.1"
seqrepo = "0.7"
seqrepo = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_with = "3.3"
Expand Down
24 changes: 12 additions & 12 deletions src/annotate/seqvars/csq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl ConsequencePredictor {

// Skip transcripts that are protein coding but do not have a CDS.
// TODO: do not include such transcripts when building the database.
if TranscriptBiotype::from_i32(tx.biotype).expect("invalid tx biotype")
if TranscriptBiotype::try_from(tx.biotype).expect("invalid tx biotype")
== TranscriptBiotype::Coding
&& tx.start_codon.is_none()
{
Expand Down Expand Up @@ -222,23 +222,23 @@ impl ConsequencePredictor {
if var_start <= exon_start && var_end >= exon_end {
consequences.push(Consequence::ExonLossVariant);
if var_start < exon_start {
if Strand::from_i32(alignment.strand).expect("invalid strand") == Strand::Plus
if Strand::try_from(alignment.strand).expect("invalid strand") == Strand::Plus
&& rank.ord != 1
{
consequences.push(Consequence::SpliceAcceptorVariant);
} else if Strand::from_i32(alignment.strand).expect("invalid strand")
} else if Strand::try_from(alignment.strand).expect("invalid strand")
== Strand::Minus
&& rank.ord != rank.total
{
consequences.push(Consequence::SpliceDonorVariant);
}
}
if var_end > exon_end {
if Strand::from_i32(alignment.strand).expect("invalid strand") == Strand::Plus
if Strand::try_from(alignment.strand).expect("invalid strand") == Strand::Plus
&& rank.ord != rank.total
{
consequences.push(Consequence::SpliceDonorVariant);
} else if Strand::from_i32(alignment.strand).expect("invalid strand")
} else if Strand::try_from(alignment.strand).expect("invalid strand")
== Strand::Minus
&& rank.ord != rank.total
{
Expand All @@ -255,15 +255,15 @@ impl ConsequencePredictor {
// Check the cases where the variant overlaps with the splice acceptor/donor site.
if var_start < intron_start + 2 && var_end > intron_start - ins_shift {
// Left side, is acceptor/donor depending on transcript's strand.
match Strand::from_i32(alignment.strand).expect("invalid strand") {
match Strand::try_from(alignment.strand).expect("invalid strand") {
Strand::Plus => consequences.push(Consequence::SpliceDonorVariant),
Strand::Minus => consequences.push(Consequence::SpliceAcceptorVariant),
}
}
// Check the case where the variant overlaps with the splice donor site.
if var_start < intron_end + ins_shift && var_end > intron_end - 2 {
// Left side, is acceptor/donor depending on transcript's strand.
match Strand::from_i32(alignment.strand).expect("invalid strand") {
match Strand::try_from(alignment.strand).expect("invalid strand") {
Strand::Plus => consequences.push(Consequence::SpliceAcceptorVariant),
Strand::Minus => consequences.push(Consequence::SpliceDonorVariant),
}
Expand All @@ -279,7 +279,7 @@ impl ConsequencePredictor {
consequences.push(Consequence::SpliceRegionVariant);
}
if var_start < exon_end && var_end > exon_end - 3 {
if Strand::from_i32(alignment.strand).expect("invalid strand") == Strand::Plus {
if Strand::try_from(alignment.strand).expect("invalid strand") == Strand::Plus {
if rank.ord != rank.total {
consequences.push(Consequence::SpliceRegionVariant);
}
Expand All @@ -291,7 +291,7 @@ impl ConsequencePredictor {
}
}
if var_start < exon_start + 3 && var_end > exon_start {
if Strand::from_i32(alignment.strand).expect("invalid strand") == Strand::Plus {
if Strand::try_from(alignment.strand).expect("invalid strand") == Strand::Plus {
if rank.ord != 1 {
consequences.push(Consequence::SpliceRegionVariant);
}
Expand All @@ -314,7 +314,7 @@ impl ConsequencePredictor {
let max_end = max_end.expect("must have seen exon");

let feature_biotype =
match TranscriptBiotype::from_i32(tx.biotype).expect("invalid transcript biotype") {
match TranscriptBiotype::try_from(tx.biotype).expect("invalid transcript biotype") {
TranscriptBiotype::Coding => FeatureBiotype::Coding,
TranscriptBiotype::NonCoding => FeatureBiotype::Noncoding,
};
Expand All @@ -334,7 +334,7 @@ impl ConsequencePredictor {
} else if is_upstream {
let val = -(min_start - var_end);
if val.abs() <= 5_000 {
match Strand::from_i32(alignment.strand).expect("invalid strand") {
match Strand::try_from(alignment.strand).expect("invalid strand") {
Strand::Plus => consequences.push(Consequence::UpstreamGeneVariant),
Strand::Minus => consequences.push(Consequence::DownstreamGeneVariant),
}
Expand All @@ -343,7 +343,7 @@ impl ConsequencePredictor {
} else if is_downstream {
let val = var_start - max_end;
if val.abs() <= 5_000 {
match Strand::from_i32(alignment.strand).expect("invalid strand") {
match Strand::try_from(alignment.strand).expect("invalid strand") {
Strand::Plus => consequences.push(Consequence::DownstreamGeneVariant),
Strand::Minus => consequences.push(Consequence::UpstreamGeneVariant),
}
Expand Down
44 changes: 22 additions & 22 deletions src/annotate/seqvars/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,16 @@ fn build_header(header_in: &VcfHeader) -> VcfHeader {
);

header_out.infos_mut().insert(
field::Key::from_str("clinvar_patho").unwrap(),
Map::<Info>::new(Number::Count(1), Type::String, "ClinVar pathogenicity"),
field::Key::from_str("clinvar_clinsig").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::String,
"ClinVar clinical significance",
),
);
header_out.infos_mut().insert(
field::Key::from_str("clinvar_vcv").unwrap(),
Map::<Info>::new(Number::Count(1), Type::String, "ClinVar VCV accession"),
field::Key::from_str("clinvar_rcv").unwrap(),
Map::<Info>::new(Number::Count(1), Type::String, "ClinVar RCV accession"),
);

header_out
Expand Down Expand Up @@ -392,24 +396,20 @@ where
clinvar_minimal::pbs::Record::decode(&mut std::io::Cursor::new(&raw_value))?;

let clinvar_minimal::pbs::Record {
summary_clinvar_pathogenicity,
vcv,
clinical_significance,
rcv,
..
} = clinvar_record;
let summary_clinvar_pathogenicity: Vec<_> = summary_clinvar_pathogenicity
.into_iter()
.map(|i: i32| -> clinvar_minimal::cli::reading::Pathogenicity { i.into() })
.collect();
let clinical_significance: clinvar_minimal::cli::reading::ClinicalSignificance =
clinical_significance.into();

vcf_record.info_mut().insert(
field::Key::from_str("clinvar_patho").unwrap(),
Some(field::Value::String(
summary_clinvar_pathogenicity.first().unwrap().to_string(),
)),
field::Key::from_str("clinvar_clinsig").unwrap(),
Some(field::Value::String(clinical_significance.to_string())),
);
vcf_record.info_mut().insert(
field::Key::from_str("clinvar_vcv").unwrap(),
Some(field::Value::String(vcv)),
field::Key::from_str("clinvar_rcv").unwrap(),
Some(field::Value::String(rcv)),
);
}

Expand Down Expand Up @@ -1078,15 +1078,15 @@ impl VarFishSeqvarTsvWriter {
) -> Result<(), anyhow::Error> {
tsv_record.in_clinvar = record
.info()
.get(&field::Key::from_str("clinvar_patho").unwrap())
.get(&field::Key::from_str("clinvar_clinsig").unwrap())
.unwrap_or_default()
.map(|v| match v {
field::Value::String(value) => {
clinvar_minimal::cli::reading::Pathogenicity::from_str(value).unwrap_or(
clinvar_minimal::cli::reading::Pathogenicity::UncertainSignificance,
) >= clinvar_minimal::cli::reading::Pathogenicity::LikelyPathogenic
clinvar_minimal::cli::reading::ClinicalSignificance::from_str(value).unwrap_or(
clinvar_minimal::cli::reading::ClinicalSignificance::UncertainSignificance,
) >= clinvar_minimal::cli::reading::ClinicalSignificance::LikelyPathogenic
}
_ => panic!("Unexpected value type for INFO/clinvar_patho"),
_ => panic!("Unexpected value type for INFO/clinvar_clinsig"),
})
.unwrap_or_default();

Expand Down Expand Up @@ -1368,7 +1368,7 @@ impl AnnotatedVcfWriter for VarFishSeqvarTsvWriter {
/// Run the annotation with the given `Write` within the `VcfWriter`.
fn run_with_writer(writer: &mut dyn AnnotatedVcfWriter, args: &Args) -> Result<(), anyhow::Error> {
tracing::info!("Open VCF and read header");
let mut reader = VariantReaderBuilder::default().build_from_path(&args.path_input_vcf)?;
let mut reader = VariantReaderBuilder.build_from_path(&args.path_input_vcf)?;
let header_in = reader.read_header()?;
let header_out = build_header(&header_in);

Expand Down
4 changes: 2 additions & 2 deletions src/annotate/seqvars/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl ProviderInterface for MehariProvider {
tx_ac: tx_ac.to_string(),
alt_ac: alt_ac.to_string(),
alt_aln_method: ALT_ALN_METHOD.to_string(),
alt_strand: match Strand::from_i32(genome_alignment.strand)
alt_strand: match Strand::try_from(genome_alignment.strand)
.expect("invalid strand")
{
Strand::Plus => 1,
Expand Down Expand Up @@ -324,7 +324,7 @@ impl ProviderInterface for MehariProvider {
TxForRegionRecord {
tx_ac: tx.id.clone(),
alt_ac: alt_ac.to_string(),
alt_strand: match Strand::from_i32(alt_strand).expect("invalid strand") {
alt_strand: match Strand::try_from(alt_strand).expect("invalid strand") {
Strand::Plus => 1,
Strand::Minus => -1,
},
Expand Down
Loading

0 comments on commit 34b540c

Please sign in to comment.