After looking more closely, (you didn't say what you error/problem was
exactly and I don't know anything about RNA), I see you have just failed to
assign the result to the function name.
Function ReverseComplement(Rcell As Range)
Dim i As Integer
Dim strReverseSeq As String
Dim strSenseSeq As String
strSenseSeq = Trim(Rcell)
For i = 1 To Len(strSenseSeq)
strReverseSeq = Mid(strSenseSeq, i, 1) & _
strReverseSeq
Next i
strSeqA1 = Replace(strReverseSeq, "A", "1")
strSeqC2 = Replace(strSeqA1, "C", "2")
strSeqG3 = Replace(strSeqC2, "G", "3")
strSeqT4 = Replace(strSeqG3, "U", "4")
strSeq1T = Replace(strSeqT4, "1", "U")
strSeq2G = Replace(strSeq1T, "2", "G")
strSeq3C = Replace(strSeq2G, "3", "C")
strSeq4A = Replace(strSeq3C, "4", "A")
ReverseComplement = strSeq4A
End Function
I don't see any reason for the istext argument as there is no reason to
convert to clng.
--
Regards,
Tom Ogilvy
"Tom Ogilvy" wrote in message
...
As an example
Assume you had a reversed string like AAA
your code would convert it like this
AAA = 111 = UUU
If that is what you want, then Ok. If the problem is you would want 111
as
a result, then I think you need to go to an intermediate stage (two step
process)
AAA = MMM = 111
Where the middle stage would use unique identifiers so you wouldn't
convert
any value after it was converted to a final value.
A to M, M to 1
C to N, N to 2
G to O, O to 3
U to P, P to 4
1 to Q, Q to U
2 to R, R to G
3 to S, S to C
4 to T, T to A
--
Regards,
Tom Ogilvy
"M H" wrote in message
...
I've written an excel function aim to change a RNA sequence to its
reverse complement (e.g. from "ACGUUGUA" to "UACAACGU") as:
Function ReverseComplement(Rcell As Range, Optional IsText As Boolean)
Dim i As Integer
Dim strReverseSeq As String
Dim strSenseSeq As String
strSenseSeq = Trim(Rcell)
For i = 1 To Len(strSenseSeq)
strReverseSeq = Mid(strSenseSeq, i, 1) & _ strReverseSeq
Next i
If IsText = False Then
ReverseComplement = CLng(strReverseSeq)
Else
ReverseComplement = strReverseSeq
End If
strSeqA1 = Replace(strReverseSeq, "A", "1")
strSeqC2 = Replace(strSeqA1, "C", "2")
strSeqG3 = Replace(strSeqC2, "G", "3")
strSeqT4 = Replace(strSeqG3, "U", "4")
strSeq1T = Replace(strSeqT4, "1", "U")
strSeq2G = Replace(strSeq1T, "2", "G")
strSeq3C = Replace(strSeq2G, "3", "C")
strSeq4A = Replace(strSeq3C, "4", "A")
End Function
The first half works fine, which reverse the sequence, but the second
part doesn't work, which cannot make the comoplements Please help for
debug. Much thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!