annotate carpet-src-1/tools/CARPET/annotation_expr_intron.pl @ 0:cdd489d98766

Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author matces
date Tue, 07 Jun 2011 16:50:41 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
1 #!/usr/bin/perl
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
2
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
3 # Copyright 2009 Matteo Cesaroni, Lucilla Luzi
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
4 #
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
5
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
6 # This program is free software; ; you can redistribute it and/or modify
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
7 # it under the terms of the GNU Lesser General Public License as published by
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
8 # the Free Software Foundation; either version 3 of the License, or (at your
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
9 # option) any later version.
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
10 #
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
11 # This program is distributed in the hope that it will be useful,
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
14 # GNU General Public License for more details.
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
15
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
16
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
17
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
18 $|=1;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
19 my $infile = $ARGV[0];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
20 my $infile2=$ARGV[1];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
21 my $file_output=$ARGV[2];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
22
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
23 open (INFILE, "<$infile");
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
24 open (INFILE2, "<$infile2");
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
25 open (OUTFILE1, ">$file_output") or die "Cannot find file $file_output\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
26
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
27 $campi_t=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
28 while (defined (my $line_down = <INFILE2>)) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
29 $line_down=~ s/\#//g;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
30 chomp($line_down);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
31 $campi_t++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
32 my @tmp_down=split(/\s+/, $line_down);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
33 if($campi_t==1){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
34 $z=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
35 foreach $campo_t(@tmp_down){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
36 if(($campo_t eq "name") || ($campo_t eq "qName")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
37 $zRef=$z;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
38 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
39 if(($campo_t eq "txStart") || ($campo_t eq "tStart") || ($campo_t eq "chromStart")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
40 $ztxStart=$z;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
41 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
42 if(($campo_t eq "txEnd") || ($campo_t eq "tEnd") || ($campo_t eq "chromEnd")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
43 $ztxEnd=$z;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
44 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
45 if($campo_t eq "strand"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
46 $zstrand=$z;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
47 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
48 if(($campo_t eq "chrom") || ($campo_t eq "tName")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
49 $zchrom=$z;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
50 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
51 if(($campo_t eq "exonStarts") || ($campo_t eq "tStarts")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
52 $zexonstart=$z;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
53 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
54 if($campo_t eq "exonEnds"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
55 $zexonend=$z;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
56 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
57 if($campo_t eq "blockSizes"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
58 $zblocksize=$z;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
59 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
60 if($campo_t eq "name2"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
61 $zname=$z;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
62 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
63 if(($campo_t eq "exonCount")||($campo_t eq "blockCount")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
64 $zcount=$z;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
65 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
66 $z++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
67 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
68 if(!$zname){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
69 $zname=$zRef;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
70 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
71 if(!$zexonstart){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
72 $zexonstart=$ztxStart;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
73 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
74 if(!$zexonend){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
75 $zexonend=$ztxEnd;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
76 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
77 if(($zRef eq "") || ($ztxStart eq "") || ($zstrand eq "") || ($zchrom eq "")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
78 print "Annotation file is not in the accepted format\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
79 exit;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
80 }else{print "Expression chip annotation";}
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
81 next;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
82 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
83 chomp $tmp_down[$zchrom];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
84 $tab_ann{$tmp_down[$zchrom]}.="$line_down\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
85 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
86
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
87 while (defined (my $line_down = <INFILE>)) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
88 my @tmp_down = split("\t", $line_down);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
89 chomp $tmp_down[0];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
90 $tab_probe{$tmp_down[0]}.=$line_down;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
91 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
92
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
93 @chrom_probes= keys(%tab_probe);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
94
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
95 &expression;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
96
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
97
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
98 exit 0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
99
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
100
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
101 ###########
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
102 #subrutine#
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
103 ###########
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
104
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
105 sub expression
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
106 {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
107 foreach $chromosoma (@chrom_probes){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
108 %gene_cen="";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
109 @file2=split("\n", $tab_ann{$chromosoma});
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
110 foreach $linea(@file2) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
111 chomp $linea;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
112 $linea=~ s/#//g;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
113 my @kEle=split(/\s+/, $linea);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
114 $ref=$kEle[$zRef];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
115 $chrom=$kEle[$zchrom];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
116 $strand=$kEle[$zstrand];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
117 $transcriptStart=$kEle[$ztxStart];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
118 $transcriptStop=$kEle[$ztxEnd];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
119 if($zcount){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
120 $exoncount=$kEle[$zcount];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
121 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
122 else
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
123 {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
124 $exoncount=1;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
125 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
126 $geneName=$kEle[$zname];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
127 $exonStartref=$kEle[$zexonstart];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
128
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
129 my @exonStart=split(",", $exonStartref);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
130
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
131 if (!$zblocksize){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
132 $exonEndref=$kEle[$zexonend];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
133 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
134 else {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
135 @blockStop=split(",", $kEle[$zblocksize]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
136 $exonEndref="";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
137 for ($jj=0; $jj<=$#exonStart; $jj++){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
138 $end_block=$exonStart[$jj]+$blockStop[$jj];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
139 $exonEndref.="$end_block,";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
140
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
141 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
142 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
143
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
144 my @exonStop=split(",", $exonEndref);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
145
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
146 #print @exonStart;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
147
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
148 @file1=split("\n",$tab_probe{$chromosoma});
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
149
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
150 foreach $line(@file1) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
151 chomp $line;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
152 #chop $line;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
153 if ($line=~/track/g){next;}
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
154 if ($line=~/#/g){next;}
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
155 if ($line=~/^\s+$/g){next;}
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
156 my @Line=split(/\t/, $line);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
157 my $Chrom=$Line[0];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
158 my $Start=$Line[3];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
159 my $Stop=$Line[4];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
160 my $ProbeName=$Line[5];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
161 my $feature="ciccio";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
162 if ($Chrom eq $chrom) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
163 if(($Start<=$transcriptStart && $Stop>$transcriptStart) || ($Start<$transcriptStop && $Stop>=$transcriptStop) || ($Start>=$transcriptStart && $Stop<=$transcriptStop) ){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
164 #print "sono entrato con start $Start stop $Stop e $transcriptStart e $transcriptStop\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
165
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
166 for($i=0;$i<=$#exonStart;$i++) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
167 if ($strand eq "+"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
168 $exoncount1=$i+1;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
169 $exoncount2=$exoncount1;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
170 if($i==$#exonStart) {$exoncount2="last";}
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
171 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
172 if ($strand eq "-"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
173 $exoncount1=($#exonStart+1)-$i;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
174 $exoncount2=$exoncount1;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
175 if($i==0) {$exoncount2="last";}
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
176 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
177
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
178 if(($Start<=$exonStart[$i]) && ($i==0) && ($strand eq "+")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
179 $feature="$chrom\t$transcriptStart\t$transcriptStop\t$strand\t$exoncount\tprom_exon $exoncount2\t$exoncount1";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
180 $gene_cen{"$ref\t$geneName"}{$feature}.="$Chrom-$Start,";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
181 last;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
182 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
183 if(($Start<=$exonStop[$i]) && ($i==$#exonStart) && ($strand eq "-") && ($Stop>=$exonStop[$i])){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
184 $feature="$chrom\t$transcriptStart\t$transcriptStop\t$strand\t$exoncount\tprom_exon $exoncount2\t$exoncount1";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
185 $gene_cen{"$ref\t$geneName"}{$feature}.="$Chrom-$Start,";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
186 last;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
187 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
188 if(($Start<=$exonStart[$i]) && ($Stop>$exonStart[$i])){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
189 $feature="$chrom\t$transcriptStart\t$transcriptStop\t$strand\t$exoncount\t*intronexon $exoncount2\t$exoncount1";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
190 $gene_cen{"$ref\t$geneName"}{$feature}.="$Chrom-$Start,";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
191 last;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
192 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
193 if(($Start>=$exonStart[$i]) && ($Stop<=$exonStop[$i])){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
194 $feature="$chrom\t$transcriptStart\t$transcriptStop\t$strand\t$exoncount\texon $exoncount2\t$exoncount1";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
195 $gene_cen{"$ref\t$geneName"}{$feature}.="$Chrom-$Start,";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
196 last;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
197 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
198 if(($Start<$exonStop[$i]) && ($Stop>$exonStop[$i])){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
199 $feature="$chrom\t$transcriptStart\t$transcriptStop\t$strand\t$exoncount\t*exonintron $exoncount2\t$exoncount1";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
200 $gene_cen{"$ref\t$geneName"}{$feature}.="$Chrom-$Start,";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
201 last;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
202 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
203 if(($Start>=$exonStop[$i]) && ($Stop<=$exonStart[$i+1]) && ($check==0)){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
204 $feature="$chrom\t$transcriptStart\t$transcriptStop\t$strand\t$exoncount\tintron $exoncount2\t$exoncount1";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
205 $gene_cen{"$ref\t$geneName"}{$feature}.="$Chrom-$Start,";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
206 last;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
207 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
208
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
209 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
210
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
211
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
212 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
213
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
214 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
215
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
216 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
217 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
218
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
219 foreach $nome (keys %gene_cen){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
220 foreach $description (keys %{$gene_cen {$nome}}) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
221 print OUTFILE1 "$nome\t$description\t$gene_cen{$nome}{$description}\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
222
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
223 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
224
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
225 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
226 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
227 close INFILE;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
228 close INFILE2;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
229 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
230
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
231
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
232