<commit_before>#!/usr/bin/env perl

# A generic script for creating Hive pipelines from PipeConfig module files (see below for docs)

use strict;
use warnings;

    # Finding out own path in order to reference own components (including own modules):
use Cwd            ();
use File::Basename ();
BEGIN {
    $ENV{'EHIVE_ROOT_DIR'} ||= File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
    unshift @INC, $ENV{'EHIVE_ROOT_DIR'}.'/modules';
}

use Getopt::Long qw(:config pass_through no_auto_abbrev);
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'load_file_or_module');
use Bio::EnsEMBL::Hive::Scripts::InitPipeline;

sub main {
    my $deprecated_option   = {};
    my $tweaks              = [];
    my $help;

    GetOptions(
        'analysis_topup!'   => \$deprecated_option->{'analysis_topup'},     # always on
        'job_topup!'        => \$deprecated_option->{'job_topup'},          # never, use seed_pipeline.pl
        'tweak|SET=s@'      => \$tweaks,
        'DELETE=s'          => sub { my ($opt_name, $opt_value) = @_; push @$tweaks, $opt_value.'#'; },
        'SHOW=s'            => sub { my ($opt_name, $opt_value) = @_; push @$tweaks, $opt_value.'?'; },
	'h|help!'           => \$help,
    );

    if ($help) { script_usage(0) };

    if($deprecated_option->{'job_topup'}) {
        die "-job_topup mode has been discontinued. Please use seed_pipeline.pl instead.\n";
    }
    if($deprecated_option->{'analysis_topup'}) {
        die "-analysis_topup has been deprecated. Please note this script now *always* runs in -analysis_topup mode.\n";
    }

    
    my $file_or_module = shift @ARGV or script_usage(0);

    Bio::EnsEMBL::Hive::Scripts::InitPipeline::init_pipeline($file_or_module, $tweaks);
}

main();

__DATA__

=pod

=head1 NAME

    init_pipeline.pl

=head1 SYNOPSIS

    init_pipeline.pl <config_module_or_filename> [<options_for_this_particular_pipeline>]

=head1 DESCRIPTION

    init_pipeline.pl is a generic script that is used to create+setup=initialize eHive pipelines from PipeConfig configuration modules.

=head1 USAGE EXAMPLES

        # get this help message:
    init_pipeline.pl

        # initialize a generic eHive pipeline:
    init_pipeline.pl Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf -password <<PASSWORD>>

        # initialize the long multiplicaton pipeline by supplying not only mandatory but also optional data:
        #   (assuming your current directory is ensembl-hive/modules/Bio/EnsEMBL/Hive/PipeConfig) :
    init_pipeline.pl LongMult_conf -password <<PASSWORD>> -first_mult 375857335 -second_mult 1111333355556666 

=head1 OPTIONS

    -hive_force_init <0|1> :  If set to 1, forces the (re)creation of the hive database even if a previous version of it is present in the server.
    -tweak <string>        :  Apply tweaks to the pipeline. See tweak_pipeline.pl for details of tweaking syntax
    -DELETE                :  Delete pipeline parameter (shortcut for tweak DELETE)
    -SHOW                  :  Show  pipeline parameter  (shortcut for tweak SHOW)
    -h | --help            :  Show this help message

=head1 LICENSE

    Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
    Copyright [2016-2017] EMBL-European Bioinformatics Institute

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0
<commit_msg>Added -hive_no_init to the POD of init_pipeline.pl<commit_after>#!/usr/bin/env perl

# A generic script for creating Hive pipelines from PipeConfig module files (see below for docs)

use strict;
use warnings;

    # Finding out own path in order to reference own components (including own modules):
use Cwd            ();
use File::Basename ();
BEGIN {
    $ENV{'EHIVE_ROOT_DIR'} ||= File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
    unshift @INC, $ENV{'EHIVE_ROOT_DIR'}.'/modules';
}

use Getopt::Long qw(:config pass_through no_auto_abbrev);
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'load_file_or_module');
use Bio::EnsEMBL::Hive::Scripts::InitPipeline;

sub main {
    my $deprecated_option   = {};
    my $tweaks              = [];
    my $help;

    GetOptions(
        'analysis_topup!'   => \$deprecated_option->{'analysis_topup'},     # always on
        'job_topup!'        => \$deprecated_option->{'job_topup'},          # never, use seed_pipeline.pl
        'tweak|SET=s@'      => \$tweaks,
        'DELETE=s'          => sub { my ($opt_name, $opt_value) = @_; push @$tweaks, $opt_value.'#'; },
        'SHOW=s'            => sub { my ($opt_name, $opt_value) = @_; push @$tweaks, $opt_value.'?'; },
	'h|help!'           => \$help,
    );

    if ($help) { script_usage(0) };

    if($deprecated_option->{'job_topup'}) {
        die "-job_topup mode has been discontinued. Please use seed_pipeline.pl instead.\n";
    }
    if($deprecated_option->{'analysis_topup'}) {
        die "-analysis_topup has been deprecated. Please note this script now *always* runs in -analysis_topup mode.\n";
    }

    
    my $file_or_module = shift @ARGV or script_usage(0);

    Bio::EnsEMBL::Hive::Scripts::InitPipeline::init_pipeline($file_or_module, $tweaks);
}

main();

__DATA__

=pod

=head1 NAME

    init_pipeline.pl

=head1 SYNOPSIS

    init_pipeline.pl <config_module_or_filename> [<options_for_this_particular_pipeline>]

=head1 DESCRIPTION

    init_pipeline.pl is a generic script that is used to create+setup=initialize eHive pipelines from PipeConfig configuration modules.

=head1 USAGE EXAMPLES

        # get this help message:
    init_pipeline.pl

        # initialize a generic eHive pipeline:
    init_pipeline.pl Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf -password <<PASSWORD>>

        # initialize the long multiplicaton pipeline by supplying not only mandatory but also optional data:
        #   (assuming your current directory is ensembl-hive/modules/Bio/EnsEMBL/Hive/PipeConfig) :
    init_pipeline.pl LongMult_conf -password <<PASSWORD>> -first_mult 375857335 -second_mult 1111333355556666 

=head1 OPTIONS

    -hive_force_init <0|1> :  If set to 1, forces the (re)creation of the hive database even if a previous version of it is present in the server.
    -hive_no_init <0|1>    :  If set to 1, does not run the pipeline_create_commands section of the pipeline. Useful to "top-up" an existing database.
    -tweak <string>        :  Apply tweaks to the pipeline. See tweak_pipeline.pl for details of tweaking syntax
    -DELETE                :  Delete pipeline parameter (shortcut for tweak DELETE)
    -SHOW                  :  Show  pipeline parameter  (shortcut for tweak SHOW)
    -h | --help            :  Show this help message

=head1 LICENSE

    Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
    Copyright [2016-2017] EMBL-European Bioinformatics Institute

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

{'fraction_non_alphanumeric': 0.11091209699641774, 'fraction_numerical': 0.016120143290162578, 'mean_word_length': 3.2574780058651025, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '205718', 'n_tokens_mistral': 2405, 'n_tokens_neox': 2248, 'n_words': 665}