I think he asked something like this.. But I am not clear with his question..
#!/usr/bin/perl -w # change it to ur perl path use strict; my $seq = "ATGCCGCTGGTG"; # sequence my $hops = int(len($seq)/3); my %prob = ("ATT"=>0.1); # triplets to probabilities mapped my $sum = 0; while($k <= $hops) { my $triplet = substr($seq,$k,3); $prob{$triplet}++; $k+=3; } while ( ($triplet,$val) = each %prob ) { print "\n $triplet occured $val times \n"; } -----Original Message----- From: km [mailto:[EMAIL PROTECTED] Sent: Friday, March 05, 2004 4:10 PM To: Sumit Kaur Cc: [EMAIL PROTECTED] Subject: Re: Nucleotide Sequence Hi, can u pls be a bit clear abt the question. are u considering all 6 frames while generating combinations ? u'll have to be comfortable with basics of Perl. As far as i have understood ur question i have made a program. HTH, regards, KM ########## program ##### #!/usr/bin/perl -w # change it to ur perl path use strict; my $seq = "ATGCCGCTGGTG"; # sequence my $hops = int(len($seq)/3); my %prob = ("ATT"=>0.1); # triplets to probabilities mapped my $sum = 0; while($k <= $hops) { my $triplet = substr($seq,$k,3); $sum += $prob{$triplet}; $k+=3; } print $sum; # total ########## program ############## ------------------------------------------------------------- In-Reply-To: <[EMAIL PROTECTED]> On Fri, Mar 05, 2004 at 12:11:25PM -0800, Sumit Kaur wrote: > Hi, > > I have to write my first Perl script . This scripts Searches for rare codons in > nucleotide sequence . The nucleotide sequence is entered by the user in the format > "ATTGCAATT.." and then the scripts breaks this sequence in the groups of three > alphabets like ATT,GCA,ATT...so no.and then I have a list of the combinations and > their probabilites like ATT (34.4) . I compare the breaked sequence against this > list and print out the total that is the sum of all the similar combis > Please suggest . > > Thanks > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>