Skip to content

Commit

Permalink
🔧 description testing updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dmiller15 authored and brentp committed Feb 2, 2024
1 parent 6b659aa commit 95bd420
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/commands/encoder_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pub fn encoder_main(vpaths: Vec<&str>, opath: &str, jpath: &str) {
TagLength::Genotypes => f.number = "G".to_string(),
TagLength::Variable => f.number = ".".to_string(),
};
if f.description == fields::default_description_string() {
if f.field != "FILTER" && f.description == fields::default_description_string() {
f.description = hdr_info_id2description(header.header_records(), &f.field, &f.description);
};
}
Expand Down
20 changes: 11 additions & 9 deletions tests/big.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ for mod in 2 3 4 5; do


if [[ "mod" -ne "1" ]]; then
# now annotate with both and all values shouldl be annotated.
echo "two echtvars check"
$echtvar encode test.echtvar1 test1.hjson generated-subset1.vcf
$echtvar anno generated-all.vcf -e test.echtvar0 -e test.echtvar1 anno.vcf.gz
python3 check.py anno.vcf.gz 1
# check default Description used
python3 check-string-for-issue33.py anno.vcf.gz aval1 1 "added by echtvar from test.echtvar1"
# check value . is left alone
python3 check-string-for-issue33.py anno.vcf.gz external_str . "added by echtvar from test.echtvar1"
# now annotate with both and all values should be annotated.
echo "two echtvars check"
$echtvar encode test.echtvar1 test1.hjson generated-subset1.vcf
$echtvar anno generated-all.vcf -e test.echtvar0 -e test.echtvar1 anno.vcf.gz
python3 check.py anno.vcf.gz 1
# check that the default Description is used when no JSON value or encode Description
python3 check-string-for-issue33.py anno.vcf.gz no_description 1 "added by echtvar from test.echtvar1"
# check that the encode Description is used when no JSON value
python3 check-string-for-issue33.py anno.vcf.gz aval1 1 "added by echtvar random value"
# check value . is left alone
python3 check-string-for-issue33.py anno.vcf.gz external_str . "added by echtvar string value"
fi


Expand Down
1 change: 1 addition & 0 deletions tests/make-vcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
##INFO=<ID=AC,Number=A,Type=Integer,Description="Alternate allele count">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles">
##INFO=<ID=val%s,Number=1,Type=Integer,Description="random value">
##INFO=<ID=nodesc,Number=1,Type=Integer>
##INFO=<ID=nvar,Number=1,Type=Integer,Description="variant index">
##INFO=<ID=str,Number=.,Type=String,Description="string value">
##INFO=<ID=AF,Number=A,Type=Float,Description="Alternate allele frequency">
Expand Down
3 changes: 2 additions & 1 deletion tests/test1.hjson
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
{"field": "val1", "alias": "aval1"},
{"field": "str", "alias": "external_str"}
{"field": "str", "alias": "external_str"},
{"field": "nodesc", "alias": "no_description"}
]

0 comments on commit 95bd420

Please sign in to comment.