annotate multi_join_left/addColumnsFromFile2ToFile1.pl @ 5:1de2a8f041b3 draft

Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
author mir-bioinf
date Tue, 21 Apr 2015 16:20:03 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
1 #! /usr/bin/perl -w
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
2 #===============================================================================
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
3 #
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
4 # FILENAME: addColumnsFromFile2ToFile1.pl
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
5 #
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
6 # USAGE: see -help
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
7 #
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
8 # DESCRIPTION: This program adds columns in File 2 to File 1,
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
9 # if there are correnponding entries in File 1
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
10 #
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
11 # AUTHOR: Ron Stewart
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
12 # VERSION: 1.1
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
13 # CREATED: 12/18/06 CDT
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
14 #===============================================================================
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
15
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
16 use lib '/opt/galaxy/galaxy-dist/tools/ngs_rna/Unreleased'; ##CMS ADDED 11-05-14, DIR CONTAINS CUSTOM MODULE
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
17
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
18 use strict;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
19 use IO::File;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
20 use GetOptWC;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
21 # parsing the command line
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
22 my %optVarsIn = ();
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
23 # help information
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
24 $optVarsIn{'File1'} = './File1.txt`=s`Input file of genes to include';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
25 $optVarsIn{'File2'} = './File2.txt`=s`Input file to be added';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
26 $optVarsIn{'cola1'} = '2`=f`first column to look for match in File1';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
27 $optVarsIn{'colb1'} = '4`=f`second column to look for match in File1';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
28 $optVarsIn{'cola2'} = '2`=f`first column to look for match in File2';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
29 $optVarsIn{'colb2'} = '4`=f`second column to look for match in File2';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
30 $optVarsIn{'file1FirstColToCopy'} = '-1`=f`first column to copy in File1';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
31 $optVarsIn{'file1LastColToCopy'} = '-1`=f`last column to copy in File1';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
32 $optVarsIn{'file2FirstColToCopy'} = '-1`=f`first column to copy in File2';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
33 $optVarsIn{'file2LastColToCopy'} = '-1`=f`last column to copy in File2';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
34 $optVarsIn{'HelpPrefix'} = 'This script is for adding entries in File2 to the corresponding entries in File1.';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
35 $optVarsIn{'HelpSuffix'} = 'example call: ./addColumnsFromFile2ToFile1.pl -File1=./esAndDiffMarkersWithSage20061211.txt -cola1=2 -calb1=4 -File2=./pan_whole_table_fold_ann.txt -cola2=1 -colb2=4`Note: Two input files should have title lines`NOTE:Files must be text files, NOT .xls files. If you have an .xls file, save it as "Text(Windows) in Excel.';
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
36 my %retVars = ();
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
37 my $retVarsRef = GetOptWC::getOptions(\%optVarsIn);
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
38 %retVars = %$retVarsRef;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
39 if ($retVars{'HelpCalled'}) {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
40 print "exiting now, help called\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
41 exit;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
42 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
43 my $File1 = $retVars{'File1'};
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
44 my $FHFile1;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
45 $FHFile1 = IO::File->new("<$File1");
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
46
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
47 my $File2 = $retVars{'File2'};
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
48 my $FHFile2;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
49 $FHFile2 = IO::File->new("<$File2");
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
50 my $File1name = $File1;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
51 print "file1name: $File1name\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
52 $File1name =~ s/[\.\/]/_/g;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
53 print "file1name: $File1name\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
54
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
55 my $File2name = $File2;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
56 $File2name =~ s/[\.\/]/_/g;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
57 #my $Out = $File1name.'.'.$File2name; # this can be too long in some cases
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
58 my $Out = "file1_file2.txt";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
59 print" out is $Out\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
60 my $OutFile = IO::File->new(">$Out");
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
61 my $cola1 = $retVars{'cola1'};
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
62 my $colb1 = $retVars{'colb1'};
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
63 my $cola2 = $retVars{'cola2'};
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
64 my $colb2 = $retVars{'colb2'};
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
65 my $firstColFile1 = $retVars{'file1FirstColToCopy'};
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
66 my $lastColFile1 = $retVars{'file1LastColToCopy'};
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
67 my $firstColFile2 = $retVars{'file2FirstColToCopy'};
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
68 my $lastColFile2 = $retVars{'file2LastColToCopy'};
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
69 my %genes2 = ();
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
70 my %genes4 = ();
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
71 my %genes4key = ();
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
72 my $lineCtr = 0;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
73 my @cols = ();
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
74 my $firstLineFile2 = $FHFile2->getline();
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
75 $firstLineFile2 =~ s/\s+$//;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
76 @cols = split "\t",$firstLineFile2;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
77 my $numColFile2 = @cols;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
78 if($firstColFile2==-1){
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
79 $firstColFile2 = 0;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
80 $lastColFile2 = $numColFile2-1;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
81 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
82 my @titleFile2 = @cols[$firstColFile2..$lastColFile2];
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
83 while (my $line = $FHFile2->getline()) {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
84 $lineCtr++;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
85 #$line =~ s/\s+$//;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
86 $line =~ s/\R//g; ##CMS 11-6-14
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
87 chomp($line);
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
88 @cols = split "\t",$line;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
89 my $numCols = (@cols + 0);
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
90
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
91 #$cols[$cola2] = uc($cols[$cola2]); ##CMS 11-6-14
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
92 #$cols[$colb2] = uc($cols[$colb2]); ##CMS 11-6-14
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
93 $cols[$cola2] =~ s/ //g;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
94 my $colsBSymbol = "";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
95 if ($cols[$colb2] =~ /\"{0,1}CDS\; ([^\;]+);/) {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
96 $colsBSymbol = $1;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
97 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
98 else {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
99 #if ($numCols == ($colb2 +1)) { ##CMS COMMENTED OUT 11-6-14
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
100 #print "$line\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
101 #print "Please check this line\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
102 #exit;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
103 #} ##CMS END COMMENTS 11-6-14
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
104 $cols[$colb2] =~ s/ //g;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
105 $colsBSymbol = $cols[$colb2];
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
106 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
107 if($numCols<$lastColFile2){
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
108 for(my $i = $numCols;$i<$lastColFile2;$i++){
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
109 $cols[$i] = "";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
110 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
111 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
112
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
113 $genes2{$cols[$cola2]} = join("\t",@cols[$firstColFile2..$lastColFile2]);
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
114 $genes4{$colsBSymbol}->{$cols[$cola2]} = join("\t",@cols[$firstColFile2..$lastColFile2]);
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
115 $genes4key{$colsBSymbol}="x";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
116 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
117 print "linectr: $lineCtr\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
118 $lineCtr = 0;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
119 @cols = ();
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
120 my $firstLineFile1 = $FHFile1->getline();
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
121 $firstLineFile1 =~ s/\s+$//;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
122 @cols = split "\t",$firstLineFile1;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
123 my $numColFile1 = @cols;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
124 if($firstColFile1==-1){
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
125 $firstColFile1 = 0;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
126 $lastColFile1 = $numColFile1-1;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
127 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
128 #print "numcolsfile1: $numColFile1\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
129 #print "lastcolsfile1: $lastColFile1\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
130
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
131 my @titleFile1 = @cols[$firstColFile1..$lastColFile1];
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
132 #print "tf1: @titleFile1\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
133 #print "tf2: @titleFile2\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
134 #print "outfile: $OutFile\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
135
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
136 print $OutFile join("\t",@titleFile1)."\t".join("\t",@titleFile2)."\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
137 #my $numCol = $lastColFile1 - $firstColFile1 +1;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
138 my $numCurrentLine =0;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
139 while (my $line = $FHFile1->getline()) {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
140 $lineCtr++;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
141 $line =~ s/\s+$//;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
142 my $selectedEntries;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
143 @cols = split "\t",$line;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
144 $numCurrentLine = $#cols;#[$firstColFile1..$LastColFile1];
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
145 #print "numcurrentline: $numCurrentLine\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
146 $line = $line."\t";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
147 if($numCurrentLine<$lastColFile1){
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
148 #print "in if\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
149 for(my $i =$numCurrentLine+1;$i<=$lastColFile1;$i++){
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
150 #print "in for. i=$i\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
151 $cols[$i]="";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
152 #$line = $line."\t";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
153 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
154 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
155 $selectedEntries = join("\t",@cols[$firstColFile1..$lastColFile1]);
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
156 my $numCols = (@cols + 0);
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
157 #$cols[$cola1] = uc($cols[$cola1]); ##CMS 11-6-14
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
158 #$cols[$colb1] = uc($cols[$colb1]); ##CMS 11-6-14
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
159 $cols[$cola1] =~ s/ //g;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
160 my $colsBSymbol = "";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
161 if ($cols[$colb1] =~ /\"{0,1}CDS\; ([^\;]+);/) {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
162 $colsBSymbol = $1;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
163 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
164 else {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
165 #if ($numCols == ($colb1 +1)) { ##CMS COMMENTED 11-6-14
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
166 # print"$line";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
167 # print " please check this line\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
168 # exit;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
169 #} ##CMS END COMMENTS 11-6-14
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
170 $cols[$colb1] =~ s/ //g;
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
171 $colsBSymbol = $cols[$colb1];
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
172 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
173 if((exists ($genes2{$cols[$cola1]}) and $cols[$cola1] ne "N/A") or (exists ($genes2{$colsBSymbol}) and $colsBSymbol ne "N/A") ) {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
174 if (exists ($genes2{$cols[$cola1]})) {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
175 print $OutFile "$selectedEntries"."\t".$genes2{$cols[$cola1]}."\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
176 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
177 elsif (exists ($genes2{$colsBSymbol})) {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
178 print $OutFile "$selectedEntries"."\t".$genes2{$colsBSymbol}."\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
179 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
180 else {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
181 print "WHOA, we've got a problem Here!!!!!\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
182 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
183 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
184 elsif(exists ($genes4key{$colsBSymbol}) and $colsBSymbol ne "N/A" ) {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
185 foreach my $symbol (keys %{$genes4{$colsBSymbol}}){
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
186 print $OutFile "$selectedEntries"."\t".$genes4{$colsBSymbol}->{$symbol}."\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
187 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
188 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
189 else {
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
190 print $OutFile "$selectedEntries"."\n";
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
191 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
192 }
1de2a8f041b3 Corrected xml syntax errors in config file, added missing pl script and output dataset to test-data
mir-bioinf
parents:
diff changeset
193 exit;