Entering edit mode
4.0 years ago
rjhowanski
•
0
I have a list of multiple sequences that I am looking to translate into protein (hundreds of sequences). I am trying to translate each of the sequences and create a new column of the translation using Bio.Seq. I can translate a sequence individually, but I am looking to write a loop to translate all the sequences in the dataframe. I am unable to use publically available resources because of IP issues.
With the code below I get the error:
TypeError: The sequence data given to a Seq object should be a string (not another Seq object etc)
The df containing the sequences looks like the following and is titled "translate":
0 ['caggaggtgc...
1 ['cagagggtct...
current code:
for line in translate:
fields = line.split('\t')
sequence_m = fields[:]
if not sequence_m in sequence_m_list:
sequence_m_list.append(sequence_m)
from Bio.Seq import Seq, Alphabet, IUPAC
from Bio.Alphabet import IUPAC
for I in range(len(sequence_m_list)):
seq_m = Seq(sequence_m_list[i])
translated_seq_m = seq_m.translate()
Any insights would be appreciated!
A couple of points on your post:
code
option) to present your post better. You can use backticks for inline code (`text` becomestext
), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.Thank you, very useful! This is my first post and didn't realize these options.
Welcome to the forum! I apologize for the lack of introduction to forum features. We're working on ways for users to get a quick intro to these options while they're making their first post.