Translate Multiple Sequences With Bio.Seq
0
0
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!

sequence python • 1.2k views
ADD COMMENT
0
Entering edit mode

A couple of points on your post:

  1. This is a Question-type post, not a Forum discussion. I've made the necessary change. To learn more, please read posts under the how-to tag.
  2. Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), 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.
    code_formatting
ADD REPLY
0
Entering edit mode

Thank you, very useful! This is my first post and didn't realize these options.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 1510 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6