This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Output Of Delly: How To Filter Based On A (Summary) Line And Print The Above Lines?

I have an output of DELLY which looks like this:

HMR:ERR007538.3275891       83      1       9695    35       =       9437    -294    Library0
HMR:ERR007571.842092        99      1       9444    32       =       9698    290     Library0
HMR:ERR007571.842038        99      1       9423    32       =       9698    290     Library0
---------------------------------------------
1       9480    9695    215     3       34       >Deletion_xxx_00000000<

HMR:ERR111546.37851360      81      1       496657  0       =       39802   -456953 Library0
HMR:ERR111543.25219252      81      1       496665  0       =       39814   -456950 Library0
HMR:ERR111546.14313062      81      1       496681  0       =       39851   -456928 Library0
---------------------------------------------

I would like to filter on the 5th (>3) and 6th (>20) line below the dashes and then get that complete block as output.

So my output would look like this, when the filtering thresholds are met:

HMR:ERR007538.3275891       83      1       9695    35       =       9437    -294    Library0
HMR:ERR007571.842092        99      1       9444    32       =       9698    290     Library0
HMR:ERR007571.842038        99      1       9423    32       =       9698    290     Library0
---------------------------------------------
1       9480    9695    215     3       34       >Deletion_xxx_00000000<

I have tried multiple ways of getting this done, including awk and sed, which fail due to no way of defining which and how many lines above should be kept. My knowledge of perl/python is not good enough (it is improving though!), but I feel that can be done. I think a block should/could be evaluated on basis of the last (summary) line under the dash and then printed/saved if it matches these thresholds.

Hopefully anyone can push me in the right direction, Cheers.

filtering python

5th and 6 th represents column or row?

Ah, I'm sorry: the column (so the "3" and "34" in the example-output).

0 answers

No answers yet.

Log in to answer this question.