Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: inhouse freqs useable in seqvars query (#232) #522

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ tests/db/compile/** filter=lfs diff=lfs merge=lfs -text
tests/db/hpo/** filter=lfs diff=lfs merge=lfs -text
tests/seqvars/ingest/db/grch37/** filter=lfs diff=lfs merge=lfs -text
tests/seqvars/ingest/db/grch38/** filter=lfs diff=lfs merge=lfs -text
tests/seqvars/query/db-dynamic/** filter=lfs diff=lfs merge=lfs -text
tests/strucvars/query/*.vcf filter=lfs diff=lfs merge=lfs -text
tests/strucvars/query/grch37/** filter=lfs diff=lfs merge=lfs -text
tests/strucvars/query/noref/** filter=lfs diff=lfs merge=lfs -text
tests/strucvars/query/db/** filter=lfs diff=lfs merge=lfs -text
tests/strucvars/query/db-dynamic/** filter=lfs diff=lfs merge=lfs -text
src/strucvars/query/snapshots/*smoke_test*.snap filter=lfs diff=lfs merge=lfs -text
5 changes: 5 additions & 0 deletions src/seqvars/aggregate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,11 @@ pub async fn run(args_common: &crate::common::Args, args: &Args) -> Result<(), a
tracing::info!(" writing meta information");
let cf_meta = db.cf_handle("meta").unwrap();
db.put_cf(&cf_meta, "varfish-worker-version", common::worker_version())?;
db.put_cf(
&cf_meta,
"genome-release",
args.genomebuild.name().to_lowercase(),
)?;
db.put_cf(&cf_meta, "db-name", "seqvars-aggregation")?;
tracing::info!("... done opening RocksDB");

Expand Down
37 changes: 37 additions & 0 deletions src/seqvars/query/interpreter/frequency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@ pub fn passes(query: &CaseQuery, s: &VariantRecord) -> Result<bool, anyhow::Erro
);
return Ok(false);
}
// Note that allele frequency cannot be calculated from inhouse data as of yet
// as we cannot differentiate between "no coverage" and "hom. ref." yet.
if frequency.inhouse.enabled
&& (frequency.inhouse.max_het.is_some()
&& s.population_frequencies.inhouse.het
> frequency.inhouse.max_het.expect("tested before")
|| frequency.inhouse.max_hom.is_some()
&& s.population_frequencies.inhouse.hom
> frequency.inhouse.max_hom.expect("tested before"))
{
tracing::trace!(
"variant {:?} fails in-house frequency filter {:?}",
s,
&frequency.inhouse
);
return Ok(false);
}
} else {
if frequency.gnomad_exomes.enabled
&& (frequency.gnomad_exomes.max_af.is_some()
Expand Down Expand Up @@ -88,6 +105,26 @@ pub fn passes(query: &CaseQuery, s: &VariantRecord) -> Result<bool, anyhow::Erro
);
return Ok(false);
}
// Note that allele frequency cannot be calculated from inhouse data as of yet
// as we cannot differentiate between "no coverage" and "hom. ref." yet.
if frequency.inhouse.enabled
&& (frequency.inhouse.max_het.is_some()
&& s.population_frequencies.inhouse.het
> frequency.inhouse.max_het.expect("tested before")
|| frequency.inhouse.max_hom.is_some()
&& s.population_frequencies.inhouse.hom
> frequency.inhouse.max_hom.expect("tested before")
|| frequency.inhouse.max_hemi.is_some()
&& s.population_frequencies.inhouse.hemi
> frequency.inhouse.max_hemi.expect("tested before"))
{
tracing::trace!(
"variant {:?} fails in-house frequency filter {:?}",
s,
&frequency.inhouse
);
return Ok(false);
}
}

Ok(true)
Expand Down
Loading
Loading