2 Replies Latest reply on Mar 13, 2013 8:27 AM by JoelMG

# "Substitute" function not working properly

### Title

"Substitute" function not working properly

### Post

I'd love help on this:  I'd like to take a DNA sequence (composed of A C G and T) and return the "reverse complement".  For example, the reverse complement of "AATTCC" would be "GGAATT" (A and T are complementary; C and G are complementary).  At the moment I'm breaking this up into two steps:

First, I use a "Reverse" command (which I've defined) and I place the result into a new new text field.  This works perfectly.   CCCTTTCGTCTCGCGCG  is reversed to GCGCGCTCTGCTTTCCC .

Last, I need to find the complement, by simply substituting A for T, C for G, G for C, and T for A  in the reversed sequence.  But what I have just is not working correctly:

In the field "Reverse Oligo 1" I have   GCGCGCTCTGCTTTCCC

I use the calculation for a new field:

Substitute (Reverse Oligo 1; ["A" ; "T"] ; ["G" ; "C"] ; ["T"; "A"]; ["C"; "G"])

This yields:   GGGGGGAGAGGAAAGGG

It should yield CGCGCGAGACGAAAGGG .  The "G" to "C" substitution is not working, while the other substitutions are working fine.  I've retyped this several times and switched things around, but it never works.

• ###### 1. Re: "Substitute" function not working properly

It's working correctly, but not as you want it to.

The substitutions get performed one bracketed pair of values at a time from left to right.

First thing it does is substitute "T" for "A"  and then "C" for "G". (["A" ; "T"] ; ["G" ; "C"])

But once that is done it turns around and substitutes "A" for "T" and then "G" for "C" ( ["T"; "A"]; ["C"; "G"] )

To get this to work, you'll need to do something like this:

Substitute (Reverse Oligo 1; ["A" ; "x"] ; ["G" ; "y"] ; ["T"; "A"]; ["C"; "G"]; ["x" ; "T"] ; ["y" ; "C"])

• ###### 2. Re: "Substitute" function not working properly

My goodness, that makes perfect sense!!!!  Thank you.  This will be easy to fix.

Joel