I want to parse my blast XML results and extract a few things and put them into a new multifasta file as following:
from Bio.Blast import NCBIXML results=open('./results.xml', 'r' ) records=NCBIXML.parse(results) save_file = open("./presults.fasta", "w") for blast_record in records: for alignment in blast_record.alignments: for hsp in alignment.hsps: save_file.write('>%s\n' % (alignment.title, hsp.expect, align_length, hsp.sbjct)) save_file.close()
But thats the error I get.
File "parsing.py", line 10, in <module> save_file.write('>%s\n' % (alignment.title, hsp.expect, hsp.sbjct)) TypeError: not all arguments converted during string formatting
It is important that I get the complete subject sequences out of this.