contig metadata is not output when using vcf.Writer #118

Closed
AndrewUzilov opened this Issue Sep 19, 2013 · 2 comments

Comments

Projects
None yet
2 participants

The ##contig header lines disappear when loading/writing a VCF file. To reproduce:

import vcf
r = vcf.Reader (open ('PyVCF/vcf/test/gatk.vcf', 'r'))
w = vcf.Writer (open ('out.vcf', 'w'), r)
w.close()

Note that out.vcf has no ##contig lines, but they were present in PyVCF/vcf/test/gatk.vcf

This actually happens with the sample filter script, too:

python2.7 scripts/vcf_filter.py vcf/test/gatk.vcf sq > ~/tmp/out.vcf
diff vcf/test/gatk.vcf ~/tmp/out.vcf | less

Notice that all the ##contig header lines are in the old file, but not the new file.

This is odd... contigs are stored in the Reader obj, but aren't written out? Everything else in the header is written out more-or-less verbatim.

Collaborator

martijnvermaat commented Sep 19, 2013

This is another regression introduced by #105. I'll add a test case and fix it.

Collaborator

martijnvermaat commented Sep 19, 2013

If fixed the regression in #119.

Note however that only the ID and length are considered by the Reader and as such any additional information (e.g. assembly=hg19) will be lost. Please open a separate issue for that if it is a problem for you.

Thanks for your report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment