Skip to content

Commit

Permalink
fix regression with Number=A from 0.2.7
Browse files Browse the repository at this point in the history
this was found in #71
  • Loading branch information
brentp committed Jun 29, 2017
1 parent b240719 commit 56d1335
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ os:
- osx

go:
- 1.5
- 1.6
- 1.7
- 1.8
- tip

before_install:
- go get github.com/axw/gocov/gocov
Expand Down
8 changes: 5 additions & 3 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,11 @@ func (a *Annotator) Setup(query HeaderUpdater) ([]interfaces.Queryable, error) {
for _, src := range fmap[file] {
num := q.GetHeaderNumber(src.Field)
// must set this to accurately represent multi-allelics.
if num == "1" && src.Op == "self" {
num = "A"
}
/*
if num == "1" && src.Op == "self" {
num = "A"
}
*/
desc := q.GetHeaderDescription(src.Field)
src.UpdateHeader(query, a.Ends, q.GetHeaderType(src.Field), num, desc)
src.NumberA = num == "A"
Expand Down
Binary file added tests/astar/astar.anno.vcf.gz
Binary file not shown.
Binary file added tests/astar/astar.anno.vcf.gz.tbi
Binary file not shown.
11 changes: 11 additions & 0 deletions tests/astar/astar.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[annotation]]
file="tests/astar/astar.anno.vcf.gz"
fields = ["AC_Adj", "AN_Adj", "AC_Hom", "AC_Hemiz", "FILTER"]
ops=["self", "self", "self", "self", "self"]
names=["ExAC_AC", "ExAC_AN", "ExAC_Hom", "ExAC_Hemi", "ExAC_FILTER"]

[[postannotation]]
fields=["ExAC_AC", "ExAC_AN"]
name="ExAC_AF"
op="div2"
type="Float"
49 changes: 49 additions & 0 deletions tests/astar/astar.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
##fileformat=VCFv4.1
##FILTER=<ID=PASS,Description="All filters passed">
##ALT=<ID=NON_REF,Description="Represents any possible alternative allele at this location">
##FILTER=<ID=LowQual,Description="Low quality">
##FILTER=<ID=VQSRTrancheINDEL99.00to99.90,Description="Truth sensitivity tranche level for INDEL model at VQS Lod: -2.7863 <= x < -0.3458">
##FILTER=<ID=VQSRTrancheINDEL99.90to100.00+,Description="Truth sensitivity tranche level for INDEL model at VQS Lod < -39444.7835">
##FILTER=<ID=VQSRTrancheINDEL99.90to100.00,Description="Truth sensitivity tranche level for INDEL model at VQS Lod: -39444.7835 <= x < -2.7863">
##FILTER=<ID=VQSRTrancheSNP99.00to99.90,Description="Truth sensitivity tranche level for SNP model at VQS Lod: -2.1065 <= x < 0.1288">
##FILTER=<ID=VQSRTrancheSNP99.90to100.00+,Description="Truth sensitivity tranche level for SNP model at VQS Lod < -39955.6335">
##FILTER=<ID=VQSRTrancheSNP99.90to100.00,Description="Truth sensitivity tranche level for SNP model at VQS Lod: -39955.6335 <= x < -2.1065">
##FORMAT=<ID=AD,Number=.,Type=Integer,Description="Allelic depths for the ref and alt alleles in the order listed">
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Approximate read depth (reads with MQ=255 or with bad mates are filtered)">
##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=MIN_DP,Number=1,Type=Integer,Description="Minimum DP observed within the GVCF block">
##FORMAT=<ID=PGT,Number=1,Type=String,Description="Physical phasing haplotype information, describing how the alternate alleles are phased in relation to one another">
##FORMAT=<ID=PID,Number=1,Type=String,Description="Physical phasing ID information, where each unique ID within a given sample (but not across samples) connects records within a phasing group">
##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Normalized, Phred-scaled likelihoods for genotypes as defined in the VCF specification">
##FORMAT=<ID=RGQ,Number=1,Type=Integer,Description="Unconditional reference genotype confidence, encoded as a phred quality -10*log10 p(genotype call is wrong)">
##FORMAT=<ID=SB,Number=4,Type=Integer,Description="Per-sample component statistics which comprise the Fisher's Exact Test to detect strand bias.">
##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes, for each ALT allele, in the same order as listed">
##INFO=<ID=AF,Number=A,Type=Float,Description="Allele Frequency, for each ALT allele, in the same order as listed">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
##INFO=<ID=BaseQRankSum,Number=1,Type=Float,Description="Z-score from Wilcoxon rank sum test of Alt Vs. Ref base qualities">
##INFO=<ID=ClippingRankSum,Number=1,Type=Float,Description="Z-score From Wilcoxon rank sum test of Alt vs. Ref number of hard clipped bases">
##INFO=<ID=DB,Number=0,Type=Flag,Description="dbSNP Membership">
##INFO=<ID=DP,Number=1,Type=Integer,Description="Approximate read depth; some reads may have been filtered">
##INFO=<ID=DS,Number=0,Type=Flag,Description="Were any of the samples downsampled?">
##INFO=<ID=END,Number=1,Type=Integer,Description="Stop position of the interval">
##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
##INFO=<ID=HaplotypeScore,Number=1,Type=Float,Description="Consistency of the site with at most two segregating haplotypes">
##INFO=<ID=InbreedingCoeff,Number=1,Type=Float,Description="Inbreeding coefficient as estimated from the genotype likelihoods per-sample when compared against the Hardy-Weinberg expectation">
##INFO=<ID=MLEAC,Number=A,Type=Integer,Description="Maximum likelihood expectation (MLE) for the allele counts (not necessarily the same as the AC), for each ALT allele, in the same order as listed">
##INFO=<ID=MLEAF,Number=A,Type=Float,Description="Maximum likelihood expectation (MLE) for the allele frequency (not necessarily the same as the AF), for each ALT allele, in the same order as listed">
##INFO=<ID=MQ,Number=1,Type=Float,Description="RMS Mapping Quality">
##INFO=<ID=MQRankSum,Number=1,Type=Float,Description="Z-score From Wilcoxon rank sum test of Alt vs. Ref read mapping qualities">
##INFO=<ID=NEGATIVE_TRAIN_SITE,Number=0,Type=Flag,Description="This variant was used to build the negative training set of bad variants">
##INFO=<ID=NOVELAL,Number=.,Type=String,Description="List of samples with novel alleles">
##INFO=<ID=NOVELGT,Number=.,Type=String,Description="List of samples with novel genotypes">
##INFO=<ID=NOVELTY,Number=1,Type=Integer,Description="vcf-contrast novelty score">
##INFO=<ID=POSITIVE_TRAIN_SITE,Number=0,Type=Flag,Description="This variant was used to build the positive training set of good variants">
##INFO=<ID=QD,Number=1,Type=Float,Description="Variant Confidence/Quality by Depth">
##INFO=<ID=ReadPosRankSum,Number=1,Type=Float,Description="Z-score from Wilcoxon rank sum test of Alt vs. Ref read position bias">
##INFO=<ID=SOR,Number=1,Type=Float,Description="Symmetric Odds Ratio of 2x2 contingency table to detect strand bias">
##INFO=<ID=VQSLOD,Number=1,Type=Float,Description="Log odds of being a true variant versus being false under the trained gaussian mixture model">
##INFO=<ID=culprit,Number=1,Type=String,Description="The annotation which was the worst performing in the Gaussian mixture model, likely the reason why the variant was filtered out">
##contig=<ID=chr1,length=249250621,assembly=hg19>
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT 6281
chr1 26608828 . G A,* 2584.23 PASS AC=1,0;AF=0.5,0;AN=2;BaseQRankSum=-0.849;ClippingRankSum=-0.51;DP=35;FS=1.789;MQ=60;MQRankSum=2.36;NOVELAL=6282;NOVELTY=27;QD=28.09;ReadPosRankSum=-0.811;SOR=0.816;VQSLOD=13.7;culprit=QD GT:AD:DP:GQ:PGT:PID:PL 0/1:26,9,0:35:99:1|0:26608761_C_T:297,0,1107,378,1134,1512
9 changes: 9 additions & 0 deletions tests/functional-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ assert_equal 3 $(grep -c ALT_90 $STDOUT_FILE)
assert_equal 3 $(grep -c HET_90 $STDOUT_FILE)
cat $STDERR_FILE
astar() {
vcfanno tests/astar/astar.conf tests/astar/astar.vcf
}
run check_astar astar
assert_exit_code 0
assert_in_stdout "ExAC_AF=0.021771,0"
assert_instdout "ExAC_AN=17546;ExAC_Hom=7,.;"
multiallelics() {
vcfanno tests/multiple-alts/ma.conf tests/multiple-alts/ma-query.vcf
Expand Down
2 changes: 1 addition & 1 deletion vcfanno.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/brentp/xopen"
)

var VERSION = "0.2.7"
var VERSION = "0.2.8-alpha"

func envGet(name string, vdefault int) int {
sval := os.Getenv(name)
Expand Down

0 comments on commit 56d1335

Please sign in to comment.