Question: How to filter VCF with HRun > 8 and AB > 0.2 and AB < 0.2
0
gravatar for pegeot.henri
8 months ago by
pegeot.henri0 wrote:

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 !

filtering vcf • 314 views
ADD COMMENTlink modified 8 months ago • written 8 months ago by pegeot.henri0

Hello,

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

fin swimmer

ADD REPLYlink written 8 months ago by finswimmer11k

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 REPLYlink modified 8 months ago by RamRS22k • written 8 months ago by pegeot.henri0
1

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 REPLYlink written 8 months ago by RamRS22k

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 REPLYlink written 8 months ago by finswimmer11k

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 REPLYlink modified 8 months ago • written 8 months ago by pegeot.henri0

Hi,

You can filter vcf based on AB tag using:

bcftools view -i 'AB>0.25 && AB < 0.75' input.vcf > out.vcf
ADD REPLYlink written 8 months ago by AISHA80
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: 1603 users visited in the last hour