seperate partial cds from complete cds
1
0
Entering edit mode
6.7 years ago
Bulbul Ahmed ▴ 20

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";
    }
}
perl rna-seq gene • 1.7k views
ADD COMMENT
0
Entering edit mode

As an aside, since you're using Windows, you might want to ensure you're processing line breaks accurately. Newline characters are \r\n in Windows, and your input file or your output file might have different newline characters.

ADD REPLY
0
Entering edit mode

Still not working sir

ADD REPLY
0
Entering edit mode
6.7 years ago
Ram 43k

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?

ADD COMMENT

Login before adding your answer.

Traffic: 2701 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6