Hi Glen,<br>thanks for your response. I am afraid i did not present the problem with clarity in my original query. The more generalized query is what if:<br><br>z = &#39;ATC/GACTGAGC/TAG&#39;<br> <br>and  i want<br>zlist = [&#39;ATC/G&#39;,&#39;ACT&#39;,&#39;GAG&#39;,&#39;C/TAG&#39;]<br>
<br>The biology behind this is not as what you have understood. Here is the problem for you and others interested (i am simplying this as much as i can since i dont know your biological background):<br>&#39;C/G&#39; and &#39;C/T&#39; are SNPs (single nucleotide polymorphisms, which can be thought of simply as &#39;change&#39;) in a particular genome being studied when compared to the NCBI reference genome. A specific nucleotide (say &#39;A&#39;) is being represented by two alternative nucleotides (say &#39;A/G&#39;) in the genome being investigated. The alternative nucleotides could occur because at that position there is a difference in the coding and complementary DNA strands (think of this as a difference between the paternal and maternal DNA strands at that position).<br>
<br>When i take the exon regions of a gene (that are making proteins)  in the genome being studied i need to break up the dna string corresponding to the exon region in groups of  three to get the codons and then find the corresponding amino acid sequence using the genetic code. In doing this i want something like &#39;A/G&#39; to be taken as a single character. [&#39;AT/CG&#39;] will be then correspond to two alternative amino acids corresponding to ATC and ATG. [ATG (DNA) corresponds to AUG(mRNA). ]  <br>
<br><div class="gmail_quote">On Thu, Aug 5, 2010 at 9:31 PM, Glen Jarvis <span dir="ltr">&lt;<a href="mailto:glen@glenjarvis.com">glen@glenjarvis.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Vikram,<div><div class="im"><br><div>    I recognize this domain in many of the questions that have been asked. There are several times where I&#39;ve thought, &quot;That *so* isn&#39;t the most ideal &#39;Computer Science&#39; way to do something.&quot; But, I also recognize that, especially in the Biological world, we have no control how we receive the data and thus, we still have to solve problems like those reviewed.</div>

<div><br></div><div>   So, I normally don&#39;t challenge the base assumption in the question because I know from experience, we don&#39;t always get the most ideal inputs to work with. HOWEVER, I do want to challenge this one because I know there&#39;s a standard way that this is represented in the Biological community without using three characters for a single base. I recognize your original question of z = &#39;AT/CG&#39; to mean, In Biological terms, that:</div>

<div><br></div><div>&quot;Zee equals the string of three nucleotide bases. The first base is Adenine. The second base is either Thymine or Cytosine. The third base is Guanine.&quot;</div><div><br></div><div>There&#39;s a *much* better (and commonly accepted) way to represent this.</div>

<div><br></div><div>The way this is traditionally is represented is with the extended genetic alphabet (<a href="http://www.hrbc-genomics.net/training/bcd/Curric/PrwAli/node7.html" target="_blank">http://www.hrbc-genomics.net/training/bcd/Curric/PrwAli/node7.html</a>). In this case, the middle base would be represented by the letter Y as that means either Thymine or Cytosine. </div>

<div><br></div><div>I feel it&#39;s much better to represent this as:</div><div><br></div><div>z = &#39;AYG&#39;</div><div><br></div><div>Then, the string will work without any expected manipulations. I would always work with the alphabet and not put the three character string back in as this alphabet is defined and accepted in the community. However, if one wanted to they still could later represent this in a &#39;lookup dictionary&#39; such as follows if the output ever needed to be in a the format in question.</div>

<div><br></div><div>lookup = {&#39;R&#39;: &#39;G/A&#39;,</div><div>              &#39;Y&#39;: &#39;T/C&#39;, </div><div>              &#39;M&#39;: &#39;A/C&#39;,....}</div><div><br></div><div>Cheers,</div><div><br></div>

<div><br></div><div>Glen</div><div>               </div></div><div><br><div class="gmail_quote"><div class="im">On Wed, Aug 4, 2010 at 9:37 PM, Vikram K <span dir="ltr">&lt;<a href="mailto:kpguy1975@gmail.com" target="_blank">kpguy1975@gmail.com</a>&gt;</span> wrote:<br>

</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">Suppose i have this string:<br>z = &#39;AT/CG&#39;<br>
<br>How do i get this list:<br><br>zlist = [&#39;A&#39;,&#39;T/C&#39;,&#39;G&#39;]<br>
<br>
<br></div></div><div class="im">_______________________________________________<br>
Baypiggies mailing list<br>
<a href="mailto:Baypiggies@python.org" target="_blank">Baypiggies@python.org</a><br>
To change your subscription options or unsubscribe:<br>
<a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/mailman/listinfo/baypiggies</a><br></div></blockquote></div><br><br clear="all"><div class="im"><br>-- <br>Whatever you can do or imagine, begin it;<br>

boldness has beauty, magic, and power in it.<br><br>-- Goethe <br>
</div></div></div>
</blockquote></div><br>