comparison nibls.pl @ 19:e0884a4b996b draft

Uploaded
author big-tiandm
date Wed, 05 Nov 2014 01:17:26 -0500
parents 07745c0958dd
children
comparison
equal deleted inserted replaced
18:22d79320085c 19:e0884a4b996b
78 # my $length1=$end-$start+1; 78 # my $length1=$end-$start+1;
79 # if ($length1>30) { 79 # if ($length1>30) {
80 # $length1=40; 80 # $length1=40;
81 # } 81 # }
82 my $total; 82 my $total;
83 foreach (0..$#data) { 83 for (my $s=0;$s<@data ;$s++) {
84 $total+=$_; 84 $total+=$data[$s];
85 } 85 }
86 push @data,$total; 86 push @data,$total;
87 # push @data,$length1; 87 # push @data,$length1;
88 # if (defined $molecules{$chr}{$start}{$end}{$strand}) { 88 # if (defined $molecules{$chr}{$start}{$end}{$strand}) {
89 # my @old_data=split(/;/,$molecules{$chr}{$start}{$end}{$strand}); 89 # my @old_data=split(/;/,$molecules{$chr}{$start}{$end}{$strand});
256 256
257 $node =~ m/^(\S+):(\d+):(\d+)$/; 257 $node =~ m/^(\S+):(\d+):(\d+)$/;
258 my $c=$1; 258 my $c=$1;
259 my $s=$2; 259 my $s=$2;
260 my $e=$3; 260 my $e=$3;
261 my @data; 261 # my @data;
262 foreach my $str (keys %{$molecules{$c}{$s}{$e}}) { 262 foreach my $str (keys %{$molecules{$c}{$s}{$e}}) {
263 push @tag,($s.",".$e.",".$str); 263 my @data=split(/;/,$molecules{$c}{$s}{$e}{$str});
264 @data=split(/;/,$molecules{$c}{$s}{$e}{$str}); 264 push @tag,($s.",".$e.",".$str.",".$data[-1]);
265 # for (my $i=0;$i<$#old_data ;$i++) { 265 # for (my $i=0;$i<$#old_data ;$i++) {
266 # $data[$i]+=$old_data[$i]; 266 # $data[$i]+=$old_data[$i];
267 # } 267 # }
268 my $length=$e-$s+1; 268 my $length=$e-$s+1;
269 if ($length>30) { 269 if ($length>30) {
277 $chr = $c; 277 $chr = $c;
278 $start = $s if $s < $start; 278 $start = $s if $s < $start;
279 $end = $e if $e > $end; 279 $end = $e if $e > $end;
280 } 280 }
281 my $tag=join";",@tag; 281 my $tag=join";",@tag;
282 282 my $tag_number=@tag;
283 my ($max_length,$max_p,@cluster_exp)=Max_length(\@sample); 283 my ($max_length,$max_p,@cluster_exp)=Max_length(\@sample);
284 if ($max_length==40) { 284 if ($max_length==40) {
285 $max_length="\>30"; 285 $max_length="\>30";
286 } 286 }
287 my $cluster_exp=join"\t",@cluster_exp; 287 my $cluster_exp=join"\t",@cluster_exp;
288 my $gff = $chr."\:$start\-$end\t".$max_length."nt\t".$max_p."\t" . $cluster_exp; 288 my $gff = $chr."\:$start\-$end\t".$max_length."nt\t".$max_p."\t" . $cluster_exp;
289 print CLUSTER "$chr\:$start\-$end\t$max_length"."nt\t$max_p\t$tag\n"; 289 print CLUSTER "$chr\:$start\-$end\t$max_length"."nt\t$max_p\t$tag_number\t$tag\n";
290 print OUT $gff, "\n"; 290 print OUT $gff, "\n";
291 } 291 }
292 292
293 sub Max_length{ 293 sub Max_length{
294 my @exp=@{$_[0]}; 294 my @exp=@{$_[0]};