| 1 | #!/bin/bash |
| 2 | #SBATCH -J sketch_refseq |
| 3 | #SBATCH -q genepool |
| 4 | #SBATCH -A gtrqc |
| 5 | #SBATCH -N 1 |
| 6 | #SBATCH -C haswell |
| 7 | #SBATCH -t 71:00:00 |
| 8 | #SBATCH --error=log_%j.err |
| 9 | #SBATCH --output=log_%j.out |
| 10 | #SBATCH --exclusive |
| 11 | |
| 12 | set -e |
| 13 | |
| 14 | #Written by Brian Bushnell |
| 15 | #Last updated August 19, 2019 |
| 16 | |
| 17 | #Filters prokaryotic clades, translates them to protein, and sketches them. |
| 18 | #To use this script outside of NERSC, modify $TAXPATH to point to your directory with the BBTools taxonomy data, |
| 19 | #e.g. TAXPATH="/path/to/taxonomy_directory/" |
| 20 | |
| 21 | TAXPATH="auto" |
| 22 | |
| 23 | #Ensure necessary executables are in your path |
| 24 | #module load pigz |
| 25 | |
| 26 | mkdir prot |
| 27 | time filterbytaxa.sh in=sorted.fa.gz out=prot/prok.fa.gz fastawrap=4095 ids=Viruses,Bacteria,Archaea,plasmids tree=auto -Xmx16g include taxpath=$TAXPATH zl=9 requirepresent=f |
| 28 | cd prot |
| 29 | |
| 30 | wget -q -O - ftp://ftp.ncbi.nlm.nih.gov/refseq/release/protozoa/*genomic.fna.gz | gi2taxid.sh -Xmx1g in=stdin.fa.gz out=protozoa.fa.gz zl=9 server ow |
| 31 | wget -q -O - ftp://ftp.ncbi.nlm.nih.gov/refseq/release/mitochondrion/*genomic.fna.gz | gi2taxid.sh -Xmx1g in=stdin.fa.gz out=mito.fa.gz zl=9 server ow |
| 32 | wget -q -O - ftp://ftp.ncbi.nlm.nih.gov/refseq/release/plastid/*genomic.fna.gz | gi2taxid.sh -Xmx1g in=stdin.fa.gz out=chloro.fa.gz zl=9 server ow |
| 33 | |
| 34 | time callgenes.sh in=prok.fa.gz outa=prok.faa.gz -Xmx16g ow ordered=f zl=9 |
| 35 | time callgenes.sh in=protozoa.fa.gz outa=protozoa.faa.gz -Xmx16g ow ordered=f zl=9 |
| 36 | time callgenes.sh in=mito.fa.gz outa=mito.faa.gz -Xmx16g ow ordered=f zl=9 |
| 37 | time callgenes.sh in=chloro.fa.gz outa=chloro.faa.gz -Xmx16g ow ordered=f zl=9 |
| 38 | |
| 39 | cat prok.faa.gz mito.faa.gz chloro.faa.gz protozoa.faa.gz > all.faa.gz |
| 40 | |
| 41 | time sketchblacklist.sh -Xmx63g in=prok.faa.gz prepasses=1 tree=auto taxa taxlevel=family ow out=blacklist_prokprot_family_40.sketch mincount=40 k=9,12 sizemult=3 amino taxpath=$TAXPATH |
| 42 | time sketchblacklist.sh -Xmx63g in=prok.faa.gz prepasses=1 tree=auto taxa taxlevel=genus ow out=blacklist_prokprot_genus_80.sketch mincount=80 k=9,12 sizemult=3 amino taxpath=$TAXPATH |
| 43 | mergesketch.sh -Xmx1g in=blacklist_prokprot_genus_80.sketch,blacklist_prokprot_family_40.sketch out=blacklist_prokprot_merged.sketch amino name0=blacklist_prokprot_merged k=9,12 ow |
| 44 | time bbsketch.sh -Xmx63g in=all.faa.gz out=taxa#.sketch mode=taxa tree=auto files=31 ow unpigz minsize=200 prefilter autosize blacklist=blacklist_prokprot_merged.sketch k=9,12 depth sizemult=3 amino taxpath=$TAXPATH |