[Biopython] Concatenate all the sequences with same gene name

sunwm9 sunwm9 at tom.com
Fri Jul 17 09:50:06 UTC 2015


<pre><strong style="font-family: Arial, Verdana, sans-serif;"><br /></strong></pre><pre><span style="font-family: Arial, Verdana, sans-serif;">Dear all,</span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;">I am new self-educator of Biopython. I would like to concatenate fasta sequences (file attached) with same gene name using SeqIO.parse() function.&nbsp;</span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;">Here is a snippet from my code:</span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;"><br /></span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;"><em>seq_all = ' '</em></span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;"><em>for cur_record in SeqIO.parse('nucleotide_seq.fasta', "fasta") :</em></span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;"><em>     if cur_record.name == 'B103':</em></span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;"><em>         seq_all = seq_all + str(cur_record.seq)</em></span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;"><em>      print seq_all</em></span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;"><em><br /></em></span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;">It need to change the gene name every time. How can I </span><span style="font-family: Arial, Verdana, sans-serif;">concatenate all the sequences with same gene name automatically.</span></pre><pre>&lt;ribozyme at ioz.ac.cn&gt;<br /></pre><pre><span style="font-family: Arial, Verdana, sans-serif;">Best regards,</span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;">Weiming Sun </span></pre><pre><span style="font-family: Arial, Verdana, sans-serif;"><br /></span></pre>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20150717/9ff425a7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nucleotide_seq.fasta
Type: application/octet-stream
Size: 11942 bytes
Desc: not available
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20150717/9ff425a7/attachment.obj>


More information about the Biopython mailing list