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 {
} elsif($table_name eq 'accu') {
return Bio::EnsEMBL::Hive::Accumulator->new(
adaptor => $dba->get_AccumulatorAdaptor,
$dba ? (adaptor => $dba->get_AccumulatorAdaptor) : (),
struct_name => $tparam_name,
signature_template => $tparam_value,
);
......@@ -123,9 +123,9 @@ sub fetch {
} else {
return Bio::EnsEMBL::Hive::NakedTable->new(
adaptor => $dba->get_NakedTableAdaptor,
$dba ? (adaptor => $dba->get_NakedTableAdaptor) : (),
table_name => $table_name,
$tparam_value ? (insertion_method => $tparam_value) : ()
$tparam_value ? (insertion_method => $tparam_value) : (),
);
}
}
......
......@@ -75,7 +75,7 @@ sub new {
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 : () );
$self->config($config);
$self->context( [ 'Graph' ] );
......@@ -104,7 +104,7 @@ sub graph {
}
=head2 dba()
=head2 hive_dba()
Arg [1] : The DBAdaptor instance
Returntype : DBAdaptor
......@@ -113,14 +113,14 @@ sub graph {
=cut
sub dba {
sub hive_dba {
my $self = shift @_;
if(@_) {
$self->{dba} = shift @_;
$self->{'hive_dba'} = shift @_;
}
return $self->{dba};
return $self->{'hive_dba'};
}
......@@ -162,9 +162,7 @@ sub _midpoint_name {
sub build {
my ($self) = @_;
my $hive_dba = $self->dba;
Bio::EnsEMBL::Hive->load_collections_from_dba( $hive_dba );
my $hive_dba = $self->hive_dba;
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 ) {
......@@ -234,7 +232,7 @@ sub build {
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'}) {
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 {
}
$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 ) {
$analysis_label .= qq{<tr><td colspan="$colspan"> </td></tr>};
if( $display_stats eq 'barchart') {
......@@ -517,7 +515,7 @@ sub _add_table_node {
my $node_fontname = $self->config_get('Node', 'Table', 'Font');
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 ) {
$naked_table_adaptor->table_name( $table_name );
......
......@@ -12,10 +12,12 @@ BEGIN {
}
use Getopt::Long;
use Getopt::Long qw(:config pass_through no_auto_abbrev);
use Pod::Usage;
use Bio::EnsEMBL::Hive;
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'load_file_or_module');
use Bio::EnsEMBL::Hive::Utils::Graph;
main();
......@@ -33,8 +35,10 @@ sub main {
'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
'pipeconfig|pc=s' => \$self->{'pipeconfig'},
'f|format=s' => \$self->{'format'},
'o|output=s' => \$self->{'output'},
'o|out|output=s' => \$self->{'output'},
'h|help' => \$self->{'help'},
);
......@@ -43,22 +47,6 @@ sub main {
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'}) {
pod2usage({
-message => 'ERROR: No -output flag given',
......@@ -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 $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