annotate sRNA_plot.pl @ 19:e0884a4b996b draft

Uploaded
author big-tiandm
date Wed, 05 Nov 2014 01:17:26 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
1 #!/usr/bin/perl -w
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
2 #==========================================================================================
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
3 # Date:
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
4 # Title:
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
5 # Comment: Program to plot gene structure
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
6 # Input: 1.
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
7 # 2.
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
8 # 3.
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
9 # Output: output file of gene structure graph by html or svg formt
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
10 # Test Usage:
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
11 #========================================================================================
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
12 #use strict;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
13 my $version=1.00;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
14 use SVG;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
15 use Getopt::Long;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
16 my %opt;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
17 GetOptions(\%opt,"g=s","l=s","span=s","c=s","o=s","out=s","cen:s","mark=s","h");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
18 if (!( defined $opt{o}) || defined $opt{h}) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
19 &usage;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
20 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
21 my $span=$opt{span};
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
22 #my $sample_cloumn=$opt{n};
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
23 my $mark=$opt{mark};
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
24 my @mark=split/\#/,$mark;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
25 my $genelist=$opt{g};
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
26 #===============================Define Attribute==========================================
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
27 my %attribute=(
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
28 canvas=>{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
29 'width'=>1500,
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
30 'height'=>1800
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
31 },
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
32 text=>{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
33 'stroke'=>"#000000",
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
34 'fill'=>"none",
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
35 'stroke-width'=>0.5
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
36 },
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
37 line=>{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
38 'stroke'=>"black",
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
39 'stroke-width'=>1
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
40 },
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
41 csv=>{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
42 'stroke'=>"red",
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
43 'stroke-width'=>0.5
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
44 },
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
45 exon=>{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
46 'stroke'=>"black",
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
47 'stroke-width'=>1
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
48 },
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
49 intron=>{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
50 'stroke'=>"black",
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
51 'stroke-width'=>1.5
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
52 },
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
53 font=>{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
54 'fill'=>"#000000",
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
55 'font-size'=>12,
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
56 'font-size2'=>10,
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
57 #'font-weight'=>'bold',
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
58 'font-family'=>"Arial"
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
59 #'font-family'=>"ArialNarrow-bold"
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
60 },
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
61 rect=>{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
62 'fill'=>"lightgreen",
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
63 'stroke'=>"black",
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
64 'stroke-width'=>0.5
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
65 },
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
66 readwidth=>0.5
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
67 );
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
68 #############################s#define start coordinate and scale
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
69 open(TXT,">$opt{out}");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
70 open(LENGTH,"$opt{l}")||die"cannot open the file $opt{l}";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
71 my %length;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
72 while (my $aline=<LENGTH>) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
73 chomp $aline;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
74 next if($aline=~/^\#/);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
75 my @temp=split/\t/,$aline;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
76 $temp[0]=~s/^c/C/;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
77 $length{$temp[0]}=$temp[1];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
78 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
79 close LENGTH;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
80 #---------------------------------------------------------------
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
81 open(GENE,"$opt{g}")||die"cannot open the file $opt{g}";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
82 my %genelist;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
83 while (my $aline=<GENE>) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
84 chomp $aline;#LOC_Os01g01280 Chr1 133291 134685 +
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
85 next if($aline=~/^\#/);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
86 my @temp=split/\t/,$aline;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
87 if ($temp[1]=~/^Chr(\d)$/) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
88 $temp[1]="Chr0$1";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
89 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
90 push @{$genelist{$temp[1]}},[$temp[0],$temp[2],$temp[3]];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
91
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
92 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
93 close GENE;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
94 #my %have_gene;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
95 #foreach my $chr (sort keys %genelist) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
96 # my @genelist=sort{$a->[1] <=> $b->[1]}@{$genelist{$chr}};
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
97 # my $start=$genelist[0][1];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
98 # my $end=$genelist[0][2];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
99 # for (my $i=0;$i<@genelist ;$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
100 # if ($gene) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
101 # }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
102 # }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
103 #}
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
104
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
105 my %gene_desity;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
106 foreach my $chr (sort keys %genelist) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
107 my @genelist=sort{$a->[1] <=> $b->[1]}@{$genelist{$chr}};
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
108 for (my $i=0;$i<@genelist ;$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
109 my $start=int($genelist[$i][1]/$span);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
110 my $end=int($genelist[$i][2]/$span);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
111 #my @t_rpkm=split/\t/,$target_rpkm{$genelist[$i][0]};
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
112 if ($start==$end) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
113 $gene_desity{$chr}[$start]++;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
114 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
115 else{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
116 for (my $k=$start;$k<=$end ;$k++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
117 $gene_desity{$chr}[$k]++;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
118 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
119 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
120 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
121 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
122 #------------------------------------------region_gene_number-------------------------
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
123 my $max_gene_number=0;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
124 my $total=0;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
125 foreach my $chr (sort keys %genelist) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
126 for (my $i=0;$i<@{$gene_desity{$chr}} ;$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
127 if (!(defined($gene_desity{$chr}[$i]))) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
128 $gene_desity{$chr}[$i]=0;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
129 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
130 if ($gene_desity{$chr}[$i]>$max_gene_number) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
131 $max_gene_number=$gene_desity{$chr}[$i];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
132 #print "$gene_desity{$chr}[$i]\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
133 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
134 #print TXT "$i\t$gene_desity[$i]\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
135 $total+=$gene_desity{$chr}[$i];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
136 #print "$chr\t$i\t$gene_desity{$chr}[$i]\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
137 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
138 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
139 #print "Gene max:$max_gene_number\ntotal:$total\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
140
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
141 #---------------------------------------------------------------
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
142 my %centromere;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
143 if (defined($opt{cen})) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
144 open CEN,"$opt{cen}";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
145 while (my $aline=<CEN>) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
146 chomp $aline;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
147 next if($aline=~/^\#/);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
148 my @temp=split/\t/,$aline;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
149 $temp[0]=~s/^c/C/;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
150 $centromere{$temp[0]}[0]=$temp[1];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
151 $centromere{$temp[0]}[1]=$temp[2];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
152 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
153 close CEN;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
154 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
155
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
156 #---------------------------------------------------------------
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
157 my $max_length=0;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
158 foreach my $chr (keys %length) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
159 if ($max_length<$length{$chr}) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
160 $max_length=$length{$chr};
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
161 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
162 print "$chr\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
163 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
164 #====================================cluster data=======================================
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
165 open(CLUSTER,"$opt{c}")||die"cannot open the file $opt{c}";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
166 my %cluster;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
167 my %cluster_density;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
168 #my @sample=qw(39B3 3PA3 3LC3);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
169 my @cluster_non_add;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
170 while (my $aline=<CLUSTER>) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
171 next if($aline=~/^\#/);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
172 chomp $aline;##Chr MajorLength Percent end 19B1
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
173 my @temp=split/\t/,$aline;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
174 my @ID=split/\:/,$temp[0];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
175 my @posi=split/\-/,$ID[1];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
176 my @all_rpkm=@temp;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
177 shift @all_rpkm;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
178 shift @all_rpkm;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
179 shift @all_rpkm;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
180 # for (my $s=0;$s<@all_rpkm ;$s++) {#log transfer
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
181 # $all_rpkm[$s]=log2($all_rpkm[$s]);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
182 # }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
183 push @{$cluster{$ID[0]}},[$temp[0],$posi[0],$posi[1],@all_rpkm];#ID start end rpkm(19B1,1PA1,1LC1);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
184 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
185 close CLUSTER;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
186 my %max_cluster;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
187 my $chr_number=0;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
188 print "@mark\n$mark\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
189 foreach my $chr (sort keys %cluster) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
190 for (my $i=0;$i<@mark ;$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
191 $max_cluster{$chr}[$i]=0;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
192 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
193 $chr_number++;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
194 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
195 foreach my $chr (sort keys %cluster) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
196 @{$cluster{$chr}}=sort{$a->[1] <=> $b->[1]}@{$cluster{$chr}};
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
197 for (my $i=0;$i<$#{$cluster{$chr}} ;$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
198 for (my $s=0;$s<@mark;$s++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
199 if ($cluster{$chr}[$i][3+$s]>$max_cluster{$chr}) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
200 $max_cluster{$chr}[$s]=$cluster{$chr}[$i][3+$s];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
201 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
202 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
203 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
204
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
205 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
206 foreach my $chr (sort keys %max_cluster) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
207 for (my $s=0; $s<@mark;$s++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
208 # print "$max_cluster{$chr}[$s]\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
209 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
210 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
211 #---------------------------------------------------------------------------------------
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
212 foreach my $chr(keys %cluster) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
213 for(my $i=0;$i<$#{$cluster{$chr}};$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
214 my $start=int($cluster{$chr}[$i][1]/$span);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
215 my $end=int($cluster{$chr}[$i][2]/$span);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
216 if ($start==$end) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
217 for (my $s=0;$s<@mark ;$s++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
218 $cluster_density{$chr}[$start][$s]+=$cluster{$chr}[$i][3+$s];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
219 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
220
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
221 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
222 else{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
223 for (my $m=$start;$m<=$end ;$m++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
224 for (my $s=0;$s<@mark ;$s++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
225 $cluster_density{$chr}[$m][$s]+=$cluster{$chr}[$i][3+$s];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
226 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
227 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
228 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
229 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
230 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
231 my %max_cluster_density;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
232 my $max_all_density=0;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
233 foreach my $chr (sort keys %cluster) {#
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
234 for (my $s=0;$s<@mark ;$s++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
235 for (my $i=0;$i<$#{$cluster{$chr}} ;$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
236 $max_cluster_density{$chr}[$s]=0;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
237 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
238 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
239
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
240 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
241 foreach my $chr (sort keys %cluster_density) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
242 print "$#{$cluster_density{$chr}}\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
243 for (my $k=0;$k<$#{$cluster_density{$chr}} ;$k++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
244 print TXT "$chr\t$k";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
245 for (my $s=0;$s<@mark;$s++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
246 if (!(defined($cluster_density{$chr}[$k][$s]))) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
247 $cluster_density{$chr}[$k][$s]=0;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
248 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
249 if ($cluster_density{$chr}[$k][$s]>$max_cluster_density{$chr}[$s]) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
250 $max_cluster_density{$chr}[$s]=$cluster_density{$chr}[$k][$s];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
251 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
252 if ($cluster_density{$chr}[$k][$s]>$max_all_density) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
253 $max_all_density=$cluster_density{$chr}[$k][$s];
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
254 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
255 print TXT "\t$cluster_density{$chr}[$k][$s]";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
256 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
257 print TXT "\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
258 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
259 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
260 print "max density: $max_all_density\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
261 #--------------------------------------------------------------------
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
262 my $top_margin=30;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
263 my $tail_margin=30;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
264 my $XOFFSET=50;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
265 my $YOFFSET=60;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
266 my $chr_length=600;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
267 my $Xscale=$chr_length/$max_length;#¶¨ÒåXÖá±ÈÀý³ß 1:1000 xÖáµÄ×ø±ê³¤¶È¶¼Òª°´Õմ˱ÈÀý³ß»»Ëã
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
268 #my $high_cov=$high_cov9B1=0.5;#¶¨Òå·åͼ×î¸ß·å
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
269 #my $Yscale=1/$high_cov;#¶¨ÒåYÖá±ÈÀý³ß 1:60 yÖáµÄ×ø±ê³¤¶È¶¼Òª°´Õմ˱ÈÀý³ß»»Ëã
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
270 #========================================New canvas============================
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
271 #### Starting ####
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
272 #н¨»­²¼
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
273 my $width=1000;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
274 my $heigth=100+130*$chr_number;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
275 my $svg=SVG->new(width=>$width, height=>$heigth);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
276 #»­Í¼Æðʼµã
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
277 my $canvas_start_x=$XOFFSET;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
278 my $canvas_end_x=$XOFFSET+$max_length*$Xscale;#°´ÕÕ±ÈÀý³ß »­Ïß
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
279 my $canvas_start_y=$YOFFSET;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
280 my $canvas_end_y=$YOFFSET;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
281 my $chr_heigth=$heigth-$YOFFSET-$tail_margin;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
282 print "chr number:$chr_number\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
283 my $one_chr_heigth=$chr_heigth/$chr_number;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
284 my $Yscale=($one_chr_heigth-15)/$max_all_density;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
285 #my $chr_width=$YOFFSET;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
286 #my $chr_start_y;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
287 #my $chr_end_y;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
288 #my $Yscale=0.01;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
289 #=======================================title of the graph===============================
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
290 #my $span_k=$span/1000;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
291 #$svg->text('x',$width/2,'y',$YOFFSET-20,'style','fill:black;text-anchor:middle','stroke',$attribute{text}{'stroke'},'stroke-width',$attribute{text}{'stroke-width'},'font-size',15,'font-family',$attribute{font}{'font-family'},'-cdata',"Clusters rpkm/"."$span_k"."kb Distribution");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
292 #=======================================the top max chr line=============================
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
293 $svg->line(id=>'l1',x1=>$canvas_start_x,y1=>$canvas_start_y,x2=>$canvas_end_x,y2=>$canvas_end_y,'stroke',$attribute{line}{'stroke'},'stroke-width',$attribute{line}{'stroke-width'});
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
294 $long_scale=int ($max_length/10);#Ê®µÈ·Ö ´ó¿Ì¶È
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
295 #´ó×ø±ê¿Ì¶È
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
296 for ($i=0;$i<=10;$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
297 my $long_x_start=$XOFFSET+$long_scale*$i*$Xscale;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
298 my $long_x_end=$long_x_start;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
299 my $long_y_start=$YOFFSET;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
300 my $long_y_end=$YOFFSET-5;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
301 $svg->line('x1',$long_x_start,'y1',$long_y_start,'x2',$long_x_end,'y2',$long_y_end,'stroke',$attribute{line}{'stroke'},'stroke-width',$attribute{line}{'stroke-width'});
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
302 my $Bscale=$long_scale*$i;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
303 my $cdata=int ($Bscale/1000000);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
304 $svg->text('x',$long_x_start,'y',$long_y_start-10,'style','fill:black;text-anchor:middle','stroke',$attribute{text}{'stroke'},'stroke-width',$attribute{text}{'stroke-width'},'font-size',12,'font-family',$attribute{font}{'font-family'},'-cdata',$cdata."M");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
305 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
306 #=========================================================================================
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
307 my $cc=1;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
308 foreach my $chr (sort keys %length) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
309 my $chr_end_x=$XOFFSET+$length{$chr}*$Xscale;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
310 my $chr_start_x=$XOFFSET;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
311 my $chr_start_y=$YOFFSET+$cc*$one_chr_heigth;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
312 my $chr_end_y=$chr_start_y;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
313 #$chr_start_y+=$chr_width;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
314 #$chr_end_y+=$chr_width;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
315 # for (my $i=0;$i<@{$gene_desity{$chr}};$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
316 # print "$chr\t$i\t$gene_desity{$chr}[$i]\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
317 # my $red=$gene_desity{$chr}[$i]/$max_gene_number*255;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
318 # my $green=$gene_desity{$chr}[$i]/$max_gene_number*255;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
319 # print "$red\t$green\t0\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
320 # $svg->rect('x',$chr_start_x+$i*$span*$Xscale,'y',$chr_start_y,'width',$span*$Xscale,'height',8,'stroke',"rgb($red,$green,0)",'stroke-width',0.1,'fill',"rgb($red,$green,0)");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
321 # }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
322
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
323 $svg->line(x1=>$chr_start_x,y1=>$chr_start_y,x2=>$chr_end_x,y2=>$chr_end_y,'stroke',$attribute{line}{'stroke'},'stroke-width',$attribute{line}{'stroke-width'});
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
324 $svg->text('x',$XOFFSET-40,'y',$chr_start_y,'style','fill:black;text-anchor:left','stroke',$attribute{text}{'stroke'},'stroke-width',$attribute{text}{'stroke-width'},'font-size',12,'font-family',$attribute{font}{'font-family'},'-cdata',$chr);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
325 my $m_length=$length{$chr}%1000000;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
326 $svg->text('x',$chr_end_x+20,'y',$chr_start_y,'style','fill:black;text-anchor:left','stroke',$attribute{text}{'stroke'},'stroke-width',$attribute{text}{'stroke-width'},'font-size',12,'font-family',$attribute{font}{'font-family'},'-cdata',$m_length."M");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
327
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
328
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
329 if (defined($centromere{$chr}[0])) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
330 $svg->rect('x',$XOFFSET+$centromere{$chr}[0]*$Xscale,'y',$chr_start_y-2,'width',($centromere{$chr}[1]-$centromere{$chr}[0]+1)*$Xscale,'height',5,'stroke',"blue",'stroke-width',$attribute{intron}{'stroke-width'},'fill',"blue");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
331 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
332 for (my $s=0;$s<@mark ;$s++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
333 for (my $i=0;$i<$#{$cluster_density{$chr}}-1 ;$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
334 #if ($cluster_density{$chr}[$i]*$Yscale>40) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
335 #$cluster_density{$chr}[$i]=40/$Yscale;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
336 #$svg->rect('x',$XOFFSET+$i*$span*$Xscale,'y',$chr_start_y-45,'width',$span*$Xscale,'height',5,'stroke',"green",'stroke-width',$attribute{intron}{'stroke-width'},'fill',"green");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
337 #}
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
338 #print "$i\t$cluster_density{$chr}[$i][$s]\t$cluster_density{$chr}[$i+1][$s]\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
339 my $cluster_density_start_x=$XOFFSET+$i*$span*$Xscale;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
340 my $cluster_density_end_x=$XOFFSET+($i+1)*$span*$Xscale;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
341 my $cluster_density_start_y=$chr_start_y-$cluster_density{$chr}[$i][$s]*$Yscale;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
342 my $cluster_density_end_y=$chr_start_y-$cluster_density{$chr}[$i+1][$s]*$Yscale;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
343 my $c_red=($s+1)/@mark*255;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
344 $svg->line('x1',$cluster_density_start_x,'y1',$cluster_density_start_y,'x2',$cluster_density_end_x,'y2',$cluster_density_end_y,'stroke',"rgb($c_red,125,0)",'stroke-width',0.3);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
345 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
346
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
347 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
348 #=======Y axis
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
349 $svg->line(x1=>$chr_start_x,y1=>$chr_start_y,x2=>$chr_start_x,y2=>$chr_start_y-$one_chr_heigth+15,'stroke',$attribute{line}{'stroke'},'stroke-width',$attribute{line}{'stroke-width'});
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
350 #=======Y axis ===>3 xiaoge
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
351 my $s10=1;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
352 my $e10=0;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
353 my $chr_max=$max_all_density;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
354 while ($chr_max>10) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
355 $chr_max=int($chr_max/10);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
356 $s10=$s10*10;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
357 $e10++;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
358 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
359 $chr_max=$chr_max/2;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
360 #print "*****$max_all_density\t$chr_max\t$s10\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
361 for (my $i=1;$i<3 ;$i++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
362 my $y1=$chr_start_y-$chr_max*$s10*$Yscale*$i;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
363 my $xiaoge_Y=$chr_max*$i;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
364 $svg->line('x1',$chr_start_x,'y1',$y1,'x2',$chr_start_x+3,'y2',$y1,'stroke',$attribute{line}{'stroke'},'stroke-width',$attribute{line}{'stroke-width'});
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
365 $svg->text('x',$chr_start_x-26,'y',$y1+4,'style','fill:black;text-anchor:left','stroke',$attribute{text}{'stroke'},'stroke-width',$attribute{text}{'stroke-width'},'font-size',8,'font-family',$attribute{font}{'font-family'},'-cdata',$xiaoge_Y."e".$e10);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
366 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
367 $cc++;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
368 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
369
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
370 for (my $s=0;$s<@mark ;$s++) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
371 my $c_red=($s+1)/@mark*255;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
372 print "**$c_red\n";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
373 $svg->line('x1',$canvas_end_x+100,'y1',$YOFFSET+$s*20+30,'x2',$canvas_end_x+130,'y2',$YOFFSET+$s*20+30,'stroke',"rgb($c_red,125,0)",'stroke-width',1);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
374 $svg->text('x',$canvas_end_x+150,'y',$YOFFSET+$s*20+5+30,'style','fill:black;text-anchor:left','stroke',$attribute{text}{'stroke'},'stroke-width',$attribute{text}{'stroke-width'},'font-size',10,'font-family',$attribute{font}{'font-family'},'-cdata',$mark[$s]);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
375 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
376 #
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
377 #
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
378 if (defined($opt{cen})) {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
379 $svg->rect('x',$canvas_end_x+100,'y',$YOFFSET+@mark*20+30,'width',30,'height',5,'stroke',"blue",'stroke-width',$attribute{intron}{'stroke-width'},'fill',"blue");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
380 $svg->text('x',$canvas_end_x+150,'y',$YOFFSET+@mark*20+30+5,'style','fill:black;text-anchor:left','stroke',$attribute{text}{'stroke'},'stroke-width',$attribute{text}{'stroke-width'},'font-size',10,'font-family',$attribute{font}{'font-family'},'-cdata',"centromere");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
381 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
382
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
383 close TXT;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
384
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
385 open (OUT,">$opt{o}");
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
386 print OUT $svg->xmlify();
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
387
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
388 sub log2 {
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
389 my $n = shift;
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
390 return log($n)/log(2);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
391 }
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
392
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
393 sub usage{
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
394 print <<"USAGE";
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
395 Version $version
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
396 Usage:
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
397 $0
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
398 options:
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
399 -g genelist
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
400 -span
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
401 -n sample cloumn
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
402 -mark sample name
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
403 -o output graph file name with html or svg extension
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
404 -c cluster file input
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
405 -out txt output
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
406 -l length of chr
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
407 -cen centromere
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
408 -h help
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
409 USAGE
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
410 exit(1);
e0884a4b996b Uploaded
big-tiandm
parents:
diff changeset
411 }