Question: Filtering specific substitution from a vcf file
0
gravatar for sambioinfo2018
18 months ago by
sambioinfo20180 wrote:

Dear All,

Is there an option for filtering specific substitutions only from VCF file using VCFtools or bcftools? I want to extract lines from vcffile that contain A and T in Ref column.

Thanks in advance!

snp • 487 views
ADD COMMENTlink modified 18 months ago by Pierre Lindenbaum125k • written 18 months ago by sambioinfo20180

I think you mean A or T, in ref column. @OP

bcftools view -i 'REF="A" | REF="T"' example.vcf.gz or bcftools filter -i 'REF=="A"|REF=="T"' example.vcf.gz

bgzip and tabix (index) example vcf for bcftools processing

ADD REPLYlink modified 18 months ago • written 18 months ago by cpad011212k
2
gravatar for Pierre Lindenbaum
18 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum125k wrote:
awk -F '\t' '($0 ~ /^#/ || $4=="A" || $4=="T")' in.vcf > out.vcf
ADD COMMENTlink written 18 months ago by Pierre Lindenbaum125k

Thanks Pierre! I shall try this.. I wrote a python script to do this but then while executing vcfstats, it throws error mentioning no sample columns in VCF file.

ADD REPLYlink written 18 months ago by sambioinfo20180
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: 1173 users visited in the last hour