diff --git a/uf-bare b/uf-bare index c4916a3..9ea0dcc 100755 --- a/uf-bare +++ b/uf-bare @@ -26,19 +26,19 @@ err_exit() { # Function to show usage information and exit usage_exit() { - echo - echo "Usage: $(basename $0) [OPTIONS] [FILE] ..." - echo - echo " Output only the bare sequences from each FILE to stanard output, dropping the" - echo " headers. If no FILE is present or FILE is '-', read from standard input." - echo - echo " Options" - echo " -w HDRSFILE Write the headers to HDRSFILE, which must not already exist." - echo " -f|--force Overwrite HDRSFILE if it exists." - echo - echo " By default headers go to /dev/null. Use option -w to store them in a file." - echo " The file can be merged back in with bare sequences using 'uf-dress'." - echo + echo " +Usage: $(basename $0) [OPTIONS] [FILE] ... + + Output only the bare sequences from each FILE to standard output, dropping the + headers. If no FILE is present or FILE is '-', read from standard input. + + Options + -w HDRSFILE Write the headers to HDRSFILE, which must not already exist. + -f|--force Overwrite HDRSFILE if it exists. + + By default headers go to /dev/null. Use option -w to store them in a file. + The file can be merged back in with bare sequences using 'uf-dress'. +" >&2 exit ${1:-1} } diff --git a/uf-dress b/uf-dress index 7c5952b..25763c5 100755 --- a/uf-dress +++ b/uf-dress @@ -44,7 +44,7 @@ Usage: $(basename $0) [OPTIONS] [FILE] ... $ uf file.fna | uf-bare | ..processing.. | uf-dress -r <(uf file.fna | uf-headers) See also: 'uf-map' which implements this idiom in a single command. -" +" >&2 exit ${1:-1} } diff --git a/uf-headers b/uf-headers index 7e55278..a81e904 100755 --- a/uf-headers +++ b/uf-headers @@ -26,12 +26,12 @@ err_exit() { # Function to show usage information and exit usage_exit() { - echo - echo "Usage: $(basename $0) [OPTIONS] [FILE] ..." - echo - echo " Drop the sequence data and output only the headers from each FILE." - echo " If no FILE is present or FILE is '-', read from standard input." - echo + echo " +Usage: $(basename $0) [OPTIONS] [FILE] ... + + Drop the sequence data and output only the headers from each FILE. + If no FILE is present or FILE is '-', read from standard input. +" >&2 exit ${1:-1} } diff --git a/uf-map b/uf-map index f51ece2..d7da2e2 100755 --- a/uf-map +++ b/uf-map @@ -26,20 +26,20 @@ err_exit() { # Function to show usage information and exit usage_exit() { - echo - echo "Usage: $(basename $0) [OPTIONS] OPERATION [FILE] ..." - echo - echo " Feed every sequence in FILE to OPERATION's standard input. When no FILE" - echo " is present or FILE is '-', read from standard input. Output is the output" - echo " of OPERATION interspersed with every header from the input." - echo - echo " Note that OPERATION is started once, not invoked separately for each line." - echo " It must process every line coming in on its standard input separately." - echo - echo " Example" - echo " \$ uf-map 'tr [:upper:] [:lower:]' # convert all seqs to lower case" - echo " \$ uf-map 'sed -re s,^.{12},,' # drop initial 12 elements from each" - echo + echo " +Usage: $(basename $0) [OPTIONS] OPERATION [FILE] ... + + Feed every sequence in FILE to OPERATION's standard input. When no FILE + is present or FILE is '-', read from standard input. Output is the output + of OPERATION interspersed with every header from the input. + + Note that OPERATION is started once, not invoked separately for each line. + It must process every line coming in on its standard input separately. + + Example + \$ uf-map 'tr [:upper:] [:lower:]' # convert all seqs to lower case + \$ uf-map 'sed -re s,^.{12},,' # drop initial 12 elements from each +" >&2 exit ${1:-1} } diff --git a/uf-random b/uf-random index 550d13e..048d2ee 100755 --- a/uf-random +++ b/uf-random @@ -30,25 +30,25 @@ err_exit() { # Function to show usage information and exit usage_exit() { - echo - echo "Usage: $(basename $0) [OPTIONS] [CHARS]" - echo - echo " Write to standard output an unfasta file with randomly generated sequences." - echo " Characters are picked randomly uniform from alphabet CHARS (default: $SEQ_CHARS)." - echo " Sequences can be of fixed or random lengths." - echo - echo " Options" - echo " -c|--count COUNT Number of sequences (default: $SEQ_COUNT)" - echo " -l|--length LEN Length of sequences (default: $SEQ_LENGTH), excludes -r." - echo " -r|--range MIN,MAX Random length sequences in range [MIN,MAX], excludes -l." - echo - echo " The CHARS argument can be used to create sequences from any alphabet." - echo " To create biased sequences, repeat characters in CHARS so they have the" - echo " desired proportions. E.g. \'AACCCTTGGG\' yields sequences with 60% GC." - echo - echo " NOTE: the current implementation uses the \$RANDOM builtin to obtain random" - echo " numbers. This is bash specific. TODO: change to read from /dev/urandom." - echo + echo " +Usage: $(basename $0) [OPTIONS] [CHARS] + + Write to standard output an unfasta file with randomly generated sequences. + Characters are picked randomly uniform from alphabet CHARS (default: $SEQ_CHARS). + Sequences can be of fixed or random lengths. + + Options + -c|--count COUNT Number of sequences (default: $SEQ_COUNT) + -l|--length LEN Length of sequences (default: $SEQ_LENGTH), excludes -r. + -r|--range MIN,MAX Random length sequences in range [MIN,MAX], excludes -l. + + The CHARS argument can be used to create sequences from any alphabet. + To create biased sequences, repeat characters in CHARS so they have the + desired proportions. E.g. \'AACCCTTGGG\' yields sequences with 60% GC. + + NOTE: the current implementation uses the \$RANDOM builtin to obtain random + numbers. This is bash specific. TODO: change to read from /dev/urandom. +" >&2 exit ${1:-1} } diff --git a/uf-rc b/uf-rc index e79b512..487598f 100755 --- a/uf-rc +++ b/uf-rc @@ -37,20 +37,20 @@ err_exit() { # Function to show usage information and exit usage_exit() { - echo - echo "Usage: $(basename $0) [OPTIONS] [FILE] ..." - echo - echo " Write to standard output the reverse complement of every sequence in each FILE." - echo " If no FILE is present or FILE is '-', read from standard input." - echo - echo " Options" - echo " -r|--reverse-only Reverse only, do not complement." - echo " -c|--complement-only Complement only, do not reverse." - echo " -m|--mark[-header] Document operation by attaching '(uf:...)' to headers." - echo - echo " Case is preserved. Will also work for the degenerate nucleotide letters." - echo " E.g. complement of Y (pyrimidine, T/C) is R (purine, A/T)." - echo + echo " +Usage: $(basename $0) [OPTIONS] [FILE] ... + + Write to standard output the reverse complement of every sequence in each FILE. + If no FILE is present or FILE is '-', read from standard input. + + Options + -r|--reverse-only Reverse only, do not complement. + -c|--complement-only Complement only, do not reverse. + -m|--mark[-header] Document operation by attaching '(uf:...)' to headers. + + Case is preserved. Will also work for the degenerate nucleotide letters. + E.g. complement of Y (pyrimidine, T/C) is R (purine, A/T). +" >&2 exit ${1:-1} } diff --git a/uf-valid b/uf-valid index 6ef4d68..0a6f256 100755 --- a/uf-valid +++ b/uf-valid @@ -57,33 +57,33 @@ err_exit() { # Function to show usage information and exit usage_exit() { - echo - echo "Usage: $(basename $0) [OPTIONS] [FILE] ..." - echo - echo " Validate the sequences in each FILE against the allowed alphabet. If no FILE" - echo " is present or FILE is '-', read from standard input. Only valid sequences are" - echo " copied to standard output. For invalid sequences, an error message is printed" - echo " to standard error." - echo - echo " Options" - echo " -a|--allow CHARS Validate sequences against the alphabet consisting of CHARS." - echo " May be specified in addition to the synonyms listed below." - echo " -i|--ignore-case Ignore case for allowed CHARS (default for the synonyms)." - echo " -v|--headers Validate the syntax of the headers against NCBI conditions." - echo " -s|--stop Stop processing after the first invalid sequence." - echo " -k|--keep Do not drop invalid sequences but copy them to standard out." - echo " -q|--quiet Do not copy standard input to standard output." - echo - echo " Synonyms for the usual alphabets (mutually exclusive):" - echo " --dna Equivalent to: -i -a '$DNA_ALPHABET'" - echo " --rna Equivalent to: -i -a '$RNA_ALPHABET'" - echo " --nucl Equivalent to: -i -a '$NUCL_ALPHABET'" - echo " --amino|--prot Equivalent to: -i -a '$AMINO_ALPHABET'" - echo - echo " CAVEAT: when using --allow with symbols other than characters: the current" - echo " implementation is a simple regex search for the complement of the alphabet," - echo " so symbols which are regex meta-characters like ., ?, and * need escaping." - echo + echo " +Usage: $(basename $0) [OPTIONS] [FILE] ... + + Validate the sequences in each FILE against the allowed alphabet. If no FILE + is present or FILE is '-', read from standard input. Only valid sequences are + copied to standard output. For invalid sequences, an error message is printed + to standard error. + + Options + -a|--allow CHARS Validate sequences against the alphabet consisting of CHARS. + May be specified in addition to the synonyms listed below. + -i|--ignore-case Ignore case for allowed CHARS (default for the synonyms). + -v|--headers Validate the syntax of the headers against NCBI conditions. + -s|--stop Stop processing after the first invalid sequence. + -k|--keep Do not drop invalid sequences but copy them to standard out. + -q|--quiet Do not copy standard input to standard output. + + Synonyms for the usual alphabets (mutually exclusive): + --dna Equivalent to: -i -a '$DNA_ALPHABET' + --rna Equivalent to: -i -a '$RNA_ALPHABET' + --nucl Equivalent to: -i -a '$NUCL_ALPHABET' + --amino|--prot Equivalent to: -i -a '$AMINO_ALPHABET' + + CAVEAT: when using --allow with symbols other than characters: the current + implementation is a simple regex search for the complement of the alphabet, + so symbols which are regex meta-characters like ., ?, and * need escaping. +" >&2 exit ${1:-1} }