Nice one, JE! I think he also wants the characters in reverse order, so
perhaps this slight modification will take care of that:
Public Function ReverseComplement(sInput As String)
Dim sTemp As String
sTemp = UCase(Replace(Replace(Replace(Replace( _
sInput, "A", "u"), "C", "g"), "G", "c"), "U", "a"))
ReverseComplement = StrReverse(sTemp)
End Function
On Mon, 17 Jan 2005 11:43:12 -0700, JE McGimpsey wrote:
Perhaps
Public Function ReverseComplement(sInput As String)
Dim sTemp As String
sTemp = UCase(Replace(Replace(Replace(Replace( _
sInput, "A", "u"), "C", "g"), "G", "c"), "U", "a"))
ReverseComplement = sTemp
End Function
In article ,
M H wrote:
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!