| 1 | #!/bin/bash |
| 2 | set -e |
| 3 | |
| 4 | #Written by Brian Bushnell |
| 5 | #Last updated February 21, 2018 |
| 6 | |
| 7 | #Combines IMG (a JGI genome set) into a single flat file, renamed by taxonomy, and sketches it. |
| 8 | #This script only works on Genepool or other systems connected to NERSC. |
| 9 | #"time" before each command is optional. |
| 10 | |
| 11 | |
| 12 | #Rename all contigs by prefixing them with the IMG ID, and put them in a single file. |
| 13 | #"in=auto" reads the IMG ID, taxID, and file location from a file at /global/projectb/sandbox/gaag/bbtools/tax/img2/IMG_taxonID_ncbiID_fna.txt |
| 14 | #This is a 3-column tsv file. |
| 15 | #The "imghq" flag uses a different file, "IMG_taxonID_ncbiID_fna_HQ.txt", which contains only high-quality genomes. |
| 16 | time renameimg.sh in=auto imghq out=renamed.fa.gz fastawrap=255 zl=6 |
| 17 | |
| 18 | #Make the IMG blacklist of uninformative kmers occuring in over 300 different species. |
| 19 | #This is optional, but tends to increase query speed and reduce false positives. |
| 20 | time sketchblacklist.sh -Xmx31g in=renamed.fa.gz prepasses=1 tree=auto taxa taxlevel=species ow out=blacklist_img_species_300.sketch mincount=300 k=31,24 imghq |
| 21 | |
| 22 | #Sketch the reference genomes, creating one sketch per IMG ID. |
| 23 | #They are written to 31 files, img0.sketch through img30.sketch. |
| 24 | #The only reason for this is to allow parallel loading by CompareSketch. |
| 25 | time sketch.sh -Xmx31g in=renamed.fa.gz out=img#.sketch files=31 mode=img tree=auto img=auto gi=null ow blacklist=blacklist_img_species_300.sketch k=31,24 imghq |
| 26 | |
| 27 | #A query such as contigs.fa can now be compared to the new reference sketches like this: |
| 28 | #comparesketch.sh in=contigs.fa k=31,24 tree=auto img*.sketch blacklist=blacklist_img_species_300.sketch printimg |
| 29 | |
| 30 | #On NERSC systems, you can then set the default path to img by pointing /global/projectb/sandbox/gaag/bbtools/img/current at the path to the new sketches. |
| 31 | #Then you can use the default set of img sketches like this: |
| 32 | #comparesketch.sh in=contigs.fa img tree=auto printimg |
| 33 | #That command automatically adds the default path to the sketches, the blacklist, and the correct values for K. |