Re: A function of reverse complement
From: GysdeJongh (jongh711_at_planet.nl)
Date: 01/17/05
- Next message: GysdeJongh: "Re: A function of reverse complement"
- Previous message: teresa: "Deleting Repititions"
- In reply to: Tom Ogilvy: "Re: A function of reverse complement"
- Next in thread: Tom Ogilvy: "Re: A function of reverse complement"
- Reply: Tom Ogilvy: "Re: A function of reverse complement"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 17 Jan 2005 23:51:46 +0100
Hi,
sorry did not find the original posting so I answer this one.
I see how you reverse the strand .
I do not understand how you want to complement the strand.
So I can not comment your solution.
But have a solution for the problem if you want.
Feel free to adapt it to your needs.
'This function converts a DNA string to its
'reverse complement
'Gys de Jongh 16-jun-1999
Function Rev(Forw As String) As String
Dim ForwA(1 To 100) As String * 1
Dim RevA(1 To 100) As String * 1
N = Len(Forw)
If N > 100 Then
Rev = "Input too long (max 100)"
Exit Function
End If
For I = 1 To N
ForwA(I) = Mid(Forw, I, 1)
Next I
For I = 1 To N
Select Case ForwA(N - I + 1)
Case "A"
RevA(I) = "T"
Case "a"
RevA(I) = "t"
'From A to T
Case "C"
RevA(I) = "G"
Case "c"
RevA(I) = "g"
'From C to G
Case "G"
RevA(I) = "C"
Case "g"
RevA(I) = "c"
'From G to C
Case "T"
RevA(I) = "A"
Case "t"
RevA(I) = "a"
'From T to A
Case Else
RevA(I) = "N"
'Rest is N
End Select
Next I
For I = 1 To N
Rev = Rev & RevA(I)
Next I
End Function
Short explanation for Tom :
DNA contains the information for cells
It is a double helix with 2 strings , molecules
The two strings contain the same information
They are redundant , one can be used to construct the other
In each string A only pairs with T and C only with G
But :
the Sense strand reads from left to right and
the anti Sense strand from right to left
so :
ACGTCCCTGAAATT <====Sense strand
TGCAGGGACTTTAA <====anti Sense strand
Finding the reverse complement means finding the other if one is known
hth
Gys
"Tom Ogilvy" <twogilvy@msn.com> wrote in message
news:OTuvzMM$EHA.2572@tk2msftngp13.phx.gbl...
> 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" <maurice@boz094.ust.hk> wrote in message
> news:%23WjkeBM$EHA.2540@TK2MSFTNGP09.phx.gbl...
> >
> > 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")
here strSeqA1 etc are just a not declared variables which don't seem to reach
the output of the function ????
> > 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!
>
>
- Next message: GysdeJongh: "Re: A function of reverse complement"
- Previous message: teresa: "Deleting Repititions"
- In reply to: Tom Ogilvy: "Re: A function of reverse complement"
- Next in thread: Tom Ogilvy: "Re: A function of reverse complement"
- Reply: Tom Ogilvy: "Re: A function of reverse complement"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|