6 # Finding out own path in order to reference own components (including own modules):
10 $ENV{
'EHIVE_ROOT_DIR'} ||= File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
11 unshift @INC, $ENV{
'EHIVE_ROOT_DIR'}.
'/modules';
14 use Getopt::Long qw(:config pass_through no_auto_abbrev);
32 # connection parameters
33 'url=s' => \$self->{
'url'},
34 'reg_conf|reg_file=s' => \$self->{
'reg_conf'},
35 'reg_type=s' => \$self->{
'reg_type'},
36 'reg_alias|reg_name=s' => \$self->{
'reg_alias'},
37 'nosqlvc' => \$self->{
'nosqlvc'}, #
using "nosqlvc" instead of
"sqlvc!" for consistency with scripts where it is a propagated option
40 'config_file=s@' => \$self->{
'config_files'},
42 'pipeconfig|pc=s@' => \$self->{
'pipeconfigs'}, # now an array
44 'f|format=s' => \$self->{
'format'},
45 'o|out|output=s' => \$self->{
'output'},
47 'h|help' => \$self->{
'help'},
51 pod2usage({-exitvalue => 0, -verbose => 2});
54 if($self->{
'url'} or $self->{
'reg_alias'}) {
56 -url => $self->{
'url'},
57 -reg_conf => $self->{
'reg_conf'},
58 -reg_type => $self->{
'reg_type'},
59 -reg_alias => $self->{
'reg_alias'},
60 -no_sql_schema_version_check => $self->{
'nosqlvc'},
65 die
"A pipeline has to be given, either via -url/-reg* or via -pipeconfig" unless $self->{
'pipeconfigs'};
68 foreach my $pipeconfig (@{ $self->{
'pipeconfigs'} || [] }) {
69 my $pipeconfig_package_name = load_file_or_module( $pipeconfig );
71 my $pipeconfig_object = $pipeconfig_package_name->new();
72 $pipeconfig_object->process_options( 0 );
74 $pipeconfig_object->add_objects_from_config( $self->{
'pipeline'} );
77 if($self->{
'output'} or $self->{
'format'}) {
79 if(!$self->{
'format'}) {
80 if($self->{
'output'}=~/\.(\w+)$/) {
81 $self->{
'format'} = $1;
83 die
"Format was not set and could not guess from ".$self->{
'output'}.
". Please use either way to select it.\n";
87 if($self->{
'format'} eq
'txt') {
90 open (STDOUT,
'>', $self->{
'output'}); # redirect STDOUT to $self->{
'output'}
92 $self->{
'pipeline'}->print_diagram; # and capture the Unicode diagram in a text file
97 $self->{
'config_files'} ? @{ $self->{
'config_files'} } : ()
99 my $graphviz = $graph->
build();
101 if( $self->{
'format'} eq
'dot' ) { # If you need to take a look at the intermediate dot file
102 $graphviz->dot_input_filename( $self->{
'output'} || \*STDOUT);
103 $graphviz->as_canon(
'/dev/null' );
106 my $call =
'as_'.$self->{
'format'};
107 $graphviz->$call($self->{
'output'} || \*STDOUT);
112 $self->{
'pipeline'}->print_diagram;
115 print
"----------------------------------------------------------\n";
116 print
" Did you forget to specify the -output flowchart.png ? \n";
117 print
"----------------------------------------------------------\n";
132 generate_graph.pl -help
134 generate_graph.pl [ -url mysql:
138 This program will generate a graphical representation of your eHive pipeline.
139 This includes visualising the flow of data from the different analyses, blocking
140 rules and table writers. The graph is also coloured to indicate the stage
141 an Analysis is at. The colours and fonts used can be configured via
142 hive_config.json configuration file.
150 URL defining where eHive database is located
152 =item --reg_conf <path>
154 path to a Registry configuration file
156 =item --reg_alias <str>
158 species/alias name
for the eHive DBAdaptor
162 "No SQL Version Check" - set
if you want to force working with a database created by a potentially schema-incompatible API
164 =item --config_file <path>
166 Path to JSON eHive config file
168 =item --pipeconfig <path|module_name>
170 A pipeline configuration file that can
function both as the initial source of pipeline structure or as a top-up config.
171 This option can now be used multiple times
for multiple top-ups.
175 (Optional) specify the output format, or
override the output format specified by the output file
's extension
176 (e.g. png, jpeg, dot, gif, ps)
178 =item --output <path>
180 Location of the file to write to.
181 The file extension (.png , .jpeg , .dot , .gif , .ps) will define the output format.
185 Print this help message
189 =head1 EXTERNAL DEPENDENCIES
199 See the NOTICE file distributed with this work for additional information
200 regarding copyright ownership.
202 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
203 You may obtain a copy of the License at
205 http://www.apache.org/licenses/LICENSE-2.0
207 Unless required by applicable law or agreed to in writing, software distributed under the License
208 is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209 See the License for the specific language governing permissions and limitations under the License.
213 Please subscribe to the eHive mailing list: http://listserver.ebi.ac.uk/mailman/listinfo/ehive-users to discuss eHive-related questions or to be notified of our updates