I just tested, you can actually perform an all-against-all with just one BLAST query (see my edit).
Hi All, How Can I get local Blast score in matrix format??( I have score but I need in Matrix format) How can I run blast of 200 sequences in order to alignment sequences by writing a python programme.( comparing one by one all sequences one another by blast). regards, Azam
3 answers
edit, to expand on Chris' idea:
You can perform a BLAST search on a multi-FASTA file on itself.
blastp -query my.fasta -subject my.fasta -outfmt 7 # or 6
which yields all pairwise scores that you just need to parse from, e.g. tabular file format or XML using BioPython.
-- old answer, which might still be the cleaner way to do it --
I suggest you look at the following resources:
- bl2seq, which comes with the NCBI BLAST tools: how to input sequence 1 and 2, and how to get the score from the output
- How to call bl2seq from Python
- How nested for loops work, with sequence 1 and 2 as the variables
And, most importantly, show us what you have tried already and where you got stuck. We won't write the program for you, you will have to do this yourself.
As for the "score in Matrix format": a score is a scalar (one value) and a matrix consists of n*m values. Are you asking for a matrix of all pairwise scores?
You can also put all sequences in a single file and blast every individual sequence against that file. (Although you will do every comparison twice in that way).
Have you done it before? It has same results by all align by all??
If your data looks like this:
column 1 : seq 1
column 2 : seq 2
column 3 : Score
then, you'll find many examples on the web by searching for "pivot table". For example see: http://www.unix.com/shell-programming-scripting/155448-create-pivot-table.html
To call blast from python: http://stackoverflow.com/search?q=python++call+program+external
Log in to answer this question.