[Bio] / FigKernelPackages / raedraw.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/raedraw.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12, Tue Jun 6 00:58:23 2006 UTC revision 1.13, Tue Aug 1 17:57:15 2006 UTC
# Line 129  Line 129 
129   # the effective width is the width * the number of rows we want   # the effective width is the width * the number of rows we want
130   $self->{'effectivewidth'}=$self->{'width'} * $self->{'rows'};   $self->{'effectivewidth'}=$self->{'width'} * $self->{'rows'};
131    
132   $self->{'svg'}=SVG->new();   $self->{'svg'}=SVG->new(-xmlns=>"http://www.w3.org/2000/svg");
133    
134   return $self;   return $self;
135  }  }
# Line 193  Line 193 
193   $self->_draw_image unless ($self->{'drawn'});   $self->_draw_image unless ($self->{'drawn'});
194   $self->_hz_lines if ($self->{'genome_lines'});   $self->_hz_lines if ($self->{'genome_lines'});
195    
196   open (OUT, ">$file")  || die "Can't open $file";   open (OUT, ">$file.tmp")  || die "Can't open $file";
197   print OUT $self->{'svg'}->xmlify;   print OUT $self->{'svg'}->xmlify;
198   close OUT;   close OUT;
199    
200    # just fix the header definition
201     open(IN, "$file.tmp") || die "Can't open $file.tmp";
202     open(OUT, ">$file") || die "Can't open $file";
203     while (<IN>)
204     {
205        if (m#\<svg height\=\"100\%\" width\=\"100\%\" xml\:xlink\=\"http\://www.w3.org/1999/xlink\"\>#)
206        {
207            print OUT '<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg"  xmlns:xlink="http://www.w3.org/1999/xlink">', "\n";
208        }
209        else {print OUT}
210     }
211     close IN;
212     close OUT;
213     unlink ("$file.tmp");
214    
215    
216   my $height=(1 + $self->{'rowcount'}) * (((scalar (keys %{$self->{'trackposn'}})) * $self->{'box_height'}* 3) + $self->{'top_marg'}+ $self->{'box_height'} + $self->{'bot_marg'}) +  $self->{'top_marg'}+ $self->{'bot_marg'};   my $height=(1 + $self->{'rowcount'}) * (((scalar (keys %{$self->{'trackposn'}})) * $self->{'box_height'}* 3) + $self->{'top_marg'}+ $self->{'box_height'} + $self->{'bot_marg'}) +  $self->{'top_marg'}+ $self->{'bot_marg'};
217    
218   print STDERR "The image should be width: ", $self->{'width'}, " height: $height\n";   print STDERR "The image should be width: ", $self->{'width'}, " height: $height\n";
219     print STDERR "The image is in $file\n";
220    
  print STDERR "Image is in $file\n";  
  print STDERR "Processing took ", time-$^T, " seconds\n";  
221   return ($self->{'width'}, $height);   return ($self->{'width'}, $height);
222  }  }
223    
# Line 302  Line 317 
317      $self->{'rowcount'}++;      $self->{'rowcount'}++;
318      push (@{$self->{'contigrows'}->{$contig}}, $self->{'rowcount'});      push (@{$self->{'contigrows'}->{$contig}}, $self->{'rowcount'});
319     }     }
320       #$self->{'rowcount'}++;
321       #push (@{$self->{'contigrows'}->{$contig}}, $self->{'rowcount'});
322     $offset=$self->{'rowinfo'}->{$self->{'rowcount'}}->{$contig}->{'end'}=$rowend;     $offset=$self->{'rowinfo'}->{$self->{'rowcount'}}->{$contig}->{'end'}=$rowend;
323     #### End added  rowinfo section     #### End added  rowinfo section
324    }    }
# Line 358  Line 375 
375    my @loc=$fig->feature_location($peg);    my @loc=$fig->feature_location($peg);
376    $loc[0] =~ m/^(.*)\_(\d+)\_(\d+)$/;    $loc[0] =~ m/^(.*)\_(\d+)\_(\d+)$/;
377    my ($contig, $start, $stop)=($1, $2, $3);    my ($contig, $start, $stop)=($1, $2, $3);
378    my $len=$stop-$start;    my $len=abs($stop-$start);
379    
380    # if the orf is in the same direction want the sim on top, if not want it below    # if the orf is in the same direction want the sim on top, if not want it below
381    my $x=$self->{'xoffset'}->{$contig} + (($start/$self->{'totallen'}) * $self->{'xmultiplier'});    my $x=$self->{'xoffset'}->{$contig} + (($start/$self->{'totallen'}) * $self->{'xmultiplier'});
# Line 367  Line 384 
384    # figure out the correct row for the current location. The row is after we have split up the genome    # figure out the correct row for the current location. The row is after we have split up the genome
385    my $row;    my $row;
386    foreach my $addrow (@{$self->{'contigrows'}->{$contig}}) {    foreach my $addrow (@{$self->{'contigrows'}->{$contig}}) {
387     if ($x >= $self->{'rowinfo'}->{$addrow}->{$contig}->{'start'} && $x < $self->{'rowinfo'}->{$addrow}->{$contig}->{'end'}) {$row=$addrow; last}     if (abs($x) >= abs($self->{'rowinfo'}->{$addrow}->{$contig}->{'start'}) && abs($x) <= abs($self->{'rowinfo'}->{$addrow}->{$contig}->{'end'})) {$row=$addrow; last}
388       elsif (abs($x) <= abs($self->{'rowinfo'}->{$addrow}->{$contig}->{'start'}) && abs($x) >= abs($self->{'rowinfo'}->{$addrow}->{$contig}->{'end'})) {$row=$addrow; last}
389       #if ($x >= $self->{'rowinfo'}->{$addrow}->{$contig}->{'start'} && $x < $self->{'rowinfo'}->{$addrow}->{$contig}->{'end'}) {$row=$addrow; last}
390    }    }
391    unless (defined $row) {    unless (defined $row) {
392     print STDERR "Couldn't get a row for $contig looking for a start of $x (real start: $start). These are the starts:\n";     print STDERR "Couldn't get a row for $contig looking for a start of $x (real start: $start). These are the starts:\n";

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3