As suggested in the comments, the built-in BioPython pairwise aligner should work for this. You can find a short sequence match in a longer sequence using a global alignment with the right score parameters (query_end_... = 0). The other scoring parameters are values that I've found to be good for aligning similar sequences.
Example code:
from Bio import Align
aligner = Align.PairwiseAligner()
aligner = Align.PairwiseAligner()
aligner.match_score = 5
aligner.mismatch_score = -9
aligner.mode = 'global'
aligner.target_internal_open_gap_score = -12
aligner.target_internal_extend_gap_score = -3
aligner.target_end_open_gap_score = -12
aligner.target_end_extend_gap_score = -3
aligner.query_internal_open_gap_score = -12
aligner.query_internal_extend_gap_score = -3
Set the query_end penalties to zero to effectively implement a 'glocal' alignment as described in the question
These are the default values, so you could skip the next two lines,
but this is relevant to the question, so I'm including them in the example.
aligner.query_end_open_gap_score = 0
aligner.query_end_extend_gap_score = 0
alignments = aligner.align("GAACTCGCATCGATGATCCGTGCGCTGAGATCCGCTGACATGATC", "GATCCG")
for a in alignments:
print(a)
print()
print()
alignments = aligner.align("GAACTCGCATCGATGATCCGTGCGCTGAGATCCGCTGACATGATC", "GATACG")
for a in alignments:
print(a)
print()
print()
alignments = aligner.align("GAACTCGCATCGATGATCCGTGCGCTGAGATCCGCTGACATGATC", "GATACCG")
for a in alignments:
print(a)
Bio.Alignhttp://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc87 – Chris_Rands Aug 15 '18 at 11:22