<p>I have several datasets in vcf format(about 1GB per file) and I want to extract snp info in each samples. I usually use python so I tried pyvcf, but it works slow in such large datasets. Are there any better ways to do that, especially in python? Thanks in advance</p>

A trick is to compress the VCF file with bgzip, and index it with tabix. Both these tools are downloadable from the <a href="http://sourceforge.net/projects/samtools/files/tabix/">tabix</a> home page.

See also <a href="http://vcftools.sourceforge.net/perl_module.html">this page</a> for more documentation. Follow the instructions there:

    bgzip my_file.vcf
    tabix -p vcf my_file.vcf.gz

I am not sure if pyvcf supports compressed and indexed files. According to the <a href="http://pyvcf.readthedocs.org/en/latest/_modules/vcf/parser.html">source code</a>, it seems so.

EDIT: yes, it seems that pyvcf supports compressed and indexed VCF files. See the example in <a href="http://pyvcf.readthedocs.org/en/latest/INTRO.html">pyvcf documentation</a>:

    >>> vcf_reader = vcf.Reader(filename='vcf/test/tb.vcf.gz')
    >>> # fetch all records on chromosome 20 from base 1110696 through 1230237
    >>> for record in vcf_reader.fetch('20', 1110695, 1230237):  
    ...     print record
    Record(CHROM=20, POS=1110696, REF=A, ALT=[G, T])
    Record(CHROM=20, POS=1230237, REF=T, ALT=[None])