This repository has been archived by the owner on Feb 9, 2021. It is now read-only.
forked from brentp/vcfgo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregression_test.go
65 lines (54 loc) · 3.61 KB
/
regression_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package vcfgo_test
import (
"fmt"
"io"
"strings"
"github.com/mendelics/vcfgo"
. "gopkg.in/check.v1"
)
var regr1 = `##fileformat=VCFv4.1
##INFO=<ID=AC,Number=A,Type=Integer,Description="Total number of alternate alleles in called genotypes">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
##INFO=<ID=AF,Number=A,Type=Float,Description="Estimated allele frequency in the range (0,1]">
##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
##INFO=<ID=PAO,Number=A,Type=Float,Description="Alternate allele observations, with partial observations recorded fractionally">
##INFO=<ID=SAF,Number=A,Type=Integer,Description="Number of alternate observations on the forward strand">
##INFO=<ID=SAP,Number=A,Type=Float,Description="Strand balance probability for the alternate allele: Phred-scaled upper-bounds estimate of the probability of observing the deviation between SAF and SAR given E(SAF/SAR) ~ 0.5, derived using Hoeffding's inequality">
##INFO=<ID=AB,Number=A,Type=Float,Description="Allele balance at heterozygous sites: a number between 0 and 1 representing the ratio of reads showing the reference allele to all reads, considering only reads from individuals called as heterozygous">
##INFO=<ID=ABP,Number=A,Type=Float,Description="Allele balance probability at heterozygous sites: Phred-scaled upper-bounds estimate of the probability of observing the deviation between ABR and ABA given E(ABR/ABA) ~ 0.5, derived using Hoeffding's inequality">
##INFO=<ID=XX,Number=2,Type=Float,Description="test mult vals">
##INFO=<ID=TYPE,Number=A,Type=String,Description="The type of allele, either snp, mnp, ins, del, or complex.">
##INFO=<ID=CIGAR,Number=A,Type=String,Description="The extended CIGAR representation of each alternate allele, with the exception that '=' is replaced by 'M' to ease VCF parsing. Note that INDEL alleles do not have the first matched base (which is provided by default, per the spec) referred to by the CIGAR.">
##INFO=<ID=MEANALT,Number=A,Type=Float,Description="Mean number of unique non-reference allele observations per sample with the corresponding alternate alleles.">
##FORMAT=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observation count">
##INFO=<ID=CSQ,Number=.,Type=String,Description="Consequence type as predicted by VEP. Format: Consequence|Codons|Amino_acids|Gene|SYMBOL|Feature|EXON|PolyPhen|SIFT|Protein_position|BIOTYPE">
##INFO=<ID=OLD_VARIANT,Number=1,Type=String,Description="Original chr:pos:ref:alt encoding">
#CHROM POS ID REF ALT QUAL FILTER INFO
1 98683 . G A 610.487 . AB=0.282443;ABP=56.8661;AC=11;AF=0.34375;AN=32;AO=45;CIGAR=1X;TYPE=snp;XX=0.44,0.88
1 98685 . G A 610.487 . AB=0;ABP=0`
type RegressionSuite struct {
reader io.Reader
vcfStr string
}
var _ = Suite(&RegressionSuite{vcfStr: regr1})
func (s *RegressionSuite) SetUpTest(c *C) {
s.reader = strings.NewReader(s.vcfStr)
}
func (s *RegressionSuite) TestRegr1(c *C) {
rdr, err := vcfgo.NewReader(s.reader, false)
c.Assert(err, IsNil)
v := rdr.Read() //.(*vcfgo.Variant)
snp, err := v.Info().Get("TYPE")
c.Assert(err, IsNil)
c.Assert(snp, DeepEquals, []string{"snp"})
str := fmt.Sprintf("%s", v)
c.Assert(str, Equals, "1\t98683\t.\tG\tA\t610.5\t.\tAB=0.282443;ABP=56.8661;AC=11;AF=0.34375;AN=32;AO=45;CIGAR=1X;TYPE=snp;XX=0.44,0.88")
}
func (s *RegressionSuite) TestRegr2(c *C) {
rdr, err := vcfgo.NewReader(s.reader, false)
c.Assert(err, IsNil)
v := rdr.Read() //.(*vcfgo.Variant)
v = rdr.Read() //.(*vcfgo.Variant)
str := fmt.Sprintf("%s", v)
c.Assert(str, Equals, "1\t98685\t.\tG\tA\t610.5\t.\tAB=0;ABP=0")
}