in reply to Re^11: Comparing 2 different-sized strings
in thread Comparing 2 different-sized strings

Hi, I'm not just looking for the T. For example, if I have the following sequence:
$hay = AACCCAGGATGCGCCATGCAGGACACAGGACGCCACGGAA $nee1 = AGGA $nee2 = CGCCAC
What I want is the following in regular expression:
$hay =~ /($nee1)T[ATGC]($nee2)/
So I only want $nee1 when it is directly followed by a T, some other nucleotide and $nee2. I don't want $nee1 and $nee2 anywhere else.

Replies are listed 'Best First'.
Re^13: Comparing 2 different-sized strings
by BrowserUk (Patriarch) on Aug 18, 2013 at 17:03 UTC
    What I want is the following in regular expression: $hay =~ /($nee1)T[ATGC]($nee2)/

    Then use the regular expression. It is perfect for that usage.

    fuzzyMatch() is not designed for that type of matching.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      I would use the regular expression except the problem is that there may be up to 2 mismatches in $nee1 and/or $nee2. In that case I need to use the fuzzyMatch subroutine don't I? Is there a way to incorporate the fuzzyMatch subroutine, which is perfect for mismatches, into the regular expression?

        Try:

        my $hay = ...; my $nee = 'AGGATACGCCAC'; substr( $hay, $_+4, 1 ) eq 'T' and print substr( $hay, $_, length( $n +ee ) ) for fuzzyMatch( \$hay, \$nee, 3 );

        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.