How to filter VCF with HRun > 8 and AB > 0.2 and AB < 0.2
0
0
Entering edit mode
6.1 years ago

Hello,

I have vcf files containing R8 and LowVariantFreq variants (they are flagged as PASS) and I would like to filter out these variants. I have tried without sucess vcftools... Do you have any suggestion on how to proceed ?

Thank you very much !

vcf filtering • 1.8k views
ADD COMMENT
0
Entering edit mode

Hello,

have you tried searching the web by How to filter VCF? What problems have you faced?

fin swimmer

ADD REPLY
0
Entering edit mode

Thank you for your reply.
I apologize in advance but I only have basic knowledges in bioinformatics. So I might do some strange things...
I have tried the following command line.

for elt in mini/*indel.vcf ; do vcffilter -s -f "AB > 0.25 & AB < 0.75" $elt > {$elt%.vcf}_filtered.vcf  ; done

But no variant are excluded by this command.
Any suggestion ?
Henri

ADD REPLY
1
Entering edit mode

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

ADD REPLY
0
Entering edit mode

Hello again,

I cannot help you with vcftools. I would recommend to use bcftools instead. Have a look at bcftools filter and the descriptions of expressions.

fin swimmer

ADD REPLY
0
Entering edit mode

Hello again, I have made some progress to filter vcf based on allelic balance. I used the tools vcffilterjdk with the following command line :

java -jar vcffilterjdk.jar -e 'return variant.getGenotypes().stream().filter(G->G.hasAD()).map(G->G.getAD()).allMatch(A->A.length>1 && A[0]>0 && A[1]/(double)A[0]> 0.2);' input.vcf  > output.vcf

To filter R8 variant I flagged variants in the filter fields based with the tool vcfpolyx.jar :

java -jar /cfpolyx.jar -R /genome_ref/hg19.fa -n 8 -o output.vcf input.vcf

Now I have a vcf like this with the POLYX_ge_8 flag:

chr1    985443  .   AG  A   558.71  POLYX_ge_8;SB   BaseQRankSum=0.284;DP=68;FS=13.961;HRun=15;HaplotypeScore=332.152;MQ=60;MQ0=0;MQRankSum=-0.557;POLYX=15;QD=8.22;ReadPosRankSum=0.83;SB=0    GT:AD:DP:GQ:PL:MQ:GQX:VF    0/1:41,23:68:99:598,0,121:60:99:0.359

I would like now to use bcftools to filter my vcf based on this field but I am not successfull so far. My attempt :

bcftools filter -e 'POLYX_ge_8' input.vcf

I know the answer must be pretty simple but again I am a newbie...

Thanks !

ADD REPLY
0
Entering edit mode

Hi,

You can filter vcf based on AB tag using:

bcftools view -i 'AB>0.25 && AB < 0.75' input.vcf > out.vcf
ADD REPLY

Login before adding your answer.

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