Commit f42bf84b authored by Leo Gordon's avatar Leo Gordon
Browse files

support different bgcolours for the main and the foreign pipelines (and telling which is which)

parent 67dd8cc9
......@@ -206,17 +206,17 @@ sub build {
}
}
if($self->config_get('DisplaySemaphoreBoxes') ) {
my %cluster_2_nodes = ();
my %cluster_2_nodes = ();
if( $self->config_get('DisplayDetails') ) {
foreach my $pipeline ( $main_pipeline, values %{Bio::EnsEMBL::Hive::TheApiary->pipelines_collection} ) {
my $pipelabel_node_name = $self->_add_pipeline_label( $pipeline );
if( $self->config_get('DisplayDetails') ) {
foreach my $pipeline ( $main_pipeline, values %{Bio::EnsEMBL::Hive::TheApiary->pipelines_collection} ) {
my $pipelabel_node_name = $self->_add_pipeline_label( $pipeline );
push @{$cluster_2_nodes{ $pipeline->hive_pipeline_name } }, $pipelabel_node_name;
}
push @{$cluster_2_nodes{ $pipeline->hive_pipeline_name } }, $pipelabel_node_name;
}
}
if($self->config_get('DisplaySemaphoreBoxes') ) {
foreach my $analysis ( $main_pipeline->collection_of('Analysis')->list, values %{ $self->{'_foreign_analyses'} } ) {
push @{$cluster_2_nodes{ _cluster_name( $analysis->{'_funnel_dfr'} ) } }, $self->_analysis_node_name( $analysis );
......@@ -239,8 +239,10 @@ sub build {
}
$self->graph->cluster_2_nodes( \%cluster_2_nodes );
$self->graph->colour_scheme( $self->config_get('Box', 'ColourScheme') );
$self->graph->colour_offset( $self->config_get('Box', 'ColourOffset') );
$self->graph->main_pipeline_name( $main_pipeline->hive_pipeline_name );
$self->graph->semaphore_bgcolour( [$self->config_get('Box', 'ColourScheme'), $self->config_get('Box', 'ColourOffset')] );
$self->graph->main_pipeline_bgcolour( ['pastel19', 3] );
$self->graph->other_pipeline_bgcolour( ['pastel19', 8] );
}
return $self->graph();
......@@ -597,9 +599,11 @@ sub _add_table_node {
$table_label .= '</table>>';
$self->graph()->add_node( $this_table_node_name,
label => $table_label,
shape => 'record',
fontname => $node_fontname,
label => $table_label,
shape => 'record',
fontname => $node_fontname,
style => 'filled',
fillcolor => 'white',
);
return $this_table_node_name;
......
......@@ -48,43 +48,65 @@ sub cluster_2_nodes {
}
sub colour_scheme {
sub main_pipeline_name {
my $self = shift @_;
if(@_) {
$self->{_colour_scheme} = shift @_;
$self->{_main_pipeline_name} = shift @_;
}
return $self->{_colour_scheme};
return $self->{_main_pipeline_name};
}
sub colour_offset {
sub semaphore_bgcolour {
my $self = shift @_;
if(@_) {
$self->{_colour_offset} = shift @_;
$self->{_semaphore_bgcolour} = shift @_;
}
return $self->{_colour_offset};
return $self->{_semaphore_bgcolour};
}
sub main_pipeline_bgcolour {
my $self = shift @_;
if(@_) {
$self->{_main_pipeline_bgcolour} = shift @_;
}
return $self->{_main_pipeline_bgcolour};
}
sub other_pipeline_bgcolour {
my $self = shift @_;
if(@_) {
$self->{_other_pipeline_bgcolour} = shift @_;
}
return $self->{_other_pipeline_bgcolour};
}
sub display_subgraph {
my ($self, $cluster_name, $depth) = @_;
my $colour_scheme = $self->colour_scheme();
my $colour_offset = $self->colour_offset();
my $box_colour = $depth
? $self->semaphore_bgcolour
: ( $cluster_name eq $self->main_pipeline_name)
? $self->main_pipeline_bgcolour
: $self->other_pipeline_bgcolour;
my $prefix = "\t" x $depth;
my $text = '';
$text .= $prefix . "subgraph cluster_${cluster_name} {\n";
my $text = '';
$text .= $prefix . "subgraph cluster_${cluster_name} {\n";
# uncomment the following line to see the cluster names:
# $text .= $prefix . "\tlabel=\"$cluster_name\";\n";
if($depth) {
$text .= $prefix . "\tcolorscheme=$colour_scheme;\n";
$text .= $prefix . "\tstyle=filled;\n";
if(ref($box_colour)) { # it must be a (scheme,offset) pair arrayref:
my ($colour_scheme, $colour_offset) = @$box_colour;
$text .= $prefix . "\tcolorscheme=$colour_scheme;\n";
$text .= $prefix . "\tcolor=".($depth+$colour_offset).";\n";
} else { # it's just a simple colour:
$text .= $prefix . "\tcolor=${box_colour};\n";
}
foreach my $node_name ( @{ $self->cluster_2_nodes->{ $cluster_name } || [] } ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment