Entering edit mode
8.2 years ago
joreamayarom
▴
140
I am using SeqIO to load a fasta file and play my sequences. For the sake of my analysis, I want to eliminate a fixed number of bases to the left and right of my sequences. Nevertheless, whenever I try to eliminate the last ten bases I get an error saying
sequences = list (SeqIO.parse(file("myfile.fasta"), "fasta")
for sequence in sequences:
del sequence.seq[-10:]
TypeError: 'Seq' object doesn't support item deletion
I assume trimming borders and doing other edits are very basic functionalities in bioinformatics (the same can be done in Perl in a couple of lines) but I am bit surprised I can't find a method to do such things in Python because the Seq objects are immutable. Is there a way to trim a Seq object?