<commit_before># 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env perl

package Bio::EnsEMBL::Analysis::Hive::RunnableDB::HiveSubmitAnalysis;

use strict;
use warnings;
use feature 'say';

use Bio::EnsEMBL::Hive::Utils qw(destringify);
use Bio::EnsEMBL::Analysis::Tools::Utilities qw(hrdb_get_dba);
use Bio::EnsEMBL::Utils::Slice qw(split_Slices);

use parent ('Bio::EnsEMBL::Hive::RunnableDB::JobFactory');


=head2 param_defaults

 Description: It allows the definition of default parameters for all inherting module.
              These are the default values:
               include_non_reference => 0,
               include_duplicates => 0,
               include_lrg => 0, #This one should never be used but it's here for compatibility
               mitochondrion => 0,
               slice_size => 0,
               slice_overlaps => 0,
               coord_system_name => 'toplevel',
               coord_system_version => undef,
               stable_id_prefix => 'ENS',
               region_padding => 10000,
               use_annotation => 0,
               batch_target_size => 1000000,
               table_column_name => 'accession',
               column_names => ['iid'],
 Returntype : Hashref, containing all default parameters
 Exceptions : None

=cut

sub param_defaults {
    my $self = shift;

    return {
        %{$self->SUPER::param_defaults},
        include_non_reference => 0,
        include_duplicates => 0,
        include_lrg => 0, #This one should never be used but it's here for compatibility
        mitochondrion => 0,
        use_annotation => 0,
        batch_slice_ids => 0,
        slice_size => 0,
        slice_overlaps => 0,
        coord_system_name => 'toplevel',
        coord_system_version => undef,
        stable_id_prefix => 'ENS',
        region_padding => 10000,
        batch_target_size => 1000000,
        table_column_name => 'accession',
        column_names => ['iid'],
    }
}


=head2 fetch_input

 Arg [1]    : None
 Description: It will create input ids for the next analysis using 'iid_type' and
              other parameters
 Returntype : Integer, 1
 Exceptions : None

=cut

sub fetch_input {
  my $self = shift;

  my $iid_type = $self->param_required('iid_type');
  if($iid_type eq 'chunk') {
    $self->create_chunk_ids();
  } elsif($iid_type eq 'sequence_accession') {
    $self->sequence_accession();
  } elsif($iid_type eq 'rechunk') {
    $self->rechunk_input_ids();
  } else {
      $self->param('target_db', destringify($self->param('target_db'))) if (ref($self->param('target_db')) ne 'HASH');
      my $dba = hrdb_get_dba($self->param('target_db'));
      if($iid_type eq 'slice') {
        $self->create_slice_ids($dba);
      } elsif($iid_type eq 'split_slice') {
        # Not sure it's the correct call but Core has a split_Slice method
        # so it's better to use it
        $self->split_slice($dba);
      } elsif($iid_type eq 'patch_slice') {
        $self->create_slice_ids($dba);
      } elsif($iid_type eq 'slice_to_feature_ids') {
        $self->convert_slice_to_feature_ids($dba);
      } elsif($iid_type eq 'feature_region') {
        $self->feature_region($dba);
      } elsif($iid_type eq 'feature_id') {
        $self->feature_id($dba);
      } else {
        $self->throw('You have not specified one of the recognised operation types');
      }
  }
}


=head2 create_slice_ids

 Arg [1]    : Bio::EnsEMBL::DBSQL::DBAdaptor
 Description: Create input ids based on slices using a Bio::EnsEMBL::Pipeline::Hive::HiveInputIDFactory
              It stores the input ids in 'inputlist'
 Returntype : None
 Exceptions : None

=cut

sub create_slice_ids {
  my ($self, $dba) = @_;
<commit_msg>Bug fix: 'include_non_reference' should be 1 for 'patch_slice'.<commit_after># 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env perl

package Bio::EnsEMBL::Analysis::Hive::RunnableDB::HiveSubmitAnalysis;

use strict;
use warnings;
use feature 'say';

use Bio::EnsEMBL::Hive::Utils qw(destringify);
use Bio::EnsEMBL::Analysis::Tools::Utilities qw(hrdb_get_dba);
use Bio::EnsEMBL::Utils::Slice qw(split_Slices);

use parent ('Bio::EnsEMBL::Hive::RunnableDB::JobFactory');


=head2 param_defaults

 Description: It allows the definition of default parameters for all inherting module.
              These are the default values:
               include_non_reference => 0,
               include_duplicates => 0,
               include_lrg => 0, #This one should never be used but it's here for compatibility
               mitochondrion => 0,
               slice_size => 0,
               slice_overlaps => 0,
               coord_system_name => 'toplevel',
               coord_system_version => undef,
               stable_id_prefix => 'ENS',
               region_padding => 10000,
               use_annotation => 0,
               batch_target_size => 1000000,
               table_column_name => 'accession',
               column_names => ['iid'],
 Returntype : Hashref, containing all default parameters
 Exceptions : None

=cut

sub param_defaults {
    my $self = shift;

    return {
        %{$self->SUPER::param_defaults},
        include_non_reference => 0,
        include_duplicates => 0,
        include_lrg => 0, #This one should never be used but it's here for compatibility
        mitochondrion => 0,
        use_annotation => 0,
        batch_slice_ids => 0,
        slice_size => 0,
        slice_overlaps => 0,
        coord_system_name => 'toplevel',
        coord_system_version => undef,
        stable_id_prefix => 'ENS',
        region_padding => 10000,
        batch_target_size => 1000000,
        table_column_name => 'accession',
        column_names => ['iid'],
    }
}


=head2 fetch_input

 Arg [1]    : None
 Description: It will create input ids for the next analysis using 'iid_type' and
              other parameters
 Returntype : Integer, 1
 Exceptions : None

=cut

sub fetch_input {
  my $self = shift;

  my $iid_type = $self->param_required('iid_type');
  if($iid_type eq 'chunk') {
    $self->create_chunk_ids();
  } elsif($iid_type eq 'sequence_accession') {
    $self->sequence_accession();
  } elsif($iid_type eq 'rechunk') {
    $self->rechunk_input_ids();
  } else {
      $self->param('target_db', destringify($self->param('target_db'))) if (ref($self->param('target_db')) ne 'HASH');
      my $dba = hrdb_get_dba($self->param('target_db'));
      if($iid_type eq 'slice') {
        $self->create_slice_ids($dba);
      } elsif($iid_type eq 'split_slice') {
        # Not sure it's the correct call but Core has a split_Slice method
        # so it's better to use it
        $self->split_slice($dba);
      } elsif($iid_type eq 'patch_slice') {
        $self->param('include_non_reference',1);
        $self->create_slice_ids($dba);
      } elsif($iid_type eq 'slice_to_feature_ids') {
        $self->convert_slice_to_feature_ids($dba);
      } elsif($iid_type eq 'feature_region') {
        $self->feature_region($dba);
      } elsif($iid_type eq 'feature_id') {
        $self->feature_id($dba);
      } else {
        $self->throw('You have not specified one of the recognised operation types');
      }
  }
}


=head2 create_slice_ids

 Arg [1]    : Bio::EnsEMBL::DBSQL::DBAdaptor
 Description: Create input ids based on slices using a Bio::EnsEMBL::Pipeline::Hive::HiveInputIDFactory
              It stores the input ids in 'inputlist'
 Returntype : None
 Exceptions : None

=cut

sub create_slice_ids {
  my ($self, $dba) = @_;

{'fraction_non_alphanumeric': 0.11221832182085834, 'fraction_numerical': 0.014947344581587588, 'mean_word_length': 3.005442176870748, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 94, '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': '6079078', 'n_tokens_mistral': 2842, 'n_tokens_neox': 2669, 'n_words': 756}