Question: Recommendations For Python Vcf Parser/Writer?
10
gravatar for Reece
7.1 years ago by
Reece250
United States
Reece250 wrote:

I'm looking for a VCF 4.1 parser and writer. I'm aware of these:

Do you know of other options or have recommendations to share?

vcf python variation variant • 11k views
ADD COMMENTlink written 7.1 years ago by Reece250
13
gravatar for brentp
7.1 years ago by
brentp22k
Salt Lake City, UT
brentp22k wrote:

I've looked at the ones you mention and any others I could find. This one seems to be the most complete and easiest to use: https://github.com/jdoughertyii/PyVCF

usage is like:

for rec in VCFReader(open('some.vcf')):
    print rec.CHROM, rec.POS, rec.filter, rec.info["AF"]

though, it does not have a writer class.

EDIT:

This, has become the official fork and it has a writer class.

ADD COMMENTlink modified 7.1 years ago • written 7.1 years ago by brentp22k
1

I am using that library as well (with a couple of minor mods) for another project. Works okay for me.

ADD REPLYlink written 7.1 years ago by Aaronquinlan10k
1

The idea for the UPPER was to distinguish native (upper) fields from derived (lower) attributes/methods. For better or worse...

ADD REPLYlink written 7.0 years ago by Aaronquinlan10k

thanks. any idea why UPPERCASE field names?

ADD REPLYlink written 7.1 years ago by Haibao Tang3.0k

Not sure other than that's how they appear in the VCF filter. You could file a bug at https://github.com/jamescasbon/PyVCF

ADD REPLYlink written 7.1 years ago by brentp22k

Pyvcf is too slow ... Is there anything else in python using C++ as backend ?

ADD REPLYlink written 2.6 years ago by sacha1.6k

CyVCF2 https://github.com/brentp/cyvcf2

ADD REPLYlink written 13 months ago by Eli Korvigo150
2
gravatar for Erik Garrison
7.0 years ago by
Erik Garrison2.1k
Somerville, MA
Erik Garrison2.1k wrote:

For C++, I've written vcflib. It has utilities for a number of functions, such as haplotype-based file comparisons (for accurate indel comparisons), filtering, and statistical summarization. It can operate on uncompressed or compressed and tabix indexed VCF files. Mostly, I've used it as a reader/writer class for other projects.

ADD COMMENTlink written 7.0 years ago by Erik Garrison2.1k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2491 users visited in the last hour