Question: Command to parse mummer coords file
0
gravatar for el97004
10 months ago by
el9700410
el9700410 wrote:

Hi !

Anyone know some linux commands that can be used to parse through the output coords table of MUMmer? It has the following output format:

    [S1]     [E1]  |     [S2]     [E2]  |  [LEN 1]  [LEN 2]  |  [% IDY]  | [TAGS]
=====================================================================================
   28536    30543  |     2008        1  |     2008     2008  |    89.71  | 3583 1233
    6306     6469  |      972      808  |      164      165  |    92.73  | 3585 1364
    6653     7101  |      455        4  |      449      452  |    84.31  | 3585 1364

All I need is the average of the % IDY column but have not been able to get this via linux commands. I also tried converting to an easier format such as txt but that also did not work.

Any ideas? Thank you!

nucmer mummer • 247 views
ADD COMMENTlink modified 10 months ago by Pierre Lindenbaum130k • written 10 months ago by el9700410

All I need is the average of the % IDY column but have not been able to get this via linux commands.

what did you try ?

ADD REPLYlink written 10 months ago by Pierre Lindenbaum130k

Assuming my file is named "coords"

cat coords \
| tail -n +3 \  # remove header section
| cut -f 10 \   # get %IDY column (I think this is where it fails)
| awk '{ total += $2; count++ } END { print total/count }' # average calc
ADD REPLYlink modified 10 months ago • written 10 months ago by el9700410
2
gravatar for Pierre Lindenbaum
10 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum130k wrote:

as it looks your output is a set of fixed-length columns, you'd better try with something like:

cut -c 63-70
ADD COMMENTlink modified 10 months ago • written 10 months ago by Pierre Lindenbaum130k

Thanks! cut -c fixes the issue, I will paste the final working code below:

cat coords | tail -n +3 | cut -c 63-71 | awk '{ total += $1 } END { print total/NR }'
ADD REPLYlink modified 10 months ago • written 10 months ago by el9700410
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: 1587 users visited in the last hour