示例#1
0
func (s *SampleSuite) TestNoHeader() {
	vcfLine := `1	847491	rs28407778	GTTTA	G....	745.77	PASS	AC=1;AF=0.500;AN=2;BaseQRankSum=0.842;ClippingRankSum=0.147;DB;DP=41;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=60.00;MQ0=0;MQRankSum=-1.109;QD=18.19;ReadPosRankSum=0.334;VQSLOD=2.70;culprit=FS;set=variant	GT:AD:DP:GQ:PL	0/1:16,25:41:99:774,0,434`
	ioreader := strings.NewReader(vcfLine)
	sampleIDs, err := vcf.SampleIDs(ioreader)

	assert.Error(s.T(), err, "VCF without header should return error")
	assert.Nil(s.T(), sampleIDs, "No slice of ids is expected on a vcf without header")
}
示例#2
0
func (s *SampleSuite) TestValidHeaderNoSample() {
	vcfLine := `#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT
1	847491	rs28407778	GTTTA	G....	745.77	PASS	AC=1;AF=0.500;AN=2;BaseQRankSum=0.842;ClippingRankSum=0.147;DB;DP=41;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=60.00;MQ0=0;MQRankSum=-1.109;QD=18.19;ReadPosRankSum=0.334;VQSLOD=2.70;culprit=FS;set=variant	GT:AD:DP:GQ:PL	0/1:16,25:41:99:774,0,434`
	ioreader := strings.NewReader(vcfLine)
	sampleIDs, err := vcf.SampleIDs(ioreader)

	assert.NoError(s.T(), err, "VCF with valid header should not return error")
	assert.Nil(s.T(), sampleIDs, "No slice of ids should be returned on a vcf with a valid header that doesn't contain any sample")
}
示例#3
0
func (s *SampleSuite) TestOneSample() {
	vcfLine := `#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	185423
1	847491	rs28407778	GTTTA	G....	745.77	PASS	AC=1;AF=0.500;AN=2;BaseQRankSum=0.842;ClippingRankSum=0.147;DB;DP=41;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=60.00;MQ0=0;MQRankSum=-1.109;QD=18.19;ReadPosRankSum=0.334;VQSLOD=2.70;culprit=FS;set=variant	GT:AD:DP:GQ:PL	0/1:16,25:41:99:774,0,434`
	ioreader := strings.NewReader(vcfLine)
	sampleIDs, err := vcf.SampleIDs(ioreader)

	assert.NoError(s.T(), err, "VCF with valid header should not return error")
	assert.NotNil(s.T(), sampleIDs, "A slice of ids should be returned on a vcf with a valid header")
	assert.Exactly(s.T(), len(sampleIDs), 1, "Slice of ids should have only one element")
	assert.Equal(s.T(), sampleIDs[0], "185423")
}