text: user7353: I have tried to incorporate blast in my application using biopython.i could extract the blast results but now i want to extract the structure file corresponding matches. My code is :
  from Bio.SeqIO import parse 
  from Bio.SeqRecord import SeqRecord 
  from Bio.Seq import Seq 
  
  file = open("prats.fasta") 
  
  records = parse(file,"fasta") 
  for record in records:   
      print("Id: %s" % record.id) 
      print("Name: %s" % record.name) 
      print("Description: %s" % record.description) 
      print("Annotations: %s" % record.annotations) 
      print("Sequence Data: %s" % record.seq) 
      print("Sequence Alphabet: %s" % record.seq.alphabet)
  
  from Bio.Blast import NCBIWWW
  sequence_data = open("prats.fasta").read() 
  sequence_data 
  
  result_handle = NCBIWWW.qblast("blastn", "nt", sequence_data) 
  result_handle
  
  with open('results.xml', 'w') as save_file:
      blast_results = result_handle.read()
      print(blast_results)
      save_file.write(blast_results)
  
  from Bio.Blast import NCBIXML
  E_VALUE_THRESH = 1e-20 
  for record in NCBIXML.parse(open("results.xml")): 
      if record.alignments: 
          print("\n") 
          print("query: %s" % record.query[:100]) 
          for align in record.alignments: 
              for hsp in align.hsps: 
                  if hsp.expect < E_VALUE_THRESH: 
                      print("match: %s " % align.title[:100])
  
  
  from here i want to generate the xml files and then fetch structure of each nucleotides results
  
  user6322: If you the DNA/RNA crystal structure:
  Simply change the nt in NCBIWWW.qblast("blastn", "nt", sequence_data) to pdbnt to get the nucleotide sequence in a chain.
  The PDB code will be the accession ID with an underscore plus chain letter.
  Do note that the PDB structure may be offset.
  If you want the crystal structures of the encoded protein:
  blastx (translation) on the pdbaa database. As above the PDB code will be as above.
  If you want a model of the encoded protein:
  Check Swissmodel for a pre-existing close threaded model, else check out I-Tasser (best), Phyre (fast).
  If you want a model of the DNA/RNA:
  You are running blast without special settings —its not a short motif—, so these things may be long, so do be weary of any result. There are a few RNA folding prediction tools online (e.g. RNAFold).
  
original_text: 7353: <p>I have tried to incorporate blast in my application using biopython.i could extract the blast results but now i want to extract the structure file corresponding matches. My code is :</p>
  
  <pre><code>from Bio.SeqIO import parse 
  from Bio.SeqRecord import SeqRecord 
  from Bio.Seq import Seq 
  
  file = open("prats.fasta") 
  
  records = parse(file,"fasta") 
  for record in records:   
      print("Id: %s" % record.id) 
      print("Name: %s" % record.name) 
      print("Description: %s" % record.description) 
      print("Annotations: %s" % record.annotations) 
      print("Sequence Data: %s" % record.seq) 
      print("Sequence Alphabet: %s" % record.seq.alphabet)
  
  from Bio.Blast import NCBIWWW
  sequence_data = open("prats.fasta").read() 
  sequence_data 
  
  result_handle = NCBIWWW.qblast("blastn", "nt", sequence_data) 
  result_handle
  
  with open('results.xml', 'w') as save_file:
      blast_results = result_handle.read()
      print(blast_results)
      save_file.write(blast_results)
  
  from Bio.Blast import NCBIXML
  E_VALUE_THRESH = 1e-20 
  for record in NCBIXML.parse(open("results.xml")): 
      if record.alignments: 
          print("\n") 
          print("query: %s" % record.query[:100]) 
          for align in record.alignments: 
              for hsp in align.hsps: 
                  if hsp.expect &lt; E_VALUE_THRESH: 
                      print("match: %s " % align.title[:100])
  
  </code></pre>
  
  <p>from here i want to generate the xml files and then fetch structure of each nucleotides results</p>
   6322: <h2>If you the DNA/RNA crystal structure:</h2>
  
  <p>Simply change the <code>nt</code> in <code>NCBIWWW.qblast("blastn", "nt", sequence_data)</code> to <code>pdbnt</code> to get the nucleotide sequence in a chain.
  The PDB code will be the accession ID with an underscore plus chain letter.
  Do note that the PDB structure may be offset.</p>
  
  <h2>If you want the crystal structures of the encoded protein:</h2>
  
  <p><code>blastx</code> (translation) on the <code>pdbaa</code> database. As above the PDB code will be as above.</p>
  
  <h2>If you want a model of the encoded protein:</h2>
  
  <p>Check Swissmodel for a pre-existing close threaded model, else check out I-Tasser (best), Phyre (fast).</p>
  
  <h2>If you want a model of the DNA/RNA:</h2>
  
  <p>You are running blast without special settings —its not a short motif—, so these things may be long, so do be weary of any result. There are a few RNA folding prediction tools online (e.g. RNAFold).</p>
  