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

Switched order of Number and Type keys in VCF END2 meta info line causes problems in htsjdk #66

Closed
cwhelan opened this issue Oct 21, 2020 · 2 comments · Fixed by #98
Closed

Comments

@cwhelan
Copy link
Member

cwhelan commented Oct 21, 2020

Module0506's postCPX_cleanup.py writes the END2 meta info line as:

##INFO=<ID=END2,Type=Integer,Number=1,Description="Position of breakpoint on CHR2">

The switch from the usual ordering of Number,Type causes htsjdk to throw an error when trying to parse the file:

htsjdk.tribble.TribbleException$InvalidHeader: Your input file has a malformed header: Tag Type in wrong order (was #2, expected #3) in line <ID=END2,Type=Integer,Number=1,Description="Position of breakpoint on CHR2">
        at htsjdk.variant.vcf.VCF4Parser.parseLine(VCFHeaderLineTranslator.java:172)
        at htsjdk.variant.vcf.VCFHeaderLineTranslator.parseLine(VCFHeaderLineTranslator.java:58)
        at htsjdk.variant.vcf.VCFCompoundHeaderLine.<init>(VCFCompoundHeaderLine.java:215)
        at htsjdk.variant.vcf.VCFInfoHeaderLine.<init>(VCFInfoHeaderLine.java:56)
        at htsjdk.variant.vcf.AbstractVCFCodec.parseHeaderFromLines(AbstractVCFCodec.java:192)
        at htsjdk.variant.vcf.VCFCodec.readActualHeader(VCFCodec.java:111)
        at htsjdk.tribble.AsciiFeatureCodec.readHeader(AsciiFeatureCodec.java:79)
        at htsjdk.tribble.AsciiFeatureCodec.readHeader(AsciiFeatureCodec.java:37)
        at htsjdk.tribble.TribbleIndexedFeatureReader.readHeader(TribbleIndexedFeatureReader.java:261)
        ... 16 more

@nh13
Copy link

nh13 commented May 6, 2022

@cwhelan just hit this issue, I am not 100% certain if this is a bug in htsjdk or a bug here.

See: samtools/hts-specs#642

@cwhelan
Copy link
Member Author

cwhelan commented May 9, 2022

Yes, we changed the order of the tags a while back on our end but it looks like you're using a VCF generated before that.

Personally I don't think the order of the keys should matter in a list with key-value pairs, and I think I asked about changing this in htsjdk briefly when it cropped up, but the spec was just ambiguous enough, and htsjdk had old explicit logic and test cases trying to enforce this rule, that there didn't seem to be enough clarity to push through a change to htsjdk. Happy to put in a plug on the hts-spec issue in favor of explicitly dropping the order restriction.

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

Successfully merging a pull request may close this issue.

2 participants