This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BioPython : comparing same sequence with two different databases

I compared query sequence with two different genomes( Genome1 and Genome 2) individually using Standalone BLAST and saved in two different files. Now, I wanted to store these information in following format using python.

Query     Genome 1    Genome 2
gi ID     gi ID 1     gi ID 2
Length    Length      Length
          E-value     E-value
          Score       Score

Somebody have any suggestions to store this information in above format.

Thank you

blast

1 answer

Store it in a dictionary, with the results in a list

>>> query = {'giID': 12345, 'length': 344999, 'genomes': [{'giID':123,'length':3008, 'score': 1 },{'giID':999,'length':500, 'e-value': 0.7}]}

Then to access the query

>>> query
{'length': 344999, 'genomes': [{'length': 3008, 'score': 1, 'giID': 123}, {'length': 500, 'e-value': 0.7, 'giID': 999}], 'giID': 12345}

Access all results

>>> query['genomes']
[{'length': 3008, 'score': 1, 'giID': 123}, {'length': 500, 'e-value': 0.7, 'giID': 999}]

Access the first result only

>>> query['genomes'][0]
{'length': 3008, 'score': 1, 'giID': 123}

You could also store it in a database (SQL or NoSQL) and then extract it from the database in this format.

Log in to answer this question.