Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Neelam Jha's questions

  • Neelam Jha
    3938 days ago
    Questions (2)

    Hi Bioinformatician, I am working on a small script which read a file and extract the gene coordinates. It works fine when I run on linux OS but in Window OS it print some weird sign, and also does not print the expected result. Following are the code for your reference.

    #!/usr/bin/perl
    use strict;
    use warnings;

        my $fileIn = $ARGV[0];
        my $OutFile = $ARGV[1];
        open my $fh, '<', $fileIn or die "could not open $fileIn for read\n";
        open OUTFILE, ">" , $OutFile or die "$0: open $OutFile: $!";
        while (<$fh>) {
        chomp $_;
        my $line=trim($_);
        $line =~ s/(\.\.|\s+)/\t/g;
        $line =~ s/\(|\)/\t/g;
        my $number=$.;
        my @tmp=split /\t/, $line;
        if($tmp[2] ne 'complement') {
            my @newtmp = split(/gene/, $line);
            my $newline=$newtmp[1];
            my @tmp2=split /\t/, $newline;
            my $head="gene";
            print OUTFILE "$number\t$head\t\t$tmp2[1]\t$tmp2[2]\n";
            }
        else {
            print OUTFILE "$number\t$tmp[1]\t$tmp[2]\t$tmp[3]\t$tmp[4]\n";
            }
    }

    # Perl trim function to remove whitespace from the start and end of the string
    sub trim($) {
        my $string = shift;
        $string =~ s/^[\t\s]+//;
        $string =~ s/[\t\s]+$//;
        return $string;
    }

  • Neelam Jha
    3941 days ago
    Questions (3)

    We always need to keep track of all the Perl modules, and install new one if required. Generally, whenever we run the Perl script it flash error message with the name of module not installed. I would like to know the quicker way to check the installed modules on any system/server.