Created
December 12, 2013 18:27
-
-
Save andrewcstewart/7932901 to your computer and use it in GitHub Desktop.
Quick routine for parsing hits out of a blast file using BioPython.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from Bio import SearchIO | |
# usage: parse_blast_hits.py inputfile > outputfile | |
file = sys.argv[1] | |
for qresult in SearchIO.parse(file, 'blast-text'): | |
print("%s" % (qresult.id)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First install BioPython. | |
# If the following doesn't work (ie, you don't have pip installed), | |
# then any of the other methods at http://biopython.org/wiki/Download | |
# should work just as well. | |
pip install biopython |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment