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

Biopiece: analyze_vals

Description

analyze_vals analyzes all records in the stream and outputs a single record in the form:

KEY: SCORES
TYPE: Alphabetic
COUNT: 10000
MIN: 50
MAX: 50
SUM: 500000
MEAN: 50.0
---

analyze_vals in pretty print mode.

Usage

... | analyze_vals [options]

Options

[-?         | --help]               #  Print full usage description.
[-k <list>  | --keys=<list>]        #  Comma separated list of keys to analyze.
[-K <list>  | --no_keys=<list>]     #  Comma separated list of keys _not_ to analyze.
[-x         | --no_stream]          #  Do not emit records.
[-o <file>  | --data_out=<file>]    #  Write result to file.
[-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:

Human   123
Dog     45
Mouse   6

To analyze the values of all columns, read in the table with read_tab and then pipe to analyze_vals:

read_tab -i test.tab | analyze_vals -x | write_tab -cpx

+-----+------------+-------+-----+-----+-----+------+
| KEY | TYPE       | COUNT | MIN | MAX | SUM | MEAN |
+-----+------------+-------+-----+-----+-----+------+
| V0  | Alphabetic |     3 |   3 |   5 |  13 |  4.3 |
| V1  | Numeric    |     3 |   6 | 123 | 174 | 58.0 |
+-----+------------+-------+-----+-----+-----+------+

To save the output of analyze_vals in a file use the -o switch. This allows further analysis of records in the stream if you also omit the -x switch:

read_tab -i test.tab | analyze_vals -o analysis.txt | write_tab -cpx

+-------+-----+
| V0    | V1  |
+-------+-----+
| Human | 123 |
| Dog   |  45 |
| Mouse |   6 |
+-------+-----+

And the output of analysis.txt is a list of Biopiece records that can be read and pretty printed with write_tab:

write_tab -I analysis.txt -cpx

+-----+------------+-------+-----+-----+-----+-------+
| KEY | TYPE       | COUNT | MIN | MAX | SUM | MEAN  |
+-----+------------+-------+-----+-----+-----+-------+
| V0  | Alphabetic |     3 |   3 |   5 |  13 |  4.33 |
| V1  | Numeric    |     3 |   6 | 123 | 174 | 58.00 |
+-----+------------+-------+-----+-----+-----+-------+

To only analyze the values of the first column, use the ´-k´ switch:

read_tab -i test.tab | analyze_vals -k V0 -x | write_tab -cpx

+-----+------------+-------+-----+-----+-----+------+
| KEY | TYPE       | COUNT | MIN | MAX | SUM | MEAN |
+-----+------------+-------+-----+-----+-----+------+
| V0  | Alphabetic |     3 |   3 |   5 |  13 |  4.3 |
+-----+------------+-------+-----+-----+-----+------+

To analyze the values of all columns, execpt the first, use the ´-K´ switch:

read_tab -i test.tab | analyze_vals -K V0 -x | write_tab -cpx

+-----+---------+-------+-----+-----+-----+------+
| KEY | TYPE    | COUNT | MIN | MAX | SUM | MEAN |
+-----+---------+-------+-----+-----+-----+------+
| V1  | Numeric |     3 |   6 | 123 | 174 | 58.0 |
+-----+---------+-------+-----+-----+-----+------+

See also

read_tab

write_tab

sum_vals

min_vals

max_vals

mean_vals

length_vals

Author

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

[email protected]

August 2007

License

GNU General Public License version 2

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

Help

analyze_vals is part of the Biopieces framework.

http://www.biopieces.org

Clone this wiki locally