This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DP distribution plotting

Hello everyone, I am new in this as i am a biologist by formation but in my recent internship i am working on bioinformatic projects. i called for variants using bcftools, but now I want to plot distribution of DP, MQ and Qual to decide on the threshold that i will use for filtering as I don't want to filter out important variants can anyone help with the ploting. thanks in advance.

filtering dp distribution vcf

1 answer

A one-liner using 'bcftools stats' and 'gnuplot'

$ bcftools stats  input.vcf  |\
grep ^DP |\
cut -f 3,6|\
gnuplot -e "set terminal dumb 80 50 ; set title 'DP/num-sites.' ; set xlabel 'Depth'; set ylabel 'N'; set style data histogram; plot '-'  using 1:2  with lines notitle;"



                                    DP/num-sites.                               
     14 +-------------------------------------------------------------------+   
        |        +       +        +       +     *  +       +        +       |   
        |                                       *                           |   
        |                                       *                           |   
        |                                       *                           |   
        |                                       *                           |   
     12 |-+                                     *                         +-|   
        |                                       *                           |   
        |                                      **                           |   
        |                                      **                           |   
        |                                      **                           |   
        |                                      **                           |   
     10 |-+                                    **                         +-|   
        |                                      **                           |   
        |                                      **                           |   
        |                                 *  * **   *                       |   
        |                                 *  * **   *                       |   
        |                                 *  * * *  *                       |   
      8 |-+                               *  *** ** *                     +-|   
        |                                 *  **  ****                       |   
        |                                 *  **  ****                       |   
        |                                 ** **  *****                      |   
  N     |                                 *** *  *****                      |   
        |                                 *** *   ****                      |   
        |                                 *** *   ****                      |   
      6 |-+                              **** *   ****                    +-|   
        |                                *  *      ***                      |   
        |                                *  *      ***                      |   
        |              *          *  *** *  *      *****                    |   
        |              *          *  *** *  *      *****                    |   
        |              *          *  ****   *      ** **                    |   
      4 |-+            *          * *****   *      ** **                  +-|   
        |              *          * * **           ** **                    |   
        |              *         ** * **           ** **                    |   
        |           *  **        ** * **           ** ***                   |   
        |           * ***        ** *                  **                   |   
        |           *****        ** *                   **                  |   
      2 |-+      *  ****** *   ******                   ** ** *    *      +-|   
        |       ** * ***** *  *   ***                   ** ** **  **        |   
        |       ***   ** ** * *    **                   * **** * *  *       |   
        | ****** *    ** ** **     **                   * ****  *   *       |   
        |                                                                   |   
        |        +       +        +       +        +       +        +       |   
      0 +-------------------------------------------------------------------+   
        20       40      60       80     100      120     140      160     180  
                                        Depth

thanks a lot mate that helped

Log in to answer this question.