i'm trying to use the Biopython PairwiseAligner as such:
from Bio import Align aligner = Align.PairwiseAligner() my_target = "ACTTGATCTTTCGT" my_query = "CTTGATCT" aligner.gap_score = -1 aligner.match = 1 aligner.mismatch = -1 aligner.query_end_gap_score = 0 alignments = aligner.align(my_target, my_query) alignment = alignments print(alignment.aligned)
This should give me a representation of where the alignments occured relative to the other sequence:
Use the aligned property to find the start and end indices of subsequences in the target and query sequence that were aligned to each other. Generally, if the alignment between target (t) and query (q) consists of N chunks, you get two tuples of length N: (((t_start1, t_end1), (t_start2, t_end2), ..., (t_startN, t_endN)), ((q_start1, q_end1), (q_start2, q_end2), ..., (q_startN, q_endN))) In the current example, ‘alignment.aligned‘ returns two tuples of length 2:
>>> alignment.aligned (((0, 2), (4, 5)), ((0, 2), (2, 3)))
However I'm getting this error:
AttributeError: 'PairwiseAlignment' object has no attribute 'aligned'
Can someone please explain where I'm going wrong?