Highly recommend against that. I intentionally used the less familiar
and more complex Java object, because it will be significantly more
performant as the string of DNA gets longer.
Java has a String system, for lack of a better term, that is
optimized for speed and memory utilization with
-Original Message-
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 15, 2005 2:07 AM
To: CF-Talk
Subject: Re: reverse compliment a sequence
Highly recommend against that. I intentionally used the less
familiar and more complex Java object, because
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Barney Boisvert wrote:
It ought to do what it's documented to do, which is replace each
instance of the first list's items with the corresponding item from
the second list. It does that very well.
Which can be interpreted two ways.
One is the
You learn something new every day.
Thanks for the explanation, i thought it worked like the TR (translate)
function in unix.
/t
-Original Message-
Subject: reverse compliment a sequence
From: Barney Boisvert [EMAIL PROTECTED]
Date: Tue, 14 Jun 2005 12:33:28 -0700
Thread:
I wish that intelligence and laziness were mutually exclusive!
To hell with that!
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore,
cfset dna = actg /
cfset t = structNew() /
cfset t.c = g /
cfset t.c = c /
cfset t.a = t /
cfset t.t = a /
cfset result = createObject(java, java.lang.StringBuffer) /
cfloop from=1 to=#len(dna)# index=i
cfset result.append(t[mid(dna, i, 1)]) /
/cfloop
cfoutput#result.toString()#/cfoutput
I need to to reverse compliment a nucleotide sequence, so
C become a G
G becomes a C
A becomes a T
T becomes an A
I need to go through a string a character at a time and build a new string.
So:
ACTG becomes TGAC
At first sight, simply
replace (ACTG,TGAC, all)
should do it, but I suspect the
Schneegans [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 14, 2005 11:56 AM
To: CF-Talk
Subject: Re: reverse compliment a sequence
I need to to reverse compliment a nucleotide sequence, so
C become a G
G becomes a C
A becomes a T
T becomes an A
I need to go through a string a character
Offhand, using a placeholder and a series of replace()'s will work:
replace(text, 'g', '|', 'all')
replace(text, 'c', 'g', 'all')
replace(text, '|', 'c', 'all')
replace(text, 'a', '|', 'all')
replace(text, 't', 'a', 'all')
replace(text, '|', 't', 'all')
replacelist() may work. I'm not sure if
);
newdna = replace(newdna,z,g);
/cfscript
Matthew Small
Web Developer
American City Business Journals
704-973-1045
[EMAIL PROTECTED]
-Original Message-
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 14, 2005 2:54 PM
To: CF-Talk
Subject: Re: reverse compliment
I didn't say it was perfect. ;) The replace stuff is a lot better, most likely.
I used a StringBuffer because string manipulation in Java is quite
slow, and by using a buffer I'd circumvent the issue almost
completely.
cheers,
barneyb
On 6/14/05, Matthew Small [EMAIL PROTECTED] wrote:
That
ReplaceList is the same as a series of replace operations. so first
it replaces the C with a G leaving AGTG, then G with C leaving ACTC,
then A with T leaving TCTC, and finally T with A leaving ACAC.
replaceList(ACTG, A,T,Z,G,C,Z, Z,A,T,Z,G,C) should work
cheers,
barneyb
On 6/14/05, RADEMAKERS
-Original Message-
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 14, 2005 3:33 PM
To: CF-Talk
Subject: Re: reverse compliment a sequence
ReplaceList is the same as a series of replace operations. so first
it replaces the C with a G leaving AGTG, then G
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'.
without instantiating java...
cfset newDNA =
cfset iTo = len(dna)
cfloop from=1 to=#iTo# index=i
cfset
-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
the replace idea won't work. it will replace all 'a' with 'z', then
replace all 'z' with 't'
Right. That's how it's supposed to work.
this leads to all 'a' being replaced with 't', not with all 'a' being
replaced with 't'.
Huh?
--Ben
PROTECTED]
Sent: Tuesday, June 14, 2005 3:33 PM
To: CF-Talk
Subject: Re: reverse compliment a sequence
ReplaceList is the same as a series of replace operations. so first
it replaces the C with a G leaving AGTG, then G with C leaving ACTC,
then A with T leaving TCTC, and finally T
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
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
DNA is composed of only those 4 nucleotides, so any other values can't
occur within the string. Hence the temp value solution works. If
not, then you'd have to do the live replace method that your or I
proposed. I suspect my solution would be significantly faster,
particularly over longer
Jeff Congdon wrote:
The replace idea below will work as long as those temporary values don't
exist anywhere in the original string, which seems a risky assumption.
Not knowing the original values though, I can't speak for that.
Since he's looking for a DNA sequence compliment, we know that
cfset outString = replaceList(inString, C,G,A,T, 1,2,3,4) /
cfset outString = replaceList(outString, 1,2,3,4, G,C,T,A) /
Should work.
--
Damien McKenna - Web Developer - [EMAIL PROTECTED]
The Limu Company - http://www.thelimucompany.com/ - 407-804-1014
#include stdjoke.h
Replace is case sensitve, so if it's all one case in the
original string you can do some variation of this:
cfset DNA = ACTGACTG
cfset DNA = Replace(DNA,A,t,all)
cfset DNA = Replace(DNA,C,g,all)
cfset DNA = Replace(DNA,G,c,all)
cfset DNA = Replace(DNA,T,a,all)
cfoutput#Ucase(DNA)#/cfoutput
Ben Doom wrote:
Jeff Congdon wrote:
The replace idea below will work as long as those temporary values don't
exist anywhere in the original string, which seems a risky assumption.
Not knowing the original values though, I can't speak for that.
Since he's looking for a DNA sequence
How about this.
cfscript
newlist = ;
string = A,C,G,C,T,A,C,T;
for(i=1; i LTE listlen(string);i=i+1)
{
idx = listgetat(string,i);
switch(idx)
{
case 'A': newlist = listAppend(newlist,'T');
-Original Message-
From: Ben Doom [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 14, 2005 4:07 PM
To: CF-Talk
Subject: Re: reverse compliment a sequence
Jeff Congdon wrote:
The replace idea below will work as long as those temporary values don't
exist anywhere in the original
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Richard Colman wrote:
I need to to reverse compliment a nucleotide sequence, so
C become a G
G becomes a C
A becomes a T
T becomes an A
I need to go through a string a character at a time and build a new string.
So:
ACTG becomes TGAC
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
RADEMAKERS Tanguy wrote:
Well, i was going to suggest using
cfoutput#ReplaceList(ACTG,C,G,A,T,G,C,T,A)#/cfoutput
but on my system that replaces ACTG with ACAC
i'm confused?
That's 'cause it's riddled with bugs. It ought to work but
that seemed harsh...
Keith Gaughan wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
RADEMAKERS Tanguy wrote:
Well, i was going to suggest using
cfoutput#ReplaceList(ACTG,C,G,A,T,G,C,T,A)#/cfoutput
but on my system that replaces ACTG with ACAC
i'm confused?
That's 'cause it's
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Ray Champagne wrote:
that seemed harsh...
It's not. It *ought* to work something like string-based version of
tr/// in Perl, but doesn't.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird -
It ought to do what it's documented to do, which is replace each
instance of the first list's items with the corresponding item from
the second list. It does that very well.
Whether that particular function is useful at all is up for debate
(I'm on the 'no' side). But it's far from the only
Using Barney's elegant struct solution, we can take it one step further by
creating a UDF and getting rid of the Java by using a new variable and
appending to it:
cfscript
function RevCompDNA(dna) {
var newdna = ;
var t = structNew();
t.c = g;
32 matches
Mail list logo