Automating Prokka annotations, BLAST runs and generation of BLAST reports
The script does the following:
- Reads in your FASTA format file containing contig sequences
- Annotates your contigs with Prokka
- Performs a BLAST search of the annotated coding sequences generated by Prokka with BLAST vs. the local database of your preference
- Generates a report table with the following fields:
Query | Matching Strain | Query Coverage | Percent ID | Identities | Alignment Length | Query Start | Query End | Subject End | Query Length | Subject Length | E-value |
---|
The script has been written on Python 3.4.3 and it has been tested on Linux only. Windows implementation is being investigated, but it is not available yet. The installation of a Linux virtual machine (preferrably Ubuntu) on your Windows computer is strongly recommended for the meanwhile.
In order to run this script, you would need to have the following installed on your system:
-
Python 3
-
NCBI BLAST+
This is the standalone version of BLAST that you can run locally on your machine. flumatch.py
calls the blastn
algorithm.
Instructions for Linux:
sudo apt-get install ncbi-blast+
- Prokka: microbial annotation software
Please follow the installation instructions in the official Prokka repository
flumatch.py
will do a BLAST search of your annotated sequences vs. a local database. You need to build said database. The instructions to do this are:
- Download the sequences from NCBI or FluDB that you want to compare to your contigs. In my case I downloaded all the Influenza Virus A sequences that existed in NCBI on May 26, 2016 (taxid:11320). I have a Perl script that you can use to do that from the command line.
- Once you have the database you want, you need to type in the following commands:
makeblastdb -in filename.fasta -dbtype nucl -title filename -out filename
For example, if you have a FASTA file named avian.fasta
or avian.fna
which contains the sequences that you want to use as your BLAST database, you could do the following:
makeblastdb -in avian.fasta -dbtype nucl -title avian -out avian
After you run that command you will see that three new files will be created in the directory with the extensions *.nhr
, *.nin
, and *.nsq
. These are the files that BLAST will use to search your sequences against.
python3 flumatch.py --blast-db /path/to/blastdb -r name_of_report_file.txt -p name_of_prokka_folder contigs.fasta
The most important thing to keep in mind is that the name of the FASTA file that contains the contigs you want to analyze should be written at the very end of the command.
--blast-db
: This argument is required The local BLAST database that you want to search your annotated sequences against. See the Set up section above.
-p
or --prokka-dir
: The name of the directory where the Prokka output will be stored. Default = the program will create a sub-directory with the name of the file you are
-t
or --top-hits
: The number of top BLAST hits for each annotated CDS that you want to see in the final report. Default = 10
-r
or --report-out
: The name of the report text file. This is a tab-separated file that you can open in R or Excel. Default = TopBLASThits.txt
I have included a folder with sample data to try the script. The folder contains the following files and directories
-
La_Habana_test.fasta
which contains the 8 segments of the publicly available strain A/swine/La/Habana/130/2010/H1N1 (Genbank Accession numbers HE584753.1 to HE584760.1). -
TopBLASThits.txt
: an example report of the BLAST report of the annotated strain. The version ofblastn
used for this was2.2.28+
. The current version of online BLAST is2.3.1+
. -
A directory called La_Habana_test that has the output of the Prokka annotation process