Question: seperate partial cds from complete cds
0
gravatar for Bulbul Ahmed
18 months ago by
Bulbul Ahmed20
United States
Bulbul Ahmed20 wrote:

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";
    }
}
rna-seq gene perl • 681 views
ADD COMMENTlink modified 18 months ago by RamRS20k • written 18 months ago by Bulbul Ahmed20

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 REPLYlink written 18 months ago by RamRS20k

Still not working sir

ADD REPLYlink written 18 months ago by Bulbul Ahmed20
0
gravatar for RamRS
18 months ago by
RamRS20k
Houston, TX
RamRS20k wrote:

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 COMMENTlink written 18 months ago by RamRS20k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1789 users visited in the last hour