Question: VCF filtering by depth
1
gravatar for perezalquicira
3.5 years ago by
perezalquicira10 wrote:

Hi, I am trying to filtering a vcf file by --minDP however the log file indicates that it is not filtering out any SNP, any clue about this problem? I tried different values for DP but is not working any of them (I do have DP information in my vcf file)

/data/storage/software/vcftools/bin/vcftools --vcf /home/jperez/croc/res_cornell/vcf_croc_addinCONTIG.vcf --recode-INFO-all --minDP 100 —-out minDP_100.vcf

Thanks

filtering by depth • 3.3k views
ADD COMMENTlink modified 3.5 years ago • written 3.5 years ago by perezalquicira10

you should try --min-meanDP instead of --minDP if you didn't solve that problem. I'm also wondering why vcftools write some argument making user a little bit confusing.

Like --min-meanDP & --minDP or --minQ and --minGQ

ADD REPLYlink written 12 months ago by mike229lin10
2
gravatar for agata88
3.5 years ago by
agata88790
Poland
agata88790 wrote:
I have a script that can do what you need. 

#! python

import sys
import os
import vcf

vcf_reader = vcf.Reader(open("file.vcf", 'r'))
vcf_writer = vcf.Writer(open('out.vcf', 'w'), vcf_reader)
for record in vcf_reader:
    if record.INFO['DP']>100:
        vcf_writer.write_record(record)

Hope it helps,
Best,
Agata
ADD COMMENTlink modified 3.5 years ago • written 3.5 years ago by agata88790
0
gravatar for igor
3.5 years ago by
igor8.6k
United States
igor8.6k wrote:

VCFtools allows filtering. See the "--minDP" argument.

https://vcftools.github.io/man_latest.html

ADD COMMENTlink written 3.5 years ago by igor8.6k
0
gravatar for perezalquicira
3.5 years ago by
perezalquicira10 wrote:

Thanks Agata, I have mac and try to run the script and I got this message:

Traceback (most recent call last): File "DP.py", line 3, in <module> import vcf ImportError: No module named vcf

ADD COMMENTlink written 3.5 years ago by perezalquicira10

You need to install PyVCF module for example from here https://pypi.python.org/pypi/PyVCF Make sure that it is compatible with your python version! Best, Agata

ADD REPLYlink written 3.5 years ago by agata88790
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: 1675 users visited in the last hour