How to print the best matching hit while making a BLAST search? / BioPython
0
0
Entering edit mode
4 months ago

Hi everyone,

I need your help with something.

I'm trying to making a BLAST search with a nucleotide sequence and print the best matching hit but not sure about which option/command should I use. There are options like ''max_hpsp'' and ''best_hit_overhang''. I don't have an idea about their differences and I want to print just 1 hit. (best matching one) Should i use '' max_hpsp 1'' ?

I wrote this code but it's still not useful. If you could tell me, where i am mistaken and what should to do, I would be very appreciated :) Thank you!

from Bio.Blast import NCBIWWW
seq = Seq("GTTGA......CT")
def best_matching_hit(seq):
try:
    result_handle = NCBIWWW.qblast("blastn", "nt", seq)
except:
    print('BLAST run failed!')
    return None
blast_record = NCBIXML.read(result_handle)
for hit in blast_record.alignments:
    for hsp in hit.hsps:
        if hsp.expect == max_hsps 1:
            print(hit.title)
            print(hsp.sbjct)

 best_matching_hit(seq)
biopython blast best_hit_overhang max_hpsp hit • 138 views
ADD COMMENT

Login before adding your answer.

Traffic: 2485 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6