The STILTS tasks documented in Appendix B
can be used under their usual names if they are imported from the
stilts
module.
STILTS parameters as are supplied as named arguments of the python
functions. In general they are either table objects for table input
parameters or strings, but in some cases python arrays are accepted,
and numbers may be used where appropriate.
The STILTS input format (ifmt
, istream
),
filter (cmd
/icmd
/ocmd
)
and output mode (omode
) parameters are not used however;
instead perform filtering directly on the table inputs and outputs
using the python cmd_*
and mode_*
table methods or functions.
Here is an example of concatenating two similar tables together and writing the result:
>>> from stilts import tread, tcat >>> t1 = tread('data1.csv', fmt='csv') >>> t2 = tread('data2.csv', fmt='csv') >>> t12 = tcat([t1,t2], seqcol='seq') >>> t12.write('t12.csv', fmt='csv')
Note that for those tasks which have a parameter named "in
"
in command-line STILTS, it has been renamed as "in_
" for
the python version, to avoid a name clash with the python reserved word.
In most cases, the in
parameter is the first, mandatory
parameter in any case, and so can be referenced by position as in the
previous example (we could have written "tcat(in_=[t1,t2])
"
instead).