seperate partial cds from complete cds
I used the below perl script to remove out the partial cds, but its not working correctly and i am getting a blank output file. Can any body find out the the mistake and kindly correct it.
use strict;
use warnings;
open (fh, '<C:\Users\bulbul\Desktop\New folder\Unigene.transdecoder.cds.txt') or die "file not found,$!";
open (out, ">bulbul.txt");
while (my $line = "Unigene.transdecoder.cds.txt") {
chomp $line;
print "processing $line\n";
my ($id, $rna_sq) = split(/\s+/, $line);
while ($rna_sq =~ /atg/g) {
my $start = pos($rna_sq) - 3;
last $rna_sq =~ /tga|taa|tag/g;
my $stop = pos($rna_sq);
my $genelen = $stop - $start;
my $gene = substr($rna_sq, $start, $genelen);
print "\t" . join(' ', $id, $start+1, $stop, $gene, $genelen) . "\n";
}
}
• 2,311 views
•
link
1 answer
When you have a file handle, the while should be while(<fh>), not what you've used. Can you change that and see if it works?
• 0 views
•
link
Log in to answer this question.
As an aside, since you're using Windows, you might want to ensure you're processing line breaks accurately. Newline characters are
\r\nin Windows, and your input file or your output file might have different newline characters.Still not working sir