Share Pastebin
Guest
Public paste!

Bloguero_Connor

By: a guest | Feb 28th, 2008 | Syntax: Python | Size: 0.61 KB | Hits: 13 | Expires: Never
Copy text to clipboard
  1. from Bio import SeqIO
  2. from Bio.Blast import NCBIXML
  3.  
  4. def blastcomp(fastafile,blastfile):
  5.     handle = open(fastafile)
  6.     fastanames=set()
  7.     #Reads the fasta names
  8.     for record in SeqIO.parse(handle, "fasta") :
  9.         fastanames.add(record.name)
  10.     handle.close()
  11.     blastnames=set()
  12.     #Reads the blast names
  13.     b_records=NCBIXML.parse(open(blastfile))
  14.     for b_record in b_records:
  15.         blastnames.add(b_record.query)
  16.     return fastanames.difference(blastnames)
  17.  
  18.  
  19. blastfile="/home/sbassi/bioinfo/INTA/filtracMT.xml"
  20. fastafile='INTA/allfiltrados.txt'
  21. print blastcomp(fastafile,blastfile)