Adamtaranto/quick-ortho-fetch — pull request #2 by darcyabjones (2013-11-12 01:11:26+00:00)
Title: Update: allows multiple query ids to be retrieved and sorted independently

A couple of big changes. The gi| extraction is now much more dynamic as we were working on last week. The loop structure has changed a bit, i am now extracting hits below the threshold for each unique query id into a dictionary object with {QueryID: [(hitID, e-value)]}. Then i find unique hits for each query id and sort them by e-value. Finally the top x number of hit id's for each query id is put into the master list (with conditions excluding items already added), which can then be looped through and retrieved via entrez as before. The major benefit of doing it this way is because we get the top list for each query id independently of each other. But also thinking about the other thing that you were thinking that you might like. It's an easy step to take the dictionary and output a second file of all queryIds, hitIds, and which ones resulted in which etc.

This copy has worked well for me with several .xml files. Let me know what you think.

Cheers, Darcy

nb. type '$ python quickOrtho.py --help' for info on how to execute the script. Feel free to change the flags etc :)