This is a test version of Biostars. For the public version, visit https://www.biostars.org.
MIN and MAX read depth for vcfutils.pl

I am trying to filter vcf files for Whole Exome Sequencing and I want to know what value is the minimum and maximum depth and how can I calculate.

next-gen alignment sequencing

1 answer

using bioalcidae:

 java -jar dist/bioalcidae.jar -e 'var m=null,M=null;while(iter.hasNext()) {var ctx=iter.next();if(!ctx.hasAttribute("DP")) continue; var dp= ctx.getAttributeAsInt("DP",-1);if(m==null || m> dp) m=dp; if(M==null||M<dp) M=dp;} out.println("min "+m+" max "+M);'  input.vcf.gz

using std linux:

$ gunzip -c input.vcf.gz | grep -v "#" | cut -f 8 | tr ";" "\n" | grep 'DP=' | cut -c 4- | sort -n | tail -1

$ gunzip -c input.vcf.gz | grep -v "#" | cut -f 8 | tr ";" "\n" | grep 'DP=' | cut -c 4- | sort -n | head -n 1

or even:

$ gunzip -c input.vcf.gz | grep -v "#" | cut -f 8 | tr ";" "\n" | grep 'DP=' | cut -c 4- | sort -n | tee >(head -n 1) >(tail -1) > /dev/null

Log in to answer this question.