| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified December 19, 2019 |
| 7 | |
| 8 | Description: Writes a shell script to download one genome assembly |
| 9 | and gff per genus or species, from ncbi. Attempts to select the best assembly |
| 10 | on the basis of contiguity. |
| 11 | |
| 12 | Usage: fetchproks.sh <url> <outfile> <max species per genus: int> <use best: t/f> |
| 13 | |
| 14 | Examples: |
| 15 | fetchproks.sh ftp://ftp.ncbi.nih.gov/genomes/refseq/bacteria/ bacteria.sh 2 true |
| 16 | fetchproks.sh ftp://ftp.ncbi.nih.gov/genomes/refseq/archaea/ archaea.sh 0 true |
| 17 | fetchproks.sh ftp://ftp.ncbi.nih.gov/genomes/refseq/viral/ viral.sh 0 true |
| 18 | fetchproks.sh ftp://ftp.ncbi.nih.gov/genomes/refseq/protozoa/ protozoa.sh 0 true |
| 19 | fetchproks.sh ftp://ftp.ncbi.nih.gov/genomes/refseq/invertebrate/ invertebrate.sh 0 true |
| 20 | fetchproks.sh ftp://ftp.ncbi.nih.gov/genomes/refseq/fungi/ fungi.sh 0 true |
| 21 | fetchproks.sh ftp://ftp.ncbi.nih.gov/genomes/refseq/plant/ plant.sh 0 true |
| 22 | fetchproks.sh ftp://ftp.ncbi.nih.gov/genomes/refseq/vertebrate_mammalian/ vertebrate_mammalian.sh 0 true |
| 23 | fetchproks.sh ftp://ftp.ncbi.nih.gov/genomes/refseq/vertebrate_other/ vertebrate_other.sh 0 true |
| 24 | |
| 25 | Mitochondrion, plasmid, and plastid are different and use gbff2gff. |
| 26 | |
| 27 | Processing parameters: |
| 28 | None yet! |
| 29 | |
| 30 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 31 | " |
| 32 | } |
| 33 | |
| 34 | #This block allows symlinked shellscripts to correctly set classpath. |
| 35 | pushd . > /dev/null |
| 36 | DIR="${BASH_SOURCE[0]}" |
| 37 | while [ -h "$DIR" ]; do |
| 38 | cd "$(dirname "$DIR")" |
| 39 | DIR="$(readlink "$(basename "$DIR")")" |
| 40 | done |
| 41 | cd "$(dirname "$DIR")" |
| 42 | DIR="$(pwd)/" |
| 43 | popd > /dev/null |
| 44 | |
| 45 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 46 | CP="$DIR""current/" |
| 47 | |
| 48 | z="-Xmx1g" |
| 49 | z2="-Xms1g" |
| 50 | set=0 |
| 51 | |
| 52 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 53 | usage |
| 54 | exit |
| 55 | fi |
| 56 | |
| 57 | calcXmx () { |
| 58 | source "$DIR""/calcmem.sh" |
| 59 | setEnvironment |
| 60 | parseXmx "$@" |
| 61 | } |
| 62 | calcXmx "$@" |
| 63 | |
| 64 | fetchproks() { |
| 65 | local CMD="java $EA $EOOM $z -cp $CP prok.FetchProks $@" |
| 66 | echo $CMD >&2 |
| 67 | eval $CMD |
| 68 | } |
| 69 | |
| 70 | fetchproks "$@" |