]> git.donarmstrong.com Git - biopieces.git/blob - bp_usage/write_tab.wiki
update wiki
[biopieces.git] / bp_usage / write_tab.wiki
1 =Biopiece: write_tab=
2
3 ==Synopsis==
4
5 Write tabular output from stream.
6
7 ==Description==
8
9 Outputting the data stream as a table can be done with [write_tab]
10 which will write generate one row per record with the values as columns. 
11
12 ==Usage==
13
14 {{{
15 ... | write_tab [options]
16 }}}
17
18 ==Options==
19
20 {{{
21 [-x          | --no_stream]          -  Do not emit records.
22 [-o <file>   | --data_out=<file>]    -  Write result to file.
23 [-c          | --comment]            -  Print comment line  -  Default=no
24 [-d <string> | --delimit=<string>]   -  Changes delimiter   -  Default='\t'
25 [-k <string> | --keys=<string>]      -  Comma separated list of keys to print in that order.
26 [-K <string> | --no_keys=<string>]   -  Comma separated list of keys to ignore.
27 [-I <file>   | --stream_in=<file>]   -  Read input from stream file  -  Default=STDIN
28 [-O <file>   | --stream_out=<file>]  -  Write output to stream file  -  Default=STDOUT
29 [-Z          | --compress]           -  Compress output using gzip.
30 }}}
31
32 ==Examples==
33
34 To write all records from the stream as a table, do:
35
36 {{{
37 ... | write_tab 
38 }}}
39
40 If you supply the optional `-c` switch, when the first row in the table will be a 'comment' line prefixed with a '#':
41
42 {{{
43 ... | write_tab -c
44 }}}
45
46 You can also change the delimiter from the default (tab) to e.g. ',':
47
48 {{{
49 ... | write_tab -d ','
50 }}}
51
52 If you want the values output in a specific order you have to supply a comma
53 separated list using the `-k` switch that will print only those keys in that order:
54
55 {{{
56 ... | write_tab -k SEQ_NAME,COUNT
57 }}}
58
59 Keys from e.g. [read_tab] V0, V1, V2 ... Vn, is automagically sorted numerically.
60
61 Alternatively, if you have some keys that you don't want in the tabular output,
62 use the `-K` switch. So to print all keys except SEQ and SEQ_TYPE do:
63
64 {{{
65 ... | write_tab -K SEQ,SEQ_TYPE
66 }}}
67
68 Finally, if you have a stream containing a mix of different records types, e.g.
69 records with sequences and records with matches, then you can use [write_tab] to
70 output all the records in tabluar format, however, the `-c`, `-k`, and `-K` switches
71 will only respond to records of the first type encountered. The reason is that outputting
72 mixed records is probably not what you want anyway, and you should remove all the unwanted
73 records from the stream before outputting the table: [grab] is your friend.
74
75 ==See also==
76
77 [read_tab]
78
79 [grab]
80
81 ==Author==
82
83 Martin Asser Hansen - Copyright (C) - All rights reserved.
84
85 mail@maasha.dk
86
87 August 2007
88
89 ==License==
90
91 GNU General Public License version 2
92
93 http://www.gnu.org/copyleft/gpl.html
94
95 ==Help==
96
97 [write_tab] is part of the Biopieces framework.
98
99 http://code.google.com/p/biopieces/