Hi everybody!! I think this is a simplest perl related problem..but still I need your help.
Here's my sample input file:
>blast
ATGGGCCTAC
ATCCACSTAT
Please note that the number of lines could be more than these two, but the Perl script should skip the first line which starts with '>'.
Now the Perl script should take multiple lines as a single line and check if the line starts with ATG and ends with TAT. If this condition is true, then the output should be "gene". Else "not gene".
But my perl script is not taking the whole file. It is taking one line at a time. Here's my script:
#!usr/bin/perl
print "Print your file name with location\n";
$dnafile=<STDIN>;
chomp $dnafile;
open (DNA, $dnafile) || die "Cannot open the file : $!";
while ($dna=<DNA>)
{
chomp ($dna);
### Check Starting not equals to '>' letter
if ($dna=~/^[^>]/)
{
@dna=split ('', $dna);
print "$dna";
}
if (($dna=~/^ATG/) && ($dna=~/TAT$/)) {
print "gene";
}
else {
print "Not gene\n";
}
}
Please let me know how can I improve it?
Thanks