# Stop script on any error. set -uex # The name of the BLAST database DBNAME=16S_ribosomal_RNA # This will be the directory we store BLAST databases in. export BLASTDB=~/blastdb # Make the BLAST database directory. mkdir -p $BLASTDB # The update_blastdb.pl script is behaving oddly. # Will raise error exit code even when the process completes with no error. # Need to turn off automatic exit on error. set +e # Temporarily switch to the BLASTDB directory and run the blast database updater. # It will only update the data if it is incomplete or has changed. (cd $BLASTDB && update_blastdb.pl --quiet --decompress $DBNAME) # Turn strict error checking back on. set -e # What is inside of this database? blastdbcmd -db $DBNAME -info # Get just one sequence ouf the the database. blastdbcmd -db $DBNAME -entry NR_026093 > data-single.fa # Get just the first 20 bases of all sequences ouf the the database. blastdbcmd -db $DBNAME -entry all -range 1-20 > data-ranges.fa echo " " # Get just the first 20 bases of a given sequence ouf the the database. blastdbcmd -db $DBNAME -entry NR_026093 -range 1-20 > data-subset.fa echo " " # Get all the sequences out of the database. blastdbcmd -db $DBNAME -entry all > data-all.fa # We can also format the output using a format string. # # See blastdbcmd -help for the -outfmt parameter # # List the lenght of each sequence in the database blastdbcmd -db $DBNAME -entry all -outfmt "%a %l" > data-table.txt