existed previously, and multiple replacement gene boxes are required,
a new group will be created.
-If an original gene had multiple instances displayed on the pathway
-diagram, each instance will be subjected to the replacement process.
+If an original gene had multiple instances (homologs) displayed on the pathway
+diagram, each instance will be subjected to the replacement process. There
+is a "heat-map" option avaliable to help highlight homolog sets.
There is also an option to read in an extra column of gene symbols, if the
user wishes to provide their own. Otherwise, the application will
the purpose of multi-species pathway comparison or host-pathogen
interaction diagrams).
-Add a "heat-map" effect by making large paralog sets "hotter".
-
=head1 USAGE
pathway_gene_swapper.pl -i INPUT_FILE -g GENE_FILE -c CONFIG_FILE -o OUTPUT_FILE -L -v -G -d
(NOTE: if no path supplied for input files,
current working directory is assumed)
-s use provided gene symbols instead of config file's LabelPrefix
- -h apply a heat-map to any multi-mapped set of paralogs
- (NOTE: precludes custom box-coloring for paralogs)
+ -h apply a heat-map to any multi-mapped set of homologs
+ (NOTE: precludes custom box-coloring for homologs)
-L Remove literature references.
-v View verbose information
-G Display GPML input/output documents
my $gpml_doc; # imported GPML data for manipulation and output
my %unmapped_genes; # original genes not mapped to homologs
my %gradient; # blue-red gradient used for opt. heat map box-coloring
+my $max_homolog_count = 0; # count for heat map calibration
$Data::Dumper::Pad = "... ";
# ---------------------------------------------------------------------------
-=item B<void set_gradient()>
-Sets the blue-red gradient
+=item B<hash set_gradient(int $max_homolog_count)>
+Accepts: The maximum number of homologs for one gene in this data set
+Creates a blue-red gradient and stores it in a hash.
+Returns: A hash of RRGGBB color values, keyed to the number set of
+possible homologs (1..n).
=cut
# ---------------------------------------------------------------------------
sub set_gradient($)
{
my @blue_red_array;
+
for (my $i=0; $i<256; $i++) {
push @blue_red_array, [$i, 0, (255-$i)];
}
- # print Dumper(@blue_red_array) . "\n\n";
-
register_gradient("blue_red",\@blue_red_array);
- # print "[Available Gradients]";
- # print Dumper(available_gradients()) . "\n\n";
- # print Dumper(gradient("blue_red")) . "\n\n";
-
my %blue_red_gradient;
-
my $max_grad = $_[0];
my $inc = sprintf("%.2f", 1/$max_grad);
my $count = 1;
- # print "Increment: $inc\n";
+
for (my $i=$inc; $i<=0.99; $i=$i+$inc) {
- #print "$i\n";
- #print grad2rgb("blue_red",$i) . "\n";
my $tmp_hex = grad2rgb("blue_red",$i);
- $tmp_hex =~ s/\#//;
+ $tmp_hex =~ s/\#//;
$blue_red_gradient{$count} = $tmp_hex;
$count++;
}
- # print "[My Gradient Hash]\n";
- print Dumper(%blue_red_gradient) . "\n\n";
return %blue_red_gradient;
}
# determine the original gene(s) with the highest # of homologs in the new
# gene set
- my $max_homolog_count = 0; # count for heat map calibration
my @most_popular_genes; # identity of the gene(s) with the highest number of homologs
foreach my $orig_gene_key (keys %swap_genes)
{
# makes sure each box is increasingly offset from the original
# (in all three dimensions)
my $offset_multiplier = 0;
- my $gene_suffix_counter = 0; # used to affix numbers to multiple new gene symbols
+ my $gene_suffix_counter = 0; # used to affix numbers to multiple new gene symbols
+ # used to track the application of the gradient in reverse
+ my $new_nodes_dec = scalar(@new_nodes_map) + 1;
# for new nodes ary
for (@new_nodes_map)
if (scalar(@new_nodes_map) > 1)
{
$gene_suffix_counter++;
+ $new_nodes_dec--;
}
my $curr_new_node = $$_[0];
# change box width and colors (<Graphics...Color="4488ff" ... />)
my $curr_graphics = ($curr_new_node->getElementsByTagName("Graphics"))[0];
$curr_graphics->setAttribute("Width",$configs{"BoxWidth"});
- if ($configs{"BoxBorder"}) {
- $curr_graphics->setAttribute("Color",$configs{"BoxBorder"}); }
- # add "heat" to genes with multiple paralogs
+ # add "heat" to genes with multiple homologs
if ($apply_homolog_heat && ($gene_suffix_counter > 0))
{
- $curr_graphics->setAttribute("FillColor",$gradient{$gene_suffix_counter});
+ $curr_graphics->setAttribute("FillColor", $gradient{$new_nodes_dec});
+ $curr_graphics->setAttribute("Color","8888ff");
}
else
{
if ($configs{"BoxColor"}) {
$curr_graphics->setAttribute("FillColor",$configs{"BoxColor"}); }
+ if ($configs{"BoxBorder"}) {
+ $curr_graphics->setAttribute("Color",$configs{"BoxBorder"}); }
}
if ($is_first_homolog)