filter unique variants from multiple VCF files
1
0
Entering edit mode
5.6 years ago

Hello

I have multiple normal and benign VCF files. I want to filter unique variants between normal and benign. How can i perform the filtering?

Thanks in advance.

SNP next-gen vcf • 3.9k views
ADD COMMENT
0
Entering edit mode

I want to filter unique variants between normal and benign

So, you want to find variants that are called in at least 1 benign sample that are not called in any normal sample (and vice-versa)?

ADD REPLY
0
Entering edit mode

Yes, filter unique variants that are called in at least one benign sample that are not called in any normal sample and vice versa.

ADD REPLY
0
Entering edit mode
5.6 years ago

Before starting you have to merge all your vcf files into one, with e.g. bcftools merge.

After that, you can use bcftools view to find your variants of interest. Create a file with the sample names for your "normal" and one for your "benign" (one sample name per line). Than try this:

bcftools view -i '(COUNT(GT[@normal.txt] = "alt")> 0 && COUNT(GT[@benign.txt] = "alt") = 0) || (COUNT(GT[@normal.txt] = "alt") = 0 && COUNT(GT[@benign.txt] = "alt") > 0)' merged.vcf.gz

(Couldn't test it for now)

Make sure you are using a current version of bcftools (v1.9).

fin swimmer

ADD COMMENT
0
Entering edit mode

Hello

While using bcftools merge, i get error "Not ready for type [0]: SNP at 12783".

ADD REPLY
0
Entering edit mode

Hello again,

could you please show the complete header (the lines starting with a #) and the first few variant lines of your vcf file?

fin swimmer

ADD REPLY
0
Entering edit mode

sorry! i cannot share the data.

Thanks

ADD REPLY
0
Entering edit mode

Without looking at your data it is quite hard to help. Maybe this helpful for you: Is there a way to Scan and Correct bad vcf INFO values?

ADD REPLY
0
Entering edit mode

I understand that, but i cannot share the data. I already looked into the issue and I don't find any AS_MQ error in the VCF file. I also checked SNP as the error was showing as "Not ready for type [0]: SNP at 12783".

##INFO=<ID=SNP,Number=A,Type=Flag,Description="Variant is a SNP">
ADD REPLY
0
Entering edit mode

I have just encountered this same error message.

This problem is elaborated here: https://github.com/samtools/bcftools/issues/1685

You need to identify tags like this:

bcftools view -h "${vcf}" | grep -e "Number=A,Type=Flag"

Then, either follow the advice in the GitHub issue and recode them as Number=0,Type=Flag, or remove these if they are not needed:

bcftools annotate -x INFO/SNP,INFO/MNP "${vcf}"
ADD REPLY

Login before adding your answer.

Traffic: 1669 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