I'm trying to access individual strings in the alignment object which is produced by the pairwise aligner in biopython but not getting anywhere. I'm talking about the already aligned sequences showing gaps, as given by the print(alignment), but trying to get them individually or even slice. The documentation stipulates it's possible but I'm getting errors.
from Bio import Align
aligner = Align.PairwiseAligner(mode='global',gap_score=-5)
my_target= 'CAGGTGCAGCTGGTGCAGAGCGGCGCGGAAGTGAAAAAACCGGGCAGCAGCG'
my_query='CAGTGCAGCTGGTGCAGAGCGACGCGGAAGTGAAAAAACCGGGAGCAGCG'
aln= aligner.align(my_target,my_query)
print(aln[0])
The result is:
CAGGTGCAGCTGGTGCAGAGCGGCGCGGAAGTGAAAAAACCGGGCAGCAGCG
|||-||||||||||||||||||.|||||||||||||||||||||-|||||||
CAG-TGCAGCTGGTGCAGAGCGACGCGGAAGTGAAAAAACCGGG-AGCAGCG
Now, I'd like to get the 'query' sequence in the bottom line individually. I can access the aln[0].query but this seems to be just the naked query seq not as aligned (with gaps).
The documentation stipulates the alignment object should be iterable to slice it but this simply is not working.
What I'm getting is:
aln.alignment[1]
File c:\Anaconda3\lib\site-packages\Bio\Align\__init__.py:1024, in PairwiseAlignment.__getitem__(self, key)
   1022     raise NotImplementedError
   1023 if isinstance(key, int):
-> 1024     raise NotImplementedError
   1025 if isinstance(key, tuple):
   1026     try:
NotImplementedError:
The doc:
I'd appreciate some help, pointers. Cheers.

