Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of header lines messed up #45

Closed
freeseek opened this issue Jun 8, 2012 · 3 comments
Closed

Order of header lines messed up #45

freeseek opened this issue Jun 8, 2012 · 3 comments

Comments

@freeseek
Copy link

freeseek commented Jun 8, 2012

If I open a VCF file and I immediately write it back to a different file with code like this:
vcf_reader = vcf.Reader(infile)
vcf_writer = vcf.Writer(outfile,vcf_reader)
I get that the order of things in the headers is now messed up. If at first I am more like:

fileformat=VCFv4.1

FORMAT=...

INFO=...

contig=...

reference=...

In the output file things are more like:

contig=...

reference=...

contig=...

fileformat=VCFv4.1

contig=...

INFO=...

FORMAT=...

Is this even allowed by the VCF format? Is there a way to control this behavior?

@martijnvermaat
Copy link
Collaborator

This is not allowed by the VCF format (the fileformat header line must be first). Looking at the code, the lines are stored as key/value pairs in a dictionary and retrieved from it in no particular order.

@lennax
Copy link

lennax commented Jun 9, 2012

OrderedDict (added in 2.7 I believe)

@jamescasbon
Copy link
Owner

Fixed in HEAD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants