diff siRNA.pl @ 19:e0884a4b996b draft

Uploaded
author big-tiandm
date Wed, 05 Nov 2014 01:17:26 -0500
parents 22d79320085c
children
line wrap: on
line diff
--- a/siRNA.pl	Thu Oct 30 21:31:55 2014 -0400
+++ b/siRNA.pl	Wed Nov 05 01:17:26 2014 -0500
@@ -139,12 +139,20 @@
 my $cluster_file;
 my $annotate_dir;
 my $deg_dir;
+my $plot_dir;
 my %id;
 for (my $i=0;$i<@mark ;$i++) {
 	$id{$mark[$i]}=$i+4;
 }
 
-
+print "\n######## tiandm test start ###########\n";
+print "\@mark: @mark\n\%id keys number:";
+print scalar keys %id;
+print "\n";
+foreach my $kyess (keys %id){
+	print $kyess," --> $id{$kyess}\n";	
+}
+print "\n######## tiandm test end ############\n";
 group_and_filter();   #collapse reads to tags
 
 rfam();
@@ -280,6 +288,8 @@
 	print "perl $path\/filterReadsByLength_1.pl -i $group_out_file -o $l_out -min 18 -max 40 -mark $sample_mark\n\n";
 	my $cout_f=`perl $path\/filterReadsByCount.pl -i $l_out -o $filter_out -mark $sample_mark`;
 	print "perl $path\/filterReadsByCount.pl -i $l_out -o $filter_out -mark $sample_mark\n\n";
+	my $plot_l_D=`perl $path/Length_Distibution.pl -i $dir/preProcess/reads_length_distribution_after_count_filter.txt -o $dir/preProcess/length.html `;
+	print "perl $path\/Length_Distibution.pl -i $dir\/preProcess\/reads_length_distribution_after_count_filter.txt -o $dir\/preProcess\/length\.html\n\n";
 	return 0;
 }
 
@@ -341,8 +351,8 @@
 		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";
 	}
 	elsif($cluster_mothod eq "T"){
-		my $cluster=`perl $path\/nibls.pl -f $file -m $distance_of_merged_tag -o $read -t $read_txt -mark $sample_mark`;
-		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";
+		my $cluster=`perl $path\/nibls.pl -f $file -m $distance_of_merged_tag -o $read -t $read_txt -k $sample_mark`;
+		print "Using nibls method\n perl $path\/nibls.pl -f $file -m $distance_of_merged_tag -o $read -t $dir\/cluster.txt -k $sample_mark\n\n";
 	}
 	else{print "\-p is wrong!\n\n";}
 	return 0;
@@ -466,41 +476,16 @@
 }
 
 sub plot{
-	my $plot_file="$dir\/plot\/";
-	mkdir ("$plot_file");
-	my $genome_plot="$dir\/plot\/genome\/";
-	mkdir ("$genome_plot");
-	#genome cluster 
+	$plot_dir="$dir\/plot\/";
+	mkdir ("$plot_dir");
 	my $span=defined($options{span})?$options{span}:50000;
-	foreach  (1..$sample_number) {
-		my $mark=$mark[$_-1];
-		my $cen="";
-		if (defined $options{cen}) {
-			$cen="-cen $options{cen}";
-		}
-		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`;
-		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";
+	my $cen="";
+	if (defined $options{cen}) {
+		$cen="-cen $options{cen}";
 	}
+	my $plot=`perl $path/sRNA_plot.pl -c $rpkm -g $dir/ref/genelist.txt -span 50000 -mark $sample_mark -l $dir/ref/genome\.length $cen -o $plot_dir/cluster.html -out $plot_dir/cluster.txt `;
+	"print perl $path/sRNA_plot.pl -c $rpkm -g $dir/ref/genelist.txt -span 50000 -mark $sample_mark -l $dir/ref/genome.length $cen -o $plot_dir/cluster.html -out $plot_dir/cluster.txt \n";
 
-	my $chr_plot_dir="$dir\/plot\/chr\/";
-	mkdir("$chr_plot_dir");
-	my %chr;
-	open LEN,"<$dir\/ref\/genome\.length";
-	while (my $aline=<LEN>) {
-		next if($aline=~/^\#/);
-		chomp $aline;
-		my @temp=split/\t/,$aline;
-		$chr{$temp[0]}=$temp[1];
-	}
-	close LEN;
-	foreach my $chr (sort keys %chr) {
-		my $cen="";
-		if (defined $options{cen}) {
-			$cen="-cen $options{cen}";
-		}
-		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`;
-		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";
-	}
 }
 
 sub html{
@@ -512,6 +497,7 @@
 	print PA "$dir"."genome_match\n";
 	print PA "$cluster_file\n";
 	print PA "$annotate_dir\n";
+	print PA "$plot_dir\n";
 	if (defined($deg_dir)) {
 			print PA "$deg_dir\n";
 	}