New Upstream Release - golang-github-brentp-vcfgo

Ready changes

Summary

Merged new upstream version: 0.0~git20221128.759c0d3 (was: 0.0~git20220919.adf3b5d).

Resulting package

Built on 2023-03-21T05:29 (took 5m55s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases golang-github-brentp-vcfgo-dev

Lintian Result

Diff

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6bf32b9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+t.sh
+cov.out
+cover.out
+*.swp
diff --git a/debian/changelog b/debian/changelog
index 5b5c8a3..b1c6d89 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+golang-github-brentp-vcfgo (0.0~git20221128.759c0d3-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot.
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Tue, 21 Mar 2023 05:23:44 -0000
+
 golang-github-brentp-vcfgo (0.0~git20190824.654ed2e-2) unstable; urgency=medium
 
   * Source-only upload for testing migration.
diff --git a/test-no-samples-writer.vcf b/test-no-samples-writer.vcf
new file mode 100644
index 0000000..2018c73
--- /dev/null
+++ b/test-no-samples-writer.vcf
@@ -0,0 +1,135 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##fileDate=20210519
+##source=GenerateSVCandidates 1.6.0
+##reference=file:///tmp/nxf.ny0nAoZ9g0/g1k_v37_decoy.fa
+##contig=<ID=1,length=249250621>
+##contig=<ID=2,length=243199373>
+##contig=<ID=3,length=198022430>
+##contig=<ID=4,length=191154276>
+##contig=<ID=5,length=180915260>
+##contig=<ID=6,length=171115067>
+##contig=<ID=7,length=159138663>
+##contig=<ID=8,length=146364022>
+##contig=<ID=9,length=141213431>
+##contig=<ID=10,length=135534747>
+##contig=<ID=11,length=135006516>
+##contig=<ID=12,length=133851895>
+##contig=<ID=13,length=115169878>
+##contig=<ID=14,length=107349540>
+##contig=<ID=15,length=102531392>
+##contig=<ID=16,length=90354753>
+##contig=<ID=17,length=81195210>
+##contig=<ID=18,length=78077248>
+##contig=<ID=19,length=59128983>
+##contig=<ID=20,length=63025520>
+##contig=<ID=21,length=48129895>
+##contig=<ID=22,length=51304566>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##contig=<ID=MT,length=16569>
+##contig=<ID=GL000207.1,length=4262>
+##contig=<ID=GL000226.1,length=15008>
+##contig=<ID=GL000229.1,length=19913>
+##contig=<ID=GL000231.1,length=27386>
+##contig=<ID=GL000210.1,length=27682>
+##contig=<ID=GL000239.1,length=33824>
+##contig=<ID=GL000235.1,length=34474>
+##contig=<ID=GL000201.1,length=36148>
+##contig=<ID=GL000247.1,length=36422>
+##contig=<ID=GL000245.1,length=36651>
+##contig=<ID=GL000197.1,length=37175>
+##contig=<ID=GL000203.1,length=37498>
+##contig=<ID=GL000246.1,length=38154>
+##contig=<ID=GL000249.1,length=38502>
+##contig=<ID=GL000196.1,length=38914>
+##contig=<ID=GL000248.1,length=39786>
+##contig=<ID=GL000244.1,length=39929>
+##contig=<ID=GL000238.1,length=39939>
+##contig=<ID=GL000202.1,length=40103>
+##contig=<ID=GL000234.1,length=40531>
+##contig=<ID=GL000232.1,length=40652>
+##contig=<ID=GL000206.1,length=41001>
+##contig=<ID=GL000240.1,length=41933>
+##contig=<ID=GL000236.1,length=41934>
+##contig=<ID=GL000241.1,length=42152>
+##contig=<ID=GL000243.1,length=43341>
+##contig=<ID=GL000242.1,length=43523>
+##contig=<ID=GL000230.1,length=43691>
+##contig=<ID=GL000237.1,length=45867>
+##contig=<ID=GL000233.1,length=45941>
+##contig=<ID=GL000204.1,length=81310>
+##contig=<ID=GL000198.1,length=90085>
+##contig=<ID=GL000208.1,length=92689>
+##contig=<ID=GL000191.1,length=106433>
+##contig=<ID=GL000227.1,length=128374>
+##contig=<ID=GL000228.1,length=129120>
+##contig=<ID=GL000214.1,length=137718>
+##contig=<ID=GL000221.1,length=155397>
+##contig=<ID=GL000209.1,length=159169>
+##contig=<ID=GL000218.1,length=161147>
+##contig=<ID=GL000220.1,length=161802>
+##contig=<ID=GL000213.1,length=164239>
+##contig=<ID=GL000211.1,length=166566>
+##contig=<ID=GL000199.1,length=169874>
+##contig=<ID=GL000217.1,length=172149>
+##contig=<ID=GL000216.1,length=172294>
+##contig=<ID=GL000215.1,length=172545>
+##contig=<ID=GL000205.1,length=174588>
+##contig=<ID=GL000219.1,length=179198>
+##contig=<ID=GL000224.1,length=179693>
+##contig=<ID=GL000223.1,length=180455>
+##contig=<ID=GL000195.1,length=182896>
+##contig=<ID=GL000212.1,length=186858>
+##contig=<ID=GL000222.1,length=186861>
+##contig=<ID=GL000200.1,length=187035>
+##contig=<ID=GL000193.1,length=189789>
+##contig=<ID=GL000194.1,length=191469>
+##contig=<ID=GL000225.1,length=211173>
+##contig=<ID=GL000192.1,length=547496>
+##contig=<ID=NC_007605,length=171823>
+##contig=<ID=hs37d5,length=35477943>
+##contig=<ID=phix,length=5386>
+##INFO=<ID=IMPRECISE,Number=0,Type=Flag,Description="Imprecise structural variation">
+##INFO=<ID=SVTYPE,Number=1,Type=String,Description="Type of structural variant">
+##INFO=<ID=SVLEN,Number=.,Type=Integer,Description="Difference in length between REF and ALT alleles">
+##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant described in this record">
+##INFO=<ID=CIPOS,Number=2,Type=Integer,Description="Confidence interval around POS">
+##INFO=<ID=CIEND,Number=2,Type=Integer,Description="Confidence interval around END">
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="CIGAR alignment for each alternate indel allele">
+##INFO=<ID=MATEID,Number=.,Type=String,Description="ID of mate breakend">
+##INFO=<ID=EVENT,Number=1,Type=String,Description="ID of event associated to breakend">
+##INFO=<ID=HOMLEN,Number=.,Type=Integer,Description="Length of base pair identical homology at event breakpoints">
+##INFO=<ID=HOMSEQ,Number=.,Type=String,Description="Sequence of base pair identical homology at event breakpoints">
+##INFO=<ID=SVINSLEN,Number=.,Type=Integer,Description="Length of insertion">
+##INFO=<ID=SVINSSEQ,Number=.,Type=String,Description="Sequence of insertion">
+##INFO=<ID=LEFT_SVINSSEQ,Number=.,Type=String,Description="Known left side of insertion for an insertion of unknown length">
+##INFO=<ID=RIGHT_SVINSSEQ,Number=.,Type=String,Description="Known right side of insertion for an insertion of unknown length">
+##INFO=<ID=BND_DEPTH,Number=1,Type=Integer,Description="Read depth at local translocation breakend">
+##INFO=<ID=MATE_BND_DEPTH,Number=1,Type=Integer,Description="Read depth at remote translocation mate breakend">
+##INFO=<ID=JUNCTION_QUAL,Number=1,Type=Integer,Description="If the SV junction is part of an EVENT (ie. a multi-adjacency variant), this field provides the QUAL value for the adjacency in question only">
+##INFO=<ID=INV3,Number=0,Type=Flag,Description="Inversion breakends open 3' of reported location">
+##INFO=<ID=INV5,Number=0,Type=Flag,Description="Inversion breakends open 5' of reported location">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=FT,Number=1,Type=String,Description="Sample filter, 'PASS' indicates that all filters have passed for this sample">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Normalized, Phred-scaled likelihoods for genotypes as defined in the VCF specification">
+##FORMAT=<ID=PR,Number=.,Type=Integer,Description="Spanning paired-read support for the ref and alt alleles in the order listed">
+##FORMAT=<ID=SR,Number=.,Type=Integer,Description="Split reads for the ref and alt alleles in the order listed, for reads where P(allele|read)>0.999">
+##FILTER=<ID=Ploidy,Description="For DEL & DUP variants, the genotypes of overlapping variants (with similar size) are inconsistent with diploid expectation">
+##FILTER=<ID=MaxDepth,Description="Depth is greater than 3x the median chromosome depth near one or both variant breakends">
+##FILTER=<ID=MaxMQ0Frac,Description="For a small variant (<1000 bases), the fraction of reads in all samples with MAPQ0 around either breakend exceeds 0.4">
+##FILTER=<ID=NoPairSupport,Description="For variants significantly larger than the paired read fragment size, no paired reads support the alternate allele in any sample.">
+##FILTER=<ID=MinQUAL,Description="QUAL score is less than 10">
+##FILTER=<ID=SampleFT,Description="No sample passes all the sample-level filters (at the field FORMAT/FT)">
+##FILTER=<ID=MinGQ,Description="GQ score is less than 10 (filter applied at sample level)">
+##FILTER=<ID=HomRef,Description="homozygous reference call (filter applied at sample level)">
+##ALT=<ID=INV,Description="Inversion">
+##ALT=<ID=DEL,Description="Deletion">
+##ALT=<ID=INS,Description="Insertion">
+##ALT=<ID=DUP:TANDEM,Description="Tandem Duplication">
+##cmdline=/opt/manta-1.6.0.centos6_x86_64/bin/configManta.py --bam hg002.cram --referenceFasta g1k_v37_decoy.fa --runDir . --callRegions cr.bed.gz
+##bcftools_viewVersion=1.9+htslib-1.9
+##bcftools_viewCommand=view -O z -o HG002.diploidSV.vcf.gz; Date=Wed May 19 22:54:52 2021
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
+chr19	605528	MantaDUP:TANDEM:1:122044:122045:1:0:0	C	<DUP:TANDEM>	999	PASS	END=608623;SVTYPE=DUP;SVLEN=3095
diff --git a/vcf_test.go b/vcf_test.go
index bfc5198..96f403d 100644
--- a/vcf_test.go
+++ b/vcf_test.go
@@ -4,6 +4,9 @@ import (
 	"os"
 	"testing"
 
+	"bytes"
+	"strings"
+
 	. "gopkg.in/check.v1"
 )
 
@@ -138,3 +141,42 @@ func (s *VCFSuite) TestIssue5(c *C) {
 	c.Assert(samples[2].GT, DeepEquals, []int{2, 2})
 
 }
+
+func (s *VCFSuite) TestWriterNoSamples(c *C) {
+
+	fname := "test-no-samples-writer.vcf"
+	rdr, err := os.Open(fname)
+	c.Assert(err, IsNil)
+	vcf, err := NewReader(rdr, false)
+	c.Assert(err, IsNil)
+
+	var wtr bytes.Buffer
+	_, err = NewWriter(&wtr, vcf.Header)
+	c.Assert(err, IsNil)
+
+	str := wtr.String()
+
+	c.Assert(strings.Contains(str, "\tFORMAT"), Equals, false)
+
+}
+
+func (s *VCFSuite) TestWriterWithSamples(c *C) {
+
+	fname := "test-h.vcf"
+	rdr, err := os.Open(fname)
+	c.Assert(err, IsNil)
+	vcf, err := NewReader(rdr, false)
+	c.Assert(err, IsNil)
+
+	var wtr bytes.Buffer
+	_, err = NewWriter(&wtr, vcf.Header)
+	c.Assert(err, IsNil)
+
+	str := wtr.String()
+
+	c.Assert(strings.Contains(str, "\tFORMAT"), Equals, true)
+
+	lines := strings.Split(strings.TrimSpace(str), "\n")
+	c.Assert(strings.HasPrefix(lines[len(lines)-1], "#CHROM"), Equals, true)
+
+}
diff --git a/writer.go b/writer.go
index c058088..1cfdea7 100644
--- a/writer.go
+++ b/writer.go
@@ -77,10 +77,10 @@ func NewWriter(w io.Writer, h *Header) (*Writer, error) {
 		fmt.Fprintf(w, "%s\n", line)
 	}
 
-	fmt.Fprint(w, "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT")
+	fmt.Fprint(w, "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO")
 	var s string
 	if len(h.SampleNames) > 0 {
-		s = "\t" + strings.Join(h.SampleNames, "\t")
+		s = "\tFORMAT\t" + strings.Join(h.SampleNames, "\t")
 	}
 
 	fmt.Fprint(w, s+"\n")

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/share/gocode/src/github.com/brentp/vcfgo/test-no-samples-writer.vcf

No differences were encountered in the control files

More details

Full run details