Filtering specific substitution from a vcf file
1
0
Entering edit mode
5.8 years ago

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 • 1.6k views
ADD COMMENT
0
Entering edit mode

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 REPLY
3
Entering edit mode
5.8 years ago
awk -F '\t' '($0 ~ /^#/ || $4=="A" || $4=="T")' in.vcf > out.vcf
ADD COMMENT
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 2330 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6