make a perl script to read 20 characters upstream from the codon ATG?

Dulce

New member
Write a Perl program that given a DNA string, prints out the 20 characters upstream of the start codon ATG. That is, given: $dna = "CCCCATAGAGATAGAGATAGAGAACCCCGCGCGCTCGCATGGGG"; print out: The 20 bases upstream of ATG are AGAGAACCCCGCGCGCTCGC

The following script is what I have,

Code:
print "\nThis program will read 20 characters upstream from the codon ATG in the given sequence.\n
Please, input your sequence: ";
my $sequence = <>;
chomp $sequence;

if ($sequence=~ m/ATG/g) {
    print "The sequence is $sequence";
} else {
    print "The given sequence doesn not contain ATG.\n"
}


exit;
 


Write your reply...
Back
Top