Hi everyone, Thanks for the advice. They were really helpful. I have tried a different way of approaching my problem and it's now working. However, I do appreaciate all the suggestions that you have provided me.
Henry On Mon, 12 Nov 2001, mark crowe (JIC) wrote: > Hi Henry > > Have you looked at using substr to take each octamer from the start for the > sequence? It's probably a lot more efficient than splitting it into an array > and taking the first 8 bases each time (althought I'm pretty sure that was > exactly the way I did my first DNA scripts too :-) > > Also, if it's any use to you, here is my reverse complement subroutine, > which you could use as the basis of a palindrome checker which tests for any > palindrome, rather than just the restricted set you are using (of course, > those may be all the ones that you're interested in). > > sub complement { > # Reverse complements the supplied string > my $seq = shift; # Get the string > $seq = reverse $seq; # Reverse it (scalar, therefore character reverse) > > # Complement each base (IUPAC codes, upper and lower case) > $seq =~ tr/GATCgatcRYMKrymkSWswHBVDhbvdNn/CTAGctagYRMKyrmkWSwsDVBHdvbhNn/; > > return $seq; > } > > Cheers > > Mark C > > > -----Original Message----- > > From: Henry Hung-Yung Wang [mailto:[EMAIL PROTECTED]] > > Sent: 09 November 2001 15:31 > > To: [EMAIL PROTECTED] > > Subject: simple code > > > > > > > > Hi All, > > > > I have just written some codes, but they are not doing what I > > wanted them > > to do. Here are the codes: > > > > @motif= ('ACGTACGT', 'AAAATTTT', 'CCGGCCGG', 'GGCCGGCC'); > > > > print "Please enter sequences to be examined:\n\n"; > > $dna=<STDIN>; chomp $dna; > > > > @dna=split (//, $dna); > > foreach $bp (0..$#dna-8){ > > $eightmer=join ('', @dna[$bp, $bp+1, $bp+2, $bp+3, $bp+4, > > $bp+5, $bp+6, > > $bp+7]); > > if ($eightmer=~ $motif[0]){ > > print "This sequence, $eightmer, is palindromic\n\n"; > > } else { > > print "There is no other palindromic sequences\n\n"; > > exit; > > } > > } > > > > I am trying to take the input and make them into sequences of > > 8 letters. > > Then I want to match the sequences with the 'motif' defined > > in the codes. > > However, when I run the program, the only motif that was > > recognized was > > 'AAAATTTT'. What am I doing wrong here? Thanks for the help. > > > > Henry > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]