4 temp values is overkill.  You only need 2 (one for the a<->z and one
for the g<->c; you can actually use the same char for both).

atgcacgt

a->z : ztgczcgt
t->a : zagczcga
z->t : tagctcga
g->z : tazctcza
c->g : tazgtgza
t->c : tacgtgca

atgcacgt
tacgtgca

So, you get the correct compliment.

--Ben

Dawson, Michael wrote:
> Replace() will work if you use *four* temporary values.
> 
> Replace 'a' with '1'
> Replace 'c' with '2'
> Replace 'g' with '3'
> Replace 't' with '4'
> 
> Then
> 
> Replace '1' with 't'
> Replace '2' with 'g'
> Replace '3' with 'c'
> Replace '4' with 'a'
> 
> Then, you mix in some love and you have a dino-baby.
> 
> M!ke
> 
> -----Original Message-----
> From: Jeff Congdon [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, June 14, 2005 2:41 PM
> To: CF-Talk
> Subject: Re: reverse compliment a sequence
> 
> the replace idea won't work.  it will replace all 'a' with 'z', then
> replace all 'z' with 't'
> 
> this leads to all 'a' being replaced with 't', not with all 'a' being
> replaced with 't'.
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209470
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to