 |
|
 |
 |
  | #!/bin/bash function help { cat << HELP ====================================== 'fa', a Front end to Pearson FASTA ======================================
Usage: $ fa <options> <target> <database> Parameter order is strict. Options: All Peason options are allowed; for explicit printing to screen, use " -O stdout" Arguments: target: a file containing the target sequence in FASTA format; database: a FASTA-formatted database file --OR-- an asterixk-globbed list of FASTA-formatted file names, with the globbed phrase single-quoted (or script will fail!). Comments: Targets are assumed to be nucleotides, 100 alignments are reported, Results are displayed in standard Blast format. All defaults can be overridden with appropriate options.
Author: Eric Kofoid, 1/13/2013 eckofoid@ucdavis.edu
HELP }
function nthP # Extracts the nth parameter: # Pass "n" as parameter 1 and the parameter string "$*" as 2 # Adapted from 'file-utils' of Anthony Thyssen # www.cit.gu.edu.au/~anthony/info/shell/file.hints { shift $1 echo $1 }
fastaout=`pwd`/foo.fa
# check for help: if [ $# = 0 ] || [ $1 = '-h' ] || [ $1 = '--h' ]; then help exit elif [ $1 = '-help' ] || [ $1 = '--help' ]; then help echo; echo 'Pearson FastA36 Help: ' fasta36 -help exit fi
set -f # turn off globbing last=$# db=`nthP $last $*` # get database string if [ -n "$(echo $db | grep \*)" ]; then # is there an asterisk? doGlob=yes else doGlob= fi set +f # restore globbing
qnum=$((last - 1)) query=`nthP $qnum $*` # get query
format= opts= while [ $# -gt 2 ] # gather extra opts do if [ $1 = -O ]; then # get a non-default output fastaout=$2 shift; shift fi if [ $# -gt 2 ];then opts=$opts" "$1 if [ $1 = -m ]; then # flag non-default format format=yes fi shift fi done if [ $fastaout != stdout ]; then # if stdout, will print to screen opts=$opts" -O "$fastaout fi
if [ -z $format ]; then # set default format opts=$opts" -m BB" fi
if [ $doGlob ] then echo "DB from dynamically merged files: " pfile=$HOME/000tmp000.db cat $(eval echo $db | tr " " "\n") > $pfile fasta36 -n -d 100 $opts $query $pfile rm $pfile # remove temp db else fasta36 -n -d 100 $opts $query $db fi
|
 |
 |
|


 |
 |
 |