Skip to content
Martin Asser Hansen edited this page Oct 2, 2015 · 5 revisions

Biopiece: index_vals

Description

index_vals ads an index (a forth running number) for the different values in the stream for a given key denoted with the -k switch. The values needn't be sorted.

Usage

... | index_vals [options]

Options

[-?          | --help]               #  Print full usage description.
[-k <string> | --key=<string>]       #  Key with values to index.
[-I <file!>  | --stream_in=<file!>]  #  Read input from stream file    -  Default=STDIN
[-O <file>   | --stream_out=<file>]  #  Write output to stream file    -  Default=STDOUT
[-v          | --verbose]            #  Verbose output.

Examples

Consider the following table in the file test.tab:

#MID    BEG     END     SCORE
MID51   6099    6408    24
MID51   38849   40451   62
MID51   22258   23567   24
MID51   50054   52161   34
MID52   4267    4442    105
MID52   4400    4658    25
MID52   169970  173847  23
MID51   8273    8981    16
MID51   43015   44202   66
MID54   8109    8393    69

We can add an index to the MID column using index_vals like this:

read_tab -i test.tab | index_vals -k MID | write_tab -cxk MID,MID_INDEX,BEG,END,SCORE

#MID    MID_INDEX       BEG     END     SCORE
MID51   0       6099    6408    24
MID51   1       38849   40451   62
MID51   2       22258   23567   24
MID51   3       50054   52161   34
MID52   0       4267    4442    105
MID52   1       4400    4658    25
MID52   2       169970  173847  23
MID51   4       8273    8981    16
MID51   5       43015   44202   66
MID54   0       8109    8393    69

See also

read_tab

write_tab

Author

Martin Asser Hansen - Copyright (C) - All rights reserved.

[email protected]

April 2013

License

GNU General Public License version 2

http://www.gnu.org/copyleft/gpl.html

Help

index_vals is part of the Biopieces framework.

http://www.biopieces.org

Clone this wiki locally