blast

Humberto Ortiz-Zuazaga humberto at hpcf.upr.edu
Thu Apr 4 05:29:25 EST 2002


marianne.stef at pmtg.u-bordeaux2.fr (Marianne Stef) writes:

> does anybody know if there is a BLAST software that return the sequences
> that didn't blast with any other sequence? 

I had a request for a similar program and wrote a biopython script to
do this, you should be able to feed any blast report test file to this
program and get a list of querys that did not match anything.

--
#!/usr/bin/env python2.2

# standard library
import os
import sys
import string
import getopt

# biopython
from Bio.Blast import NCBIStandalone

def usage():
  print """Usage: pepinoparse -b blastfile

parse a blast report, find any query with no hits, print the query name.
"""
  
### Main

def main():
  try:
    opts, args = getopt.getopt(sys.argv[1:], "hb:", ["help", "blast="])
  except getopt.GetoptError:
    # print help information and exit:
    usage()
    sys.exit(2)
  blast = None
  for o, a in opts:
    if o in ("-h", "--help"):
      usage()
      sys.exit()
    if o in ("-b", "--blast"):
      blast = a

  if blast == None:
    usage()
    sys.exit(1)

  blast_out = open(blast, "r")
  
  b_parser = NCBIStandalone.BlastParser()
  
  b_iterator = NCBIStandalone.Iterator(blast_out, b_parser)
  
  while 1:
    b_record = b_iterator.next()
    
    if b_record is None:
      break

    if len(b_record.alignments) == 0:
      print b_record.query, "had no hits"

##
if __name__ == "__main__":
    main()



-- 
Humberto Ortiz Zuazaga
Programmer-Archaeologist
High Performance Computing facility
University of Puerto Rico
http://www.hpcf.upr.edu/~humberto/

---





More information about the Bio-soft mailing list