Dear list members

I am a very beginner of perl programming. 
I am trying to write a script to search all scalers of one array (geneIDFile) 
in another file (annotationFile). If it is found and matched, output the whole 
line of the annotation file. 
My script is as follows. It turns out not woking, and I cannot spot out the 
error. Could anyone help me?

#!/usr/bin/perl -w

# This script assigns gene function from specific poplar Gene IDs using  
populus tricocarpa annotation
# USAGE:
# unix command line:
# ./assignGOpoplar.pl candidateGenes.name annotationFile.name 
# e.g. ./assignGOpoplar.pl top4018tags.xls Ptrichocarpa_156_annotation_info.txt
# the script takes the genes number from the first file and finds the 
annotation in the second file
# then outputs a third file with the geneID and annotation


use strict;
use warnings;

my $geneIDfile = shift @ARGV;
my @geneID=(); 
my @logFC=();
my @logCPM=();
my @LR=();
my @Pvalue=();
my @FDR=();

my $i=-1;
open (GENEIDFILE, "$geneIDfile") || die "GENEID File not found\n";
     while (<GENEIDFILE>) {
       chomp;   
       $i++;
       next if ($i==0);
       ($geneID[$i], $logFC[$i], $logCPM[$i], $LR[$i], $Pvalue[$i], $FDR[$i]) = 
split(/\t/, $_);
       
     }
close(GENEIDFILE);


my $j= 1;
my $annotationFile = 
"/Users/olsonmatthew/Desktop/Perl/Ptrichocarpa_156_annotation_info.txt";
open (ANNOTFILE, "<$annotationFile") || die "ANNOTFILE File not found\n";
     while (<ANNOTFILE>) {
       chomp; 
       
       if ($_=~/\n/){
                        if ($_=~/$geneID[$j]/){
                                print "$_\n";
                        }
                        ++$j;
                }
                }
close(ANNOTFILE);
exit;


Best wishes
Li
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to