Skip to content

Commit

Permalink
fix: actually produce one tsv record per gene+annotations (#413)
Browse files Browse the repository at this point in the history
* fix: actually produce one tsv record per gene+annotations

* added testcases for BRCA2 ZAR1L annotation

* updated testing db + bootstrap.sh to support the brca2 zar1l testcase
  • Loading branch information
tedil committed Mar 28, 2024
1 parent b735a68 commit 1ccabbb
Show file tree
Hide file tree
Showing 24 changed files with 86 additions and 42 deletions.
44 changes: 41 additions & 3 deletions src/annotate/seqvars/mod.rs
Expand Up @@ -1105,11 +1105,10 @@ impl VarFishSeqvarTsvWriter {
written_refseq = true;
}
}
writeln!(self.inner, "{}", tsv_record.to_tsv().join("\t"))
.map_err(|e| anyhow::anyhow!("Error writing VarFish TSV record: {}", e))?;
}

writeln!(self.inner, "{}", tsv_record.to_tsv().join("\t"))
.map_err(|e| anyhow::anyhow!("Error writing VarFish TSV record: {}", e))?;

Ok(())
} else {
// No annotations, write out without expanding `INFO/ANN` fields.
Expand Down Expand Up @@ -1866,4 +1865,43 @@ mod test {

Ok(())
}

/// Test corresponding to https://github.com/varfish-org/mehari/issues/409
///
/// Note that we currently re-use the GRCh37 databases in
/// `tests/data/annotate/db/grch37` for GRCh38 via symlink. As the below
/// only is a smoke test, this is sufficient. However, for other tests,
/// this will pose a problem.
#[test]
fn test_brca2_zar1l_affected() -> Result<(), anyhow::Error> {
let temp = TempDir::default();
let path_out = temp.join("output.tsv");

let args_common = crate::common::Args {
verbose: Verbosity::new(0, 1),
};
let args = Args {
genome_release: None,
report_all_transcripts: true,
transcript_source: TranscriptSource::Both,
transcript_picking: false,
path_db: String::from("tests/data/annotate/db"),
path_input_vcf: String::from("tests/data/annotate/seqvars/brca2_zar1l/brca2_zar1l.vcf"),
output: PathOutput {
path_output_vcf: None,
path_output_tsv: Some(path_out.into_os_string().into_string().unwrap()),
},
max_var_count: None,
path_input_ped: String::from("tests/data/annotate/seqvars/brca2_zar1l/brca2_zar1l.ped"),
};

run(&args_common, &args)?;

let actual = std::fs::read_to_string(args.output.path_output_tsv.unwrap())?;
let expected =
std::fs::read_to_string("tests/data/annotate/seqvars/brca2_zar1l/brca2_zar1l.tsv")?;
assert_eq!(&expected, &actual);

Ok(())
}
}
4 changes: 2 additions & 2 deletions tests/data/annotate/db/bootstrap.sh
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch37/seqvars/clinvar/000016.sst
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch37/seqvars/clinvar/000018.sst
Git LFS file not shown
3 changes: 0 additions & 3 deletions tests/data/annotate/db/grch37/seqvars/clinvar/000020.sst

This file was deleted.

2 changes: 1 addition & 1 deletion tests/data/annotate/db/grch37/seqvars/clinvar/IDENTITY
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch37/seqvars/clinvar/LOG
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch37/seqvars/clinvar/MANIFEST-000005
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch37/seqvars/clinvar/OPTIONS-000011
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch37/seqvars/clinvar/OPTIONS-000013
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch37/txs.bin.zst
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch38/seqvars/clinvar/000016.sst
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch38/seqvars/clinvar/000018.sst
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch38/seqvars/clinvar/000020.sst
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/data/annotate/db/grch38/seqvars/clinvar/IDENTITY
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch38/seqvars/clinvar/LOG
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch38/seqvars/clinvar/MANIFEST-000005
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch38/seqvars/clinvar/OPTIONS-000011
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch38/seqvars/clinvar/OPTIONS-000013
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/grch38/txs.bin.zst
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/data/annotate/db/hgnc.tsv
Git LFS file not shown
3 changes: 3 additions & 0 deletions tests/data/annotate/seqvars/brca2_zar1l/brca2_zar1l.ped
Git LFS file not shown
3 changes: 3 additions & 0 deletions tests/data/annotate/seqvars/brca2_zar1l/brca2_zar1l.tsv
Git LFS file not shown
3 changes: 3 additions & 0 deletions tests/data/annotate/seqvars/brca2_zar1l/brca2_zar1l.vcf
Git LFS file not shown

0 comments on commit 1ccabbb

Please sign in to comment.