0
|
1 #!/usr/bin/perl -w
|
|
2 my $version=1.00;
|
|
3 use strict;
|
|
4 use warnings;
|
|
5 use Getopt::Long;
|
|
6 use Getopt::Std;
|
|
7 use threads;
|
|
8 use threads::shared;
|
|
9 use Parallel::ForkManager;
|
|
10 use lib '/leofs/biotrans/chentt/perl_module/';
|
|
11 #perl ../siRNA.pl -i config -g /leofs/biotrans/projects/rice/smallRNA/sRNA_package/bin/test/ref/genome.fa -f /share_bio/hs4/disk3-4/Reference/Plants/Rice_TIGR/Reference/TIGR/version_6.1/all.dir/all.gff3 -path /leofs/biotrans/projects/rice/smallRNA/sRNA_package/bin/ -o /leofs/biotrans/projects/rice/smallRNA/sRNA_package/bin/test -t 3 -rfam /leofs/biotrans/projects/rice/smallRNA/sRNA_package/bin/test/ref/Rfam.fasta -idx /leofs/biotrans/projects/rice/smallRNA/sRNA_package/bin/test/ref/genome -idx2 /leofs/biotrans/projects/rice/smallRNA/sRNA_package/bin/test/ref/rfam -deg deg -n 25 -nat class/nat_1 -repeat class/repeat_1 -cen centromere_TIGR.txt -format fastq
|
|
12 print "
|
|
13 #####################################
|
|
14 # #
|
5
|
15 # sRNA cluster #
|
0
|
16 # #
|
|
17 #####################################
|
|
18 ";
|
|
19 ###########################################################################################
|
|
20 my $usage="$0
|
|
21 Options:
|
|
22 -i input file# raw data file
|
|
23 -tag string #raw data sample name
|
|
24 -g genome file
|
|
25 -f gff file
|
|
26
|
|
27 -o workdir file
|
|
28 -path script path
|
|
29 -t int, number of threads [1]
|
|
30 -format fastq, fq, fasta or fa
|
|
31 -idx string, genome file index, file-prefix #(must be indexed by bowtie-build) The parameter
|
|
32 string must be the prefix of the bowtie index. For instance, if
|
|
33 the first indexed file is called 'h_sapiens_37_asm.1.ebwt' then
|
|
34 the prefix is 'h_sapiens_37_asm'.##can be null
|
|
35 -mis int number of allowed mismatches when mapping reads to genome, default 0
|
|
36 -rfam string, input file# rfam database file.
|
|
37 -idx2 string, rfam file index, file-prefix #(must be indexed by bowtie-build) The parameter
|
|
38 string must be the prefix of the bowtie index. For instance, if
|
|
39 the first indexed file is called 'h_sapiens_37_asm.1.ebwt' then
|
|
40 the prefix is 'h_sapiens_37_asm'.##can be null
|
|
41
|
|
42 -v int report end-to-end hits w/ <=v mismatches; ignore qualities,default 0; used in rfam alignment
|
|
43
|
|
44 -a string, ADAPTER string. default is ATCTCGTATG.
|
|
45 -n int max hits number,default 25; used in genome alignment
|
|
46 -d int distance of tag to merged a cluster; default 100
|
|
47 -p cluster method F :conventional default is F
|
|
48 T :NIBLES
|
|
49 -l int the length of the upstream and downstream,default 1000;used in position annotate
|
|
50
|
|
51 -nat natural antisense transcripts file
|
|
52 -repeat repeat information file out of Repeatmasker
|
|
53 -deg file config of de sample
|
|
54 -cen centromere file input
|
|
55 -span plot span, default 50000
|
|
56 ";
|
|
57
|
|
58 my %options;
|
|
59 GetOptions(\%options,"i:s@","tag:s@","g=s","f=s","o=s","a:s","path:s","p=s","format=s","nat:s","repeat:s","deg:s","n:i","mis:i","rfam:s","t:i","v:i","d:i","l:i","idx:s","idx2:s","cen:s","span:s","h");
|
5
|
60 #print help if that option is used
|
|
61 if($options{h}){die $usage;}
|
0
|
62
|
5
|
63 my @filein=@{$options{'i'}};
|
|
64 my @mark=@{$options{'tag'}};
|
0
|
65
|
|
66 #my $config=$options{'i'};
|
|
67 my $genome_fa=$options{'g'};
|
|
68 my $gff=$options{'f'};
|
5
|
69
|
|
70
|
0
|
71 ##########################################################################################
|
|
72 my $predir=`pwd`;
|
|
73 chomp $predir;
|
|
74 my $workdir=defined($options{'o'}) ? $options{'o'}:$predir;
|
|
75
|
|
76 my $path=$options{'path'};
|
|
77
|
|
78 my $t=defined($options{'t'})? $options{'t'}:1; #threads number
|
|
79
|
|
80 my $mis=defined $options{'mis'} ? $options{'mis'}:0;
|
|
81
|
|
82 my $mis_rfam=defined $options{'v'} ? $options{'v'}:0;
|
|
83
|
|
84 my $hit=defined $options{'n'}?$options{'n'}:25;
|
|
85
|
|
86 my $distance_of_merged_tag=defined $options{'d'} ? $options{'d'}:100;
|
|
87
|
|
88 my $up_down_dis=defined $options{'l'} ?$options{'l'}:1000;
|
|
89
|
|
90 my $cluster_mothod=defined $options{'p'}?$options{'p'}:"F";
|
|
91
|
|
92 my $format=$options{'format'};
|
|
93 #if ($format ne "fastq" && $format ne "fq" && $format ne "fasta" && $format ne "fa") {
|
|
94 # die "Parameter \"-format\" is error! Parameter is fastq, fq, fasta or fa\n";
|
|
95 #}
|
|
96
|
|
97 my $adpter="ATCTCGTATG"; #adapter
|
5
|
98 if (defined $options{'a'}) {$adpter=$options{'a'};}
|
0
|
99
|
|
100
|
|
101 my $phred_qv=64;
|
|
102 my $sample_number;
|
|
103 my ($dir,$dir_tmp);
|
|
104 ################################ MAIN ##################################################
|
|
105 print "\ncluster program start:";
|
|
106 my $time=Time();
|
|
107 make_dir_tmp();
|
|
108
|
5
|
109 my @clip;
|
0
|
110 my $mark;
|
|
111 my $sample_mark;
|
|
112
|
5
|
113 my $config=$dir."/input_config";
|
0
|
114 open CONFIG,">$config";
|
5
|
115 for (my $i=0;$i<@filein;$i++) {
|
|
116 print CONFIG $filein[$i],"\t",$mark[$i],"\n";
|
0
|
117 }
|
|
118 close CONFIG;
|
5
|
119 if (@filein != @mark) {
|
|
120 die "Maybe config file have some wrong!!!\n";
|
|
121 }
|
|
122 $sample_number=@mark;
|
|
123 $mark=join "\t",@mark;
|
|
124 $sample_mark=join "\#",@mark;
|
0
|
125
|
5
|
126
|
|
127 #read_config();
|
0
|
128
|
|
129 trim_adapter_and_filter();
|
|
130
|
|
131 my $filter_out=$dir."preProcess\/"."collapse_reads_out.fa";## raw clean data
|
|
132 my $data2=$filter_out; ### mirbase not mapped reads
|
|
133 my $data3=$dir."\/rfam_match\/rfam_not_mapped\.fa"; ### rfam not mapped reads
|
|
134 my $bed=$dir."cluster\/"."sample\.bed";
|
|
135 my $read=$dir."cluster\/"."sample_reads\.cluster";
|
|
136 my $read_txt=$dir."cluster\/"."cluster\.txt";
|
|
137 my $rpkm=$dir."cluster\/"."sample_rpkm\.cluster";
|
|
138 my $preprocess;
|
|
139 my $cluster_file;
|
|
140 my $annotate_dir;
|
|
141 my $deg_dir;
|
|
142 my %id;
|
|
143 for (my $i=0;$i<@mark ;$i++) {
|
|
144 $id{$mark[$i]}=$i+4;
|
|
145 }
|
|
146 group_and_filter(); #collapse reads to tags
|
|
147
|
|
148 rfam();
|
|
149
|
|
150 my @map_read;
|
|
151 my $map_tag=0;
|
|
152 genome();
|
|
153
|
|
154 bwt2bed();
|
|
155
|
|
156 cluster();
|
|
157
|
|
158 quantify();
|
|
159
|
|
160 phase();
|
|
161
|
5
|
162 if (defined($options{'nat'})&&defined($options{'repeat'})) {
|
|
163 class();
|
|
164 }
|
|
165 else{
|
|
166 get_genelist();
|
|
167 }
|
0
|
168
|
|
169 annotate();
|
|
170
|
|
171 genome_length();
|
|
172
|
|
173 plot();
|
|
174
|
|
175 my @pairdir;
|
|
176 if (defined($options{'deg'})) {
|
|
177 dec();
|
|
178 infor_merge();
|
|
179 }
|
|
180 html();
|
|
181 print "\ncluster program end:";
|
|
182 Time();
|
|
183 ############################sub program###################################################
|
|
184 sub make_dir_tmp{
|
|
185
|
|
186 #make temporary directory
|
|
187 if(not -d "$workdir\/cluster_runs_$time"){
|
|
188 mkdir("$workdir\/cluster_runs_$time");
|
|
189 mkdir("$workdir\/cluster_runs_$time\/ref\/");
|
|
190 }
|
|
191
|
|
192 $dir="$workdir\/cluster_runs_$time\/";
|
|
193 print STDERR "mkdir $dir\n\n";
|
|
194 return;
|
|
195 }
|
|
196
|
5
|
197 #sub read_config{
|
|
198 # open IN,"<$config";
|
|
199 # while (my $aline=<IN>) {
|
|
200 # chomp $aline;
|
|
201 # my @tmp=split/\t/,$aline;
|
|
202 # push @filein,$tmp[0];
|
|
203 # push @mark,$tmp[1];
|
|
204 # }
|
|
205 # close IN;
|
|
206 # if (@filein != @mark) {
|
|
207 # die "Maybe config file have some wrong!!!\n";
|
|
208 # }
|
|
209 # $sample_number=@mark;
|
|
210 # $mark=join "\t",@mark;
|
|
211 # $sample_mark=join "\#",@mark;
|
|
212 #}
|
0
|
213
|
|
214
|
|
215 sub trim_adapter_and_filter{
|
|
216 my $time=time();
|
|
217 $preprocess=$dir."preProcess/";
|
|
218 mkdir $preprocess;
|
|
219 my $can_use_threads = eval 'use threads; 1';
|
|
220 if ($can_use_threads) {
|
|
221 # Do processing using threads
|
|
222 my @filein1=@filein; my @mark1=@mark;
|
|
223 while (@filein1>0) {
|
|
224 my @thrs; my @res;
|
|
225 for (my $i=0;$i<$t ;$i++) {
|
|
226 last if(@filein1==0);
|
|
227 my $in=shift @filein1;
|
|
228 my $out=shift @mark1;
|
|
229 push @clip,$dir."preProcess\/$out\_clip\.fq";
|
|
230 $thrs[$i]=threads->create(\&clips,$in,$out);
|
|
231 }
|
|
232 for (my $i=0;$i<@thrs;$i++) {
|
|
233 $res[$i]=$thrs[$i]->join();
|
|
234 }
|
|
235 }
|
|
236 }
|
|
237 else {
|
|
238 # Do not processing using threads
|
|
239 for (my $i=0;$i<@filein ;$i++) {
|
|
240 my $in=$filein[$i];
|
|
241 my $out=$mark[$i];
|
|
242 push @clip,$dir."preProcess\/$out\_clip\.fq";
|
|
243 &clips($in,$out);
|
|
244 }
|
|
245 }
|
|
246 }
|
|
247
|
|
248 sub clips{
|
|
249 my ($filein,$fileout)=@_;
|
|
250 my $adapter=$dir."preProcess\/$fileout\_clip\.fq";
|
|
251 if($format eq "fq" || $format eq "fastq"){
|
5
|
252 my $clip=`fastx_clipper -a $adpter -M 6 -Q $phred_qv -i $filein -o $adapter`;
|
0
|
253 }
|
|
254 if($format eq "fa" || $format eq "fasta"){
|
5
|
255 my $clip=`fastx_clipper -a $adpter -M 6 -i $filein -o $adapter`;
|
0
|
256 }
|
|
257 #my $clean=$dir."preProcess\/$fileout\_clean.fq";
|
|
258 #my $filter=`filterReadsByLength.pl -i $adapter -o $clean -min 18 -max 40 `;
|
|
259 return $fileout;
|
|
260 }
|
|
261
|
|
262 sub group_and_filter{
|
|
263 #my ($ins,$data)=@_;
|
|
264 my @ins=@clip;
|
|
265 my $str="";
|
|
266 my $group_out_file=$dir."preProcess\/"."collapse_reads.fa";
|
|
267 #print "$$ins[0]\t$$ins[0]\n";
|
|
268 for (my $i=0;$i<@clip;$i++) {
|
|
269 $str .="-i $clip[$i] ";
|
|
270 #print "$$ins[$i]\n";
|
|
271 }
|
|
272 my $group=`perl $path\/collapseReads2Tags.pl $str -mark seq -o $group_out_file -format $format`;
|
|
273 print "perl $path\/collapseReads2Tags.pl $str -mark seq -o $group_out_file -format $format\n\n";
|
|
274
|
|
275 my $l_out=$dir."preProcess\/"."collapse_reads_18-40.fa";
|
|
276 my $length_f=`perl $path\/filterReadsByLength_1.pl -i $group_out_file -o $l_out -min 18 -max 40 -mark $sample_mark`;
|
|
277 print "perl $path\/filterReadsByLength_1.pl -i $group_out_file -o $l_out -min 18 -max 40 -mark $sample_mark\n\n";
|
|
278 my $cout_f=`perl $path\/filterReadsByCount.pl -i $l_out -o $filter_out -mark $sample_mark`;
|
|
279 print "perl $path\/filterReadsByCount.pl -i $l_out -o $filter_out -mark $sample_mark\n\n";
|
|
280 return 0;
|
|
281 }
|
|
282
|
|
283 sub rfam{
|
|
284 if (defined $options{'idx2'}) {
|
|
285 system("perl $path\/rfam.pl -i $data2 -ref $options{rfam} -v $mis_rfam -p $t -o $dir -index $options{idx2}");
|
|
286 }else{
|
|
287 system("perl $path\/rfam.pl -i $data2 -ref $options{rfam} -v $mis_rfam -p $t -o $dir");
|
|
288 }
|
|
289 my $tag=join "\\;" ,@mark;
|
|
290 my $rfam_count=`perl $path\/count_rfam_express.pl -i $dir\/rfam_match\/rfam_mapped.bwt -tag $tag -o $dir\/rfam_match\/rfam_non-miRNA_annotation.txt`;
|
|
291 return 0;
|
|
292 }
|
|
293 sub genome{
|
|
294 if(defined $options{'idx'}){
|
|
295 system("perl $path\/matching.pl -i $data3 -g $genome_fa -v $mis -p $t -r $hit -o $dir -index $options{idx}") ;
|
|
296 }else{
|
|
297 system("perl $path\/matching.pl -i $data3 -g $genome_fa -v $mis -p $t -r $hit -o $dir ") ;
|
|
298 }
|
|
299 #=================== mapping sta ===================================================
|
|
300 my $map_file=$dir."genome_match\/genome_mapped\.fa";
|
|
301 open (MAP,"<$map_file")||die"$!";
|
|
302 print "\n#each sample mapping reads sta:\n\n";
|
|
303 print "#$mark\ttotal\n";
|
|
304 while (my $ID=<MAP>) {
|
|
305 chomp $ID;
|
|
306 my @tmp=split/\:/,$ID;
|
|
307 my @exp=split/\_/,$tmp[1];
|
|
308 $exp[-1] =~ s/^x//;
|
|
309 for (my $i=0;$i<@exp ;$i++) {
|
|
310 $map_read[$i]+=$exp[$i];
|
|
311 }
|
|
312 $map_tag++;
|
|
313 my $seq=<MAP>;
|
|
314 }
|
|
315 my $map_read=join"\t",@map_read;
|
|
316 print "$map_read\n\n";
|
|
317 print "#total mapped tags:$map_read\n\n";
|
|
318 close MAP;
|
|
319 return 0;
|
|
320 }
|
|
321
|
|
322 sub bwt2bed{
|
|
323 $cluster_file=$dir."cluster\/";
|
|
324 mkdir ("$cluster_file");
|
|
325 print "sam file changed to bed file\n";
|
|
326 my ($file) = $dir."genome_match\/genome_mapped\.bwt";
|
|
327
|
|
328 my $sam2bed=`perl $path\/sam2Bed_bowtie.pl -i $file -mark $sample_mark -o $bed `;
|
|
329 print "perl $path\/sam2Bed_bowtie.pl -i $file -mark $sample_mark -o $bed\n\n";
|
|
330 return 0;
|
|
331 }
|
|
332
|
|
333 sub cluster{
|
|
334 print "tags is ready to merged clusters\n\n";
|
|
335 my ($file) =$bed;
|
|
336 if ($cluster_mothod eq "F") {
|
|
337 my $cluster=`perl $path\/conventional.pl -i $file -d $distance_of_merged_tag -n $sample_number -mark $sample_mark -o $read -t $read_txt`;
|
|
338 print "Using converntional method\n perl $path\/conventional.pl -i $file -d $distance_of_merged_tag -n $sample_number -mark $sample_mark -o $read -t $read_txt\n\n";
|
|
339 }
|
|
340 elsif($cluster_mothod eq "T"){
|
|
341 my $cluster=`perl $path\/nibls.pl -f $file -m $distance_of_merged_tag -o $read -t $read_txt -mark $sample_mark`;
|
|
342 print "Using nibls method\n perl $path\/nibls.pl -f $file -m $distance_of_merged_tag -o $read -t $dir\/cluster.txt -mark $sample_mark\n\n";
|
|
343 }
|
|
344 else{print "\-p is wrong!\n\n";}
|
|
345 return 0;
|
|
346 }
|
|
347
|
|
348
|
|
349 sub quantify{
|
|
350 print "clusters is ready to quantified\n\n";
|
|
351 my @depth=@map_read;
|
|
352 pop @depth;
|
|
353 my $depth=join ",",@depth;
|
|
354 my $quantify=`perl $path\/quantify.pl -i $read -d $depth -o $rpkm`;
|
|
355 print "perl $path\/quantify.pl -i $read -d $depth -o $rpkm\n\n\n";
|
|
356 return 0;
|
|
357 }
|
|
358
|
|
359 sub phase{
|
|
360 $annotate_dir=$dir."annotate\/";
|
|
361 mkdir ("$annotate_dir");
|
|
362 print "clusters is to predict phase siRNA\n";
|
|
363 my $phase=`perl $path\/phased_siRNA.pl -i $read_txt -o $annotate_dir\/phase.out`;
|
|
364 print "perl $path\/phased_siRNA.pl -i $read_txt -o $annotate_dir\/phase.out\n\n\n";
|
|
365 return 0;
|
|
366 }
|
|
367
|
|
368 sub class{
|
5
|
369 print "clusters is ready to annotate by sources\n\n";
|
0
|
370 my $nat=$options{'nat'};
|
|
371 my $repeat=$options{'repeat'};
|
|
372 my $class=`perl $path\/ClassAnnotate.pl -i $rpkm -g $gff -n $nat -r $repeat -p $annotate_dir\/phase.out -o $annotate_dir\/sample_class.anno -t $annotate_dir\/nat.out -l $dir\/ref\/genelist.txt`;
|
|
373 print "perl $path\/ClassAnnotate.pl -i $rpkm -g $gff -n $nat -r $repeat -p $annotate_dir\/phase.out -o $annotate_dir\/sample_class.anno -t $annotate_dir\/nat.out -l $dir\/ref\/genelist.txt\n\n";
|
|
374 }
|
|
375
|
|
376 sub annotate{
|
|
377 print "clusters is ready to annotate by gff file\n\n";
|
5
|
378 my $file;
|
|
379 if (defined($options{'nat'})&&defined($options{'repeat'})) {
|
|
380 $file="$annotate_dir\/sample_class.anno";
|
|
381 }
|
|
382 else{
|
|
383 $file=$rpkm;
|
|
384 }
|
0
|
385 my $annotate=`perl $path\/Annotate.pl -i $file -g $dir\/ref\/genelist.txt -d $up_down_dis -o $annotate_dir\/sample_c_p.anno`;
|
|
386 print "perl $path\/Annotate.pl -i $file -g $dir\/ref\/genelist.txt -d $up_down_dis -o $annotate_dir\/sample_c_p.anno\n\n";
|
|
387 return 0;
|
|
388 }
|
5
|
389 sub get_genelist{
|
|
390
|
|
391 my $get_genelist=`perl $path\/get_genelist.pl -i $gff -o $dir\/ref\/genelist.txt`;
|
|
392 print "perl $path\/get_genelist.pl -i $gff -o $dir\/ref\/genelist.txt";
|
|
393 }
|
0
|
394
|
|
395 sub dec{
|
|
396 print "deg reading\n\n";
|
|
397 my $deg_file=$options{'deg'};
|
|
398 open IN,"<$deg_file";
|
|
399 my @deg;
|
|
400 my $s=0;
|
|
401 while (my $aline=<IN>) {
|
|
402 chomp $aline;
|
|
403 next if($aline=~/^\#/);
|
|
404 $deg[$s]=$aline;
|
|
405 my @ea=split/\s+/,$aline;
|
|
406 push @pairdir,"$ea[0]_VS_$ea[1]\/";
|
|
407 #print "$deg[$s]\n";
|
|
408 $s++;
|
|
409 }
|
|
410 close IN;
|
|
411 $deg_dir=$dir."deg\/";
|
|
412 mkdir ("$deg_dir");
|
|
413 my $max_process = 10;
|
|
414 my $pm = new Parallel::ForkManager( $max_process );
|
|
415 my $number=@deg-1;
|
|
416 foreach(0..$number){
|
|
417 $pm->start and next;
|
|
418 &dec_pel($deg[$_]);
|
|
419 $pm->finish;
|
|
420 }
|
|
421 $pm->wait_all_children;
|
|
422 }
|
|
423
|
|
424 sub dec_pel{
|
|
425 print "start:\n";
|
|
426 Time();
|
|
427 my $sample=shift(@_);
|
|
428 my @each=split/\s+/,$sample;
|
|
429 print "$each[0]\t$each[1]\n";
|
|
430 my $deg_sample_dir=$deg_dir."$each[0]_VS_$each[1]\/";
|
|
431 mkdir ("$deg_sample_dir");
|
|
432 my $deg=`perl $path\/DEGseq_2.pl -i $read -outdir $deg_sample_dir -column1 $id{$each[0]} -mark1 $each[0] -column2 $id{$each[1]} -mark2 $each[1]`; #-depth1 -depth2
|
|
433 my $time2=time();
|
|
434 print "end:\n";
|
|
435 Time();
|
|
436 sleep 1;
|
|
437 }
|
|
438
|
|
439 sub infor_merge{
|
|
440 my ($input,$mark);
|
|
441 foreach (@pairdir) {
|
|
442 print "@pairdir\n";
|
|
443 $mark.=" -mark $_ ";
|
|
444 $input.=" -i $dir/deg\/$_\/output_score\.txt ";
|
|
445 print "$input\n$mark\n";
|
|
446 }
|
|
447 my $infor_merge=`perl $path\/SampleDEGseqMerge.pl $input $mark -f $annotate_dir\/sample_c_p.anno -n $sample_number -o $dir\/total.result `;
|
|
448 print "perl $path\/SampleDEGseqMerge.pl $input $mark -f $annotate_dir\/sample_c_p.anno -n $sample_number -o $dir\/total.result\n\n";
|
|
449 }
|
|
450
|
|
451 sub genome_length{
|
|
452 my $length=`perl $path\/count_ref_length.pl -i $genome_fa -o $dir\/ref\/genome\.length`;
|
|
453 print "perl $path\/count_ref_length.pl -i $genome_fa -o $dir\/ref\/genome\.length\n\n"
|
|
454
|
|
455 }
|
|
456
|
|
457 sub plot{
|
|
458 my $plot_file="$dir\/plot\/";
|
|
459 mkdir ("$plot_file");
|
|
460 my $genome_plot="$dir\/plot\/genome\/";
|
|
461 mkdir ("$genome_plot");
|
|
462 #genome cluster
|
|
463 my $span=defined($options{span})?$options{span}:50000;
|
|
464 foreach (1..$sample_number) {
|
|
465 my $mark=$mark[$_-1];
|
|
466 my $cen="";
|
|
467 if (defined $options{cen}) {
|
|
468 $cen="-cen $options{cen}";
|
|
469 }
|
|
470 my $plot=`perl $path\/sRNA_rpkm_distribution_along_genome.pl -c $rpkm -n $_ -mark $mark -span $span -l $dir\/ref\/genome\.length $cen -o $genome_plot\/$mark\.html -out $genome_plot\/$mark\.txt`;
|
|
471 print "perl $path\/sRNA_rpkm_distribution_along_genome.pl -c $rpkm -n $_ -mark $mark -span $span -l $dir\/ref\/genome\.length $cen -o $genome_plot\/$mark\.html -out $genome_plot\/$mark\.txt\n\n";
|
|
472 }
|
|
473
|
|
474 my $chr_plot_dir="$dir\/plot\/chr\/";
|
|
475 mkdir("$chr_plot_dir");
|
|
476 my %chr;
|
|
477 open LEN,"<$dir\/ref\/genome\.length";
|
|
478 while (my $aline=<LEN>) {
|
|
479 next if($aline=~/^\#/);
|
|
480 chomp $aline;
|
|
481 my @temp=split/\t/,$aline;
|
|
482 $chr{$temp[0]}=$temp[1];
|
|
483 }
|
|
484 close LEN;
|
|
485 foreach my $chr (sort keys %chr) {
|
|
486 my $cen="";
|
|
487 if (defined $options{cen}) {
|
|
488 $cen="-cen $options{cen}";
|
|
489 }
|
|
490 my $chr_plot=`perl $path\/chr_plot.pl -l $chr{$chr} -chro $chr -g $dir\/ref\/genelist.txt -span $span -c $rpkm -mark $sample_mark -o $chr_plot_dir\/$chr\.html`;
|
|
491 print "perl $path\/chr_plot.pl -l $chr{$chr} -chro $chr -g $dir\/ref\/genelist.txt -span $span -c $rpkm -mark $sample_mark -o $chr_plot_dir\/$chr\.html\n";
|
|
492 }
|
|
493 }
|
|
494
|
|
495 sub html{
|
|
496 my $pathfile="$dir/path.txt";
|
|
497 open PA,">$pathfile";
|
|
498 print PA "$config\n";
|
|
499 print PA "$preprocess\n";
|
|
500 print PA "$dir"."rfam_match\n";
|
|
501 print PA "$dir"."genome_match\n";
|
|
502 print PA "$cluster_file\n";
|
|
503 print PA "$annotate_dir\n";
|
|
504 print PA "$deg_dir\n";
|
|
505 close PA;
|
|
506 my $html=`perl $path\/html.pl -i $pathfile -format $format -o $dir/result.html`;
|
|
507 }
|
|
508
|
|
509 sub Time{
|
|
510 my $time=time();
|
|
511 my ($sec,$min,$hour,$day,$month,$year) = (localtime($time))[0,1,2,3,4,5,6];
|
|
512 $month++;
|
|
513 $year+=1900;
|
|
514 if (length($sec) == 1) {$sec = "0"."$sec";}
|
|
515 if (length($min) == 1) {$min = "0"."$min";}
|
|
516 if (length($hour) == 1) {$hour = "0"."$hour";}
|
|
517 if (length($day) == 1) {$day = "0"."$day";}
|
|
518 if (length($month) == 1) {$month = "0"."$month";}
|
|
519 print "$year-$month-$day $hour:$min:$sec\n";
|
|
520 return("$year-$month-$day-$hour-$min-$sec");
|
|
521 }
|
|
522 #################################################################################
|