Skip to content

Parse binary files from NCBI blast or Cblaster into more useful information (tree, table and pie chart)

Notifications You must be signed in to change notification settings

AhmedElsherbini/blastCblast_stats

Repository files navigation

blastCblast_stats

Kindly if you find this repo useful for your work, cite & star this repo

What is this script?

Blast or Cblaster are great tools for finding homologous and co-located homologous respectively. Here, you can break down the long complicated results into a simple result per species, which will count the number of hits per species. Then, it will efetch the number of the assembled genomes per species (via Biopython Enterez based on the NCBI assembly database). Dividing both numbers will hint at the spread of your cluster among different species. Finally, this script will draw a tree based on the pre-defined NCBI taxonomy among your species using ete3 toolkit Finally, merging the results of the database as a pie chart with the tree will give you a nice visualization.

What do you need?

For NCBI Blast (DNA or protein) users, you need the description CSV table as explained here,

alt text

For Cblaster users, You shall have the binary file as easy as I get it like this.

cblaster search --query_file CP018841.1.faa --binary example_binary.csv -bde "," -bhh -bdc 6 -mi 50 -mc 50 -hs 3000

PS: hs is very useful if you have a lot of results due to low coverage mc, low identity search mi. suggested by the last author in this issue.

So, type this command effortlessly.

 python blastcblast_stats.py -i  example_cblaster_binary.csv -og deinococcus_radiodurans

"-i /--input_dir" is your path to the directory for your <BlastN, P ,or Cblaster binary file>

"-og /--outgroup" <optional> is an outgroup species that I know that it is NOT in my results and phylogenetically far from my results. PS: do not forget to use underscore _ in the name of this species.

What about dependencies?

Pandas, Biopython, ete3, argparse

Well, for ete3, I recommend installing it via conda env (even if it takes a lot of time), if the pip does not work properly.

What do you get?

Currently, there are three files.

  1. database_percentage_your_file.csv (The main output where you can find for each species the count of this species in the binary file, the number of assembled genomes per NCBI assembly database, and the percentage of (count/assembly)*100.
  2. your_file_tree.nwk. If you would like to take this tree to a visulization tool (iTOL,FigTree,..)
  3. your_file_tree.pdf. This is just a basic tree that links your isolates together but with a pie chart that shows the results of file number 1. alt text

I hope this helps.

Thanks

About

Parse binary files from NCBI blast or Cblaster into more useful information (tree, table and pie chart)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages