Skip to content

fix: work around issue with glnexus #362 #363

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

Merged
merged 1 commit into from
Feb 22, 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
64 changes: 0 additions & 64 deletions misc/fix_glnexus.py

This file was deleted.

41 changes: 24 additions & 17 deletions src/annotate/seqvars/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use annonars::common::keys;
use annonars::freqs::cli::import::reading::guess_assembly;
use annonars::freqs::serialized::{auto, mt, xy};
use anyhow::anyhow;
use noodles_vcf::header::record::value::map::format::Type as FormatType;
use noodles_vcf::record::genotypes::keys::key::{
self, CONDITIONAL_GENOTYPE_QUALITY, GENOTYPE, READ_DEPTH, READ_DEPTHS,
};
Expand All @@ -31,7 +32,7 @@ use flate2::write::GzEncoder;
use flate2::Compression;
use noodles_bgzf::Writer as BgzfWriter;
use noodles_vcf::header::{
record::value::map::{info::Type, Info},
record::value::map::{info::Type as InfoType, Info},
Number,
};
use noodles_vcf::reader::Builder as VariantReaderBuilder;
Expand Down Expand Up @@ -128,31 +129,31 @@ fn build_header(header_in: &VcfHeader) -> VcfHeader {
field::Key::from_str("gnomad_exomes_an").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of alleles in gnomAD exomes",
),
);
header_out.infos_mut().insert(
field::Key::from_str("gnomad_exomes_hom").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of hom. alt. carriers in gnomAD exomes",
),
);
header_out.infos_mut().insert(
field::Key::from_str("gnomad_exomes_het").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of het. alt. carriers in gnomAD exomes",
),
);
header_out.infos_mut().insert(
field::Key::from_str("gnomad_exomes_hemi").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of hemi. alt. carriers in gnomAD exomes",
),
);
Expand All @@ -161,31 +162,31 @@ fn build_header(header_in: &VcfHeader) -> VcfHeader {
field::Key::from_str("gnomad_genomes_an").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of alleles in gnomAD genomes",
),
);
header_out.infos_mut().insert(
field::Key::from_str("gnomad_genomes_hom").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of hom. alt. carriers in gnomAD genomes",
),
);
header_out.infos_mut().insert(
field::Key::from_str("gnomad_genomes_het").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of het. alt. carriers in gnomAD genomes",
),
);
header_out.infos_mut().insert(
field::Key::from_str("gnomad_genomes_hemi").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of hemi. alt. carriers in gnomAD genomes",
),
);
Expand All @@ -194,23 +195,23 @@ fn build_header(header_in: &VcfHeader) -> VcfHeader {
field::Key::from_str("helix_an").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of alleles in HelixMtDb",
),
);
header_out.infos_mut().insert(
field::Key::from_str("helix_hom").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of hom. alt. carriers in HelixMtDb",
),
);
header_out.infos_mut().insert(
field::Key::from_str("helix_het").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::Integer,
InfoType::Integer,
"Number of het. alt. carriers in HelixMtDb",
),
);
Expand All @@ -219,7 +220,7 @@ fn build_header(header_in: &VcfHeader) -> VcfHeader {
field::Key::from_str("ANN").unwrap(),
Map::<Info>::new(
Number::Unknown,
Type::String,
InfoType::String,
"Functional annotations: 'Allele | Annotation | Annotation_Impact | Gene_Name | \
Gene_ID | Feature_Type | Feature_ID | Transcript_BioType | Rank | HGVS.c | HGVS.p | \
cDNA.pos / cDNA.length | CDS.pos / CDS.length | AA.pos / AA.length | Distance | \
Expand All @@ -231,21 +232,21 @@ fn build_header(header_in: &VcfHeader) -> VcfHeader {
field::Key::from_str("clinvar_clinsig").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::String,
InfoType::String,
"ClinVar clinical significance (one highest significance per VCV)",
),
);
header_out.infos_mut().insert(
field::Key::from_str("clinvar_rcv").unwrap(),
Map::<Info>::new(
Number::Count(1),
Type::String,
InfoType::String,
"ClinVar RCV accession (corresponds to clinvar_clinsig)",
),
);
header_out.infos_mut().insert(
field::Key::from_str("clinvar_vcv").unwrap(),
Map::<Info>::new(Number::Count(1), Type::String, "ClinVar VCV accession"),
Map::<Info>::new(Number::Count(1), InfoType::String, "ClinVar VCV accession"),
);

header_out
Expand Down Expand Up @@ -1416,9 +1417,15 @@ impl AnnotatedVcfWriter for VarFishSeqvarTsvWriter {
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 header_in = reader.read_header()?;
let mut header_in = reader.read_header()?;
let header_out = build_header(&header_in);

// Work around glnexus issue with RNC.
if let Some(format) = header_in.formats_mut().get_mut("RNC") {
*format.number_mut() = Number::Count(1);
*format.type_mut() = FormatType::String;
}

// Guess genome release from contigs in VCF header.
let genome_release = args.genome_release.map(|gr| match gr {
GenomeRelease::Grch37 => Assembly::Grch37p10, // has chrMT!
Expand Down
Git LFS file not shown
3 changes: 0 additions & 3 deletions tests/data/annotate/seqvars/clair3-glnexus-min.original.vcf

This file was deleted.

4 changes: 2 additions & 2 deletions tests/data/annotate/seqvars/clair3-glnexus-min.vcf
Git LFS file not shown