Question: Filtering specific substitution from a vcf file
0
gravatar for sambioinfo2018
9 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 • 254 views
ADD COMMENTlink modified 9 months ago by Pierre Lindenbaum119k • written 9 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 9 months ago • written 9 months ago by cpad011211k
2
gravatar for Pierre Lindenbaum
9 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum119k wrote:
awk -F '\t' '($0 ~ /^#/ || $4=="A" || $4=="T")' in.vcf > out.vcf
ADD COMMENTlink written 9 months ago by Pierre Lindenbaum119k

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 9 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: 849 users visited in the last hour