Filter VCF for "CAF=[0.9,0.1]" Related to this other question
but in this case the CAF is defined as "An ordered, comma delimited list of allele frequencies...".

I tried using vcffilterjdk and the command suggested by Pierre 

java -jar dist/vcffilterjdk.jar -e 'variant.variant.getAttributeAsStringList("CAF","1.0").stream().skip(1L).map(A-&gt;Double.parseDouble(A)).anyMatch(A-&gt;A&lt;0.01);' input.vcf


but predictably returned an error 

java.lang.NumberFormatException: For input string: "0.1]"


I don't know javascript so how should I change the command to make it work?

EDIT:

HEADER

##INFO=&lt;ID=CAF,Number=.,Type=String,Description="An ordered, comma delimited list of allele frequencies based on 1000Genomes, starting with the reference allele followed by alternate alleles as ordered in the ALT column. Where a 1000Genomes alternate allele is not in the dbSNPs alternate allele set, the allele is added to the ALT column.  The minor allele is the second largest value in the list, and was previuosly reported in VCF as the GMAF.  This is the GMAF reported on the RefSNP and EntrezSNP pages and VariationReporter"&gt;  


LINE

chr1    51479   rs116400033     T       A       .       PASS    ASP;CAF=[0.8926,0.1074];COMMON=1;G5;G5A;KGPROD;KGPhase1;OTHERKG;RS=116400033;RSPOS=51479;SAO=0;SSR=0;VC=SNV;VLD;VP=0x050000000005170016000100;WGT=1;dbSNPBuildID=132
Printing a bracketed list of numerical values is not typical for VCF—I'd guess it's not strictly allowed. A list should be printed only with the commas to separate values. Perhaps the solution is as simple as removing the square brackets.

cat input.vcf | perl -ne 's/CAF=\[([^\]]+)\]/CAF=$1/; print' &gt; fixed.vcf


Replace cat with gunzip -c if your VCF file is gzip-compressed.

The Perl regular expression is


looking for the string CAF=[...]
grabbing the characters in ...
replacing the entire match with CAF=...


Here's a detailed breakdown of the Perl regular expression.


s/.../.../; — substitution syntax; replace the contents of the left block with the contents of the right block
[^\]]+ — one or more non-] characters; this is the trickiest bit; see this tutorial for more info on the [] syntax for character classes and the special ^ symbol for character class negation
(...) — the parentheses capture the matched pattern into the $1 variable
CAF=$1 — replaces everything matched in the first block with CAF= followed by the captured characters