Mercurial > repos > matces > carpet_toolsuite
annotate carpet-src-1/tools/CARPET/genecentrico.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 |
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 # 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
|
6 # 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
|
7 # 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
|
8 # 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
|
9 # |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
10 # 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
|
11 # 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
|
12 # 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
|
13 # 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
|
14 |
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 $file_all=$ARGV[0]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
17 $file_sub=$ARGV[1]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
18 $down=$ARGV[2]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
19 $up=$ARGV[6]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
20 $scelta=$ARGV[3]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
21 $result=$ARGV[4]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
22 $output=$ARGV[5]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
23 |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
24 |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
25 open(FILESUB, "<$file_sub") or die "Cannot find file $file_sub\n"; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
26 open(FILEALL, "<$file_all") or die "Cannot open file $file_all: $!\n"; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
27 open(FILEOUT, ">$output") or die "Cannot create file $output: $!\n"; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
28 |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
29 print "Analysis Type=$scelta, Promoter def:$down/$up, output=$result\n"; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
30 |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
31 @sub=<FILESUB>; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
32 @all=<FILEALL>; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
33 foreach $lines_all(@all){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
34 chomp $lines_all; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
35 #chop $lines_all; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
36 if ($lines_all=~/#/g){next;} |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
37 @line_all=split("\t",$lines_all); |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
38 $chr=$line_all[2]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
39 $refseq=$line_all[1]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
40 $refStart=$line_all[3]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
41 $refStop=$line_all[4]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
42 $name=$line_all[0]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
43 #$exon_count=$line_all[8]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
44 #@exonStart=split(",",$line_all[9]); |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
45 #@exonStop=split(",",$line_all[10]); |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
46 $strand=$line_all[5]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
47 if ($scelta eq "promoter"){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
48 if ($strand eq "+"){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
49 $prom_start=$refStart+$down; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
50 $prom_stop=$refStart+$up; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
51 } |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
52 if ($strand eq "-"){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
53 $prom_start=$refStop-$up; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
54 $prom_stop=$refStop-$down; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
55 } |
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 ($scelta eq "all"){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
58 if ($strand eq "+"){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
59 $prom_start=$refStart+$down; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
60 $prom_stop=$refStop; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
61 } |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
62 if ($strand eq "-"){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
63 $prom_start=$refStart; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
64 $prom_stop=$refStop-$down; |
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 } |
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 |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
69 |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
70 @promotore=(); |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
71 $max_prom=0; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
72 foreach $lines_sub(@sub){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
73 chomp $lines_sub; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
74 if ($lines_sub=~/#/g){next;} |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
75 @line_sub=split("\t",$lines_sub); |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
76 $chr_p=$line_sub[0]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
77 $peakStart=$line_sub[3]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
78 $peakStop=$line_sub[4]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
79 $value=$line_sub[5]; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
80 #print "$peakStart\t$peakStop\t$prom_start\t$prom_stop\n"; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
81 #print "$refStart\t$refStop\t$peakStart\t$peakStop\n"; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
82 if (((($peakStart>=$prom_start) && ($peakStart<=$prom_stop)) || (($peakStart<=$prom_start) && ($peakStop>=$prom_start))) && ("$chr" eq "$chr_p")){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
83 push(@promotore,$value); |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
84 #print "cazzo"; |
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 } |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
88 $i=0; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
89 foreach $valore(@promotore){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
90 $i++; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
91 if($max_prom<$valore){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
92 $max_prom=$valore; |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
93 } |
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 if ($result eq "max_value"){ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
96 print FILEOUT "$lines_all\t$max_prom\n"; |
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 else{ |
cdd489d98766
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff
changeset
|
99 print FILEOUT "$lines_all\t$i\n"; |
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 } |