thanks but I need to keep it in alignment object and I'm not sure you can pull a SeqRecord out and replace it
Edit a single base in SeqRecord object in Biopython?
I just want to edit a single base in one sequence in my single alignment. I read in the alignment file (ie needle-wunsch file) with SeqIO library and I get SeqRecord object. Problem is I know how to edit with .tomutable() for Seq objects but I am not sure how to do that with SeqRecord as it does not have the same function.
Do I have to slice to that position and make a single column SeqRecord object and swap it out at that position with splicing functions?
• 2,918 views
•
link
1 answer
May be you can try converting the SeqRecord into a Python string:
>>> from Bio.Seq import Seq
>>> sequence=Seq('GCTACGATCGACTAGCTACGATCAGCATCGATC')
>>> type(sequence)
<class 'Bio.Seq.Seq'>
>>> string_sequence=str(sequence)
>>> string_sequence
'GCTACGATCGACTAGCTACGATCAGCATCGATC'
>>> type(string_sequence)
<type 'str'>
And then do whatever you want to do with the string: See this
• 0 views
•
link
• 0 views
•
link
Log in to answer this question.