-
Notifications
You must be signed in to change notification settings - Fork 23
compute
compute can be used to perform computations on records in stream, whether you want to add some constant to specific keys - or if you want to substract the values of sets of keys.
... | compute [[options]]
[-? | --help] # Print full usage description.
[-e <string> | --eval=<string>] # Evaluate extression.
[-f <string> | --format=<string>] # Printf like format string for output.
[-I <file!> | --stream_in=<file!>] # Read input from stream file - Default=STDIN
[-O <file> | --stream_out=<file>] # Write output to file - Default=STDOUT
[-v | --verbose] # Verbose output.
To set a specific key to a constant, do:
... | compute -e 'CHR_BEG = 50'
To set a specific key to a string, do:
... | compute -e 'CHR = chr1'
To add a new key with the value of another key:
... | compute -e 'CHROMOSOME = CHR'
To add a constant to a specific key, such as adding 50 to the key CHR_BEG, do:
... | compute -e 'CHR_BEG = CHR_BEG - 50'
Note that CHR_BEG += 50
does not work.
Or if you want to perform an operation on two specified keys and save the value to a third key:
... | compute -e 'CHR_END = CHR_END + BED_LEN'
To specify the output format you can use the -f
switch that enables printf like formatting.
E.g. to output a decimal number with two decimals (rounded):
... | compute -e 'SCORE = COUNT / LINES' -f '%.2f'
To add bogus quality SCORES to sequence type entries ala FASTQ format do:
... | compute -e 'SCORES="h" x SEQ_LEN'
Martin Asser Hansen - Copyright (C) - All rights reserved.
August 2007
GNU General Public License version 2
http://www.gnu.org/copyleft/gpl.html
compute is part of the Biopieces framework.