Commit 9c3ae6f2 authored by Leo Gordon's avatar Leo Gordon
Browse files

added experimental option -pipeconfig to produce a diagram potentially without a database

parent 425cd656
...@@ -115,7 +115,7 @@ sub fetch { ...@@ -115,7 +115,7 @@ sub fetch {
} elsif($table_name eq 'accu') { } elsif($table_name eq 'accu') {
return Bio::EnsEMBL::Hive::Accumulator->new( return Bio::EnsEMBL::Hive::Accumulator->new(
adaptor => $dba->get_AccumulatorAdaptor, $dba ? (adaptor => $dba->get_AccumulatorAdaptor) : (),
struct_name => $tparam_name, struct_name => $tparam_name,
signature_template => $tparam_value, signature_template => $tparam_value,
); );
...@@ -123,9 +123,9 @@ sub fetch { ...@@ -123,9 +123,9 @@ sub fetch {
} else { } else {
return Bio::EnsEMBL::Hive::NakedTable->new( return Bio::EnsEMBL::Hive::NakedTable->new(
adaptor => $dba->get_NakedTableAdaptor, $dba ? (adaptor => $dba->get_NakedTableAdaptor) : (),
table_name => $table_name, table_name => $table_name,
$tparam_value ? (insertion_method => $tparam_value) : () $tparam_value ? (insertion_method => $tparam_value) : (),
); );
} }
} }
......
...@@ -75,7 +75,7 @@ sub new { ...@@ -75,7 +75,7 @@ sub new {
my $self = bless({}, ref($class) || $class); my $self = bless({}, ref($class) || $class);
$self->dba($hive_dba); $self->hive_dba($hive_dba);
my $config = Bio::EnsEMBL::Hive::Utils::Config->new( $config_file_name ? $config_file_name : () ); my $config = Bio::EnsEMBL::Hive::Utils::Config->new( $config_file_name ? $config_file_name : () );
$self->config($config); $self->config($config);
$self->context( [ 'Graph' ] ); $self->context( [ 'Graph' ] );
...@@ -104,7 +104,7 @@ sub graph { ...@@ -104,7 +104,7 @@ sub graph {
} }
=head2 dba() =head2 hive_dba()
Arg [1] : The DBAdaptor instance Arg [1] : The DBAdaptor instance
Returntype : DBAdaptor Returntype : DBAdaptor
...@@ -113,14 +113,14 @@ sub graph { ...@@ -113,14 +113,14 @@ sub graph {
=cut =cut
sub dba { sub hive_dba {
my $self = shift @_; my $self = shift @_;
if(@_) { if(@_) {
$self->{dba} = shift @_; $self->{'hive_dba'} = shift @_;
} }
return $self->{dba}; return $self->{'hive_dba'};
} }
...@@ -162,9 +162,7 @@ sub _midpoint_name { ...@@ -162,9 +162,7 @@ sub _midpoint_name {
sub build { sub build {
my ($self) = @_; my ($self) = @_;
my $hive_dba = $self->dba; my $hive_dba = $self->hive_dba;
Bio::EnsEMBL::Hive->load_collections_from_dba( $hive_dba );
if( my $job_limit = $self->config_get('DisplayJobs') and my $job_adaptor = $hive_dba && $hive_dba->get_AnalysisJobAdaptor ) { if( my $job_limit = $self->config_get('DisplayJobs') and my $job_adaptor = $hive_dba && $hive_dba->get_AnalysisJobAdaptor ) {
foreach my $analysis ( Bio::EnsEMBL::Hive->collection('Analysis')->list ) { foreach my $analysis ( Bio::EnsEMBL::Hive->collection('Analysis')->list ) {
...@@ -234,7 +232,7 @@ sub build { ...@@ -234,7 +232,7 @@ sub build {
push @{$cluster_2_nodes{ '' }}, _midpoint_name( $df_rule ); # top-level funnels define clusters (top-level "boxes") push @{$cluster_2_nodes{ '' }}, _midpoint_name( $df_rule ); # top-level funnels define clusters (top-level "boxes")
} elsif( UNIVERSAL::isa($df_rule->to_analysis,'Bio::EnsEMBL::Hive::NakedTable') ) { } elsif( UNIVERSAL::isa($df_rule->to_analysis, 'Bio::EnsEMBL::Hive::NakedTable') ) {
if(my $funnel = $df_rule->to_analysis->{'_funnel_dfr'}) { if(my $funnel = $df_rule->to_analysis->{'_funnel_dfr'}) {
push @{$cluster_2_nodes{ _midpoint_name( $funnel ) } }, $self->_table_node_name( $df_rule ); # table belongs to the same "box" as the dataflow source push @{$cluster_2_nodes{ _midpoint_name( $funnel ) } }, $self->_table_node_name( $df_rule ); # table belongs to the same "box" as the dataflow source
...@@ -355,7 +353,7 @@ sub _add_analysis_node { ...@@ -355,7 +353,7 @@ sub _add_analysis_node {
} }
$colspan ||= 1; $colspan ||= 1;
my $analysis_label = '<<table border="0" cellborder="0" cellspacing="0" cellpadding="1"><tr><td colspan="'.$colspan.'">'.$analysis->logic_name().' ('.$analysis->dbID.')</td></tr>'; my $analysis_label = '<<table border="0" cellborder="0" cellspacing="0" cellpadding="1"><tr><td colspan="'.$colspan.'">'.$analysis->logic_name().' ('.($analysis->dbID || '?').')</td></tr>';
if( $display_stats ) { if( $display_stats ) {
$analysis_label .= qq{<tr><td colspan="$colspan"> </td></tr>}; $analysis_label .= qq{<tr><td colspan="$colspan"> </td></tr>};
if( $display_stats eq 'barchart') { if( $display_stats eq 'barchart') {
...@@ -517,7 +515,7 @@ sub _add_table_node { ...@@ -517,7 +515,7 @@ sub _add_table_node {
my $node_fontname = $self->config_get('Node', 'Table', 'Font'); my $node_fontname = $self->config_get('Node', 'Table', 'Font');
my (@column_names, $columns, $table_data, $data_limit, $hit_limit); my (@column_names, $columns, $table_data, $data_limit, $hit_limit);
my $hive_dba = $self->dba; my $hive_dba = $self->hive_dba;
if( $data_limit = $self->config_get('DisplayData') and my $naked_table_adaptor = $hive_dba && $hive_dba->get_NakedTableAdaptor ) { if( $data_limit = $self->config_get('DisplayData') and my $naked_table_adaptor = $hive_dba && $hive_dba->get_NakedTableAdaptor ) {
$naked_table_adaptor->table_name( $table_name ); $naked_table_adaptor->table_name( $table_name );
......
...@@ -12,10 +12,12 @@ BEGIN { ...@@ -12,10 +12,12 @@ BEGIN {
} }
use Getopt::Long; use Getopt::Long qw(:config pass_through no_auto_abbrev);
use Pod::Usage; use Pod::Usage;
use Bio::EnsEMBL::Hive;
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor; use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'load_file_or_module');
use Bio::EnsEMBL::Hive::Utils::Graph; use Bio::EnsEMBL::Hive::Utils::Graph;
main(); main();
...@@ -33,8 +35,10 @@ sub main { ...@@ -33,8 +35,10 @@ sub main {
'reg_alias|reg_name=s' => \$self->{'reg_alias'}, 'reg_alias|reg_name=s' => \$self->{'reg_alias'},
'nosqlvc=i' => \$self->{'nosqlvc'}, # using "=i" instead of "!" for consistency with scripts where it is a propagated option 'nosqlvc=i' => \$self->{'nosqlvc'}, # using "=i" instead of "!" for consistency with scripts where it is a propagated option
'pipeconfig|pc=s' => \$self->{'pipeconfig'},
'f|format=s' => \$self->{'format'}, 'f|format=s' => \$self->{'format'},
'o|output=s' => \$self->{'output'}, 'o|out|output=s' => \$self->{'output'},
'h|help' => \$self->{'help'}, 'h|help' => \$self->{'help'},
); );
...@@ -43,22 +47,6 @@ sub main { ...@@ -43,22 +47,6 @@ sub main {
pod2usage({-exitvalue => 0, -verbose => 2}); pod2usage({-exitvalue => 0, -verbose => 2});
} }
if($self->{'url'} or $self->{'reg_alias'}) {
$self->{'dba'} = Bio::EnsEMBL::Hive::DBSQL::DBAdaptor->new(
-url => $self->{'url'},
-reg_conf => $self->{'reg_conf'},
-reg_type => $self->{'reg_type'},
-reg_alias => $self->{'reg_alias'},
-no_sql_schema_version_check => $self->{'nosqlvc'},
);
} else {
pod2usage({
-message => 'ERROR: Connection parameters (url or reg_conf+reg_alias) need to be specified',
-exitvalue => 1,
-verbose => 2
});
}
if(! $self->{'output'}) { if(! $self->{'output'}) {
pod2usage({ pod2usage({
-message => 'ERROR: No -output flag given', -message => 'ERROR: No -output flag given',
...@@ -75,6 +63,27 @@ sub main { ...@@ -75,6 +63,27 @@ sub main {
} }
} }
if($self->{'url'} or $self->{'reg_alias'}) {
$self->{'dba'} = Bio::EnsEMBL::Hive::DBSQL::DBAdaptor->new(
-url => $self->{'url'},
-reg_conf => $self->{'reg_conf'},
-reg_type => $self->{'reg_type'},
-reg_alias => $self->{'reg_alias'},
-no_sql_schema_version_check => $self->{'nosqlvc'},
);
Bio::EnsEMBL::Hive->load_collections_from_dba( $self->{'dba'} );
}
if($self->{'pipeconfig'}) {
my $pipeconfig_package_name = load_file_or_module( $self->{'pipeconfig'} );
my $pipeconfig_object = $pipeconfig_package_name->new();
$pipeconfig_object->process_options();
$pipeconfig_object->add_objects_from_config();
}
my $graph = Bio::EnsEMBL::Hive::Utils::Graph->new( $self->{'dba'} ); my $graph = Bio::EnsEMBL::Hive::Utils::Graph->new( $self->{'dba'} );
my $graphviz = $graph->build(); my $graphviz = $graph->build();
......
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