What is the best way to join multiple Seq objects together into one sequence?
The Biopython tutorial suggests using "+" to join the sequence of two sequence objects:
seq3 = seq1+seq2
But what if I had a list (of arbitrary length) of Seq objects? If they were strings I could simply:
"".join(seq_object_list)
But Seq objects do not have this attribute.
The following will get the job done:
from Bio.Seq import Seq
seq_list = [Seq("ACTG"),Seq("CCCT"),Seq("ACGG"),Seq("CTGA")]
concatenated_seq = Seq("")
for i in seq_list:
concatenated_seq += i
But I figured there might be a more "Pythonic" way of doing things.
Thanks! I guess I was just wondering if there was an equivalent to .join for Seq objects. If there were, would it be faster than converting from Seq object to str and then back to Seq object, as you've done?
Note that gives you a string, not a Seq at the end