Question: BLAST using Biopython
0
gravatar for a.lathifbt
11 months ago by
a.lathifbt20
Chennai, India
a.lathifbt20 wrote:

Hello.I am new to biopython and I am trying to do BLAST search for a single query sequence. This is the script I wrote:

""" BLAST OVER INTERNET """
from Bio.Blast import NCBIWWW
file_name=input("enter the file name:")
filename = open(file_name).read()
result=NCBIWWW.qblast("blastn", "nt", "filename")
from Bio.Blast import NCBIXML
blast_record = NCBIXML.read(result)
print(len(blast_record.alignments))
evalue = 0.01
for alignment in blast_record.alignments:
   for hsp in alignment.hsps:
     if hsp.expect < evalue:
       print("****Alignment****")
       print("sequence:", alignment.title)
       print("length:", alignment.length)
       print("e value:", hsp.expect)
       print(hsp.query[0:75] + "...")
       print(hsp.match[0:75] + "...")
       print(hsp.sbjct[0:75] + "...")

So the issue I am getting is, no result is being generated. The length of the "blast_record_allignments" returns 0 value. Can anyone please help me with it? Thanks in advance

alignment gene • 309 views
ADD COMMENTlink modified 11 months ago • written 11 months ago by a.lathifbt20

Please use 101010 button to format the code. Could you provide a samples fasta sequence you're using for this script?

ADD REPLYlink written 11 months ago by Sej Modha4.7k
2
gravatar for massa.kassa.sc3na
11 months ago by
massa.kassa.sc3na260 wrote:

few problems: You pass the STRING "filename" to the NCBIWWW.qblast call instead of variable.

If the file from input should be FASTA file, then you need to pass file_name variable (without quotes) and the open(..).read() is not necessary.

ADD COMMENTlink modified 11 months ago • written 11 months ago by massa.kassa.sc3na260

Thank you so much! rectified the issue and it's working now.

ADD REPLYlink modified 11 months ago • written 11 months ago by a.lathifbt20

Great. I’ve moved the comment to an answer, so if you’re happy with the resolution to the thread, please go ahead and toggle the Tick to accept the answer as a solution.

ADD REPLYlink written 11 months ago by Joe16k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1251 users visited in the last hour