<commit_before>=head1 LICENSE

Copyright [1999-2014] Wellcome Trust Sanger Institute and the 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.

=cut

=head1 NAME

Bio::EnsEMBL::Compara::Homology - Homology between two proteins

=head1 DESCRIPTION

Homology is the object that stores orthology and paralogy data.
It inherits from AlignedMemberSet, and extends it on two aspects.
Firstly, each homology is reconciled with the gene tree and the
species tree. Secondly, we compute dN and dS values on some of the
homologies.

Please note that 1-to-many relations are stored as multiple pairs.
For instance, "hum" <-> ("rat1", "rat2") is stored as "hum" <-> "rat1"
and "hum" <-> "rat2".

=head1 INHERITANCE TREE

  Bio::EnsEMBL::Compara::Homology
  `- Bio::EnsEMBL::Compara::AlignedMemberSet

=head1 SYNOPSIS

Implemented methods:
 - description()

dN/dS values:
 - n()
 - s()
 - lnl()
 - threshold_on_ds()
 - dn()
 - ds()
 _ dnds_ratio()

Reconciliation with the gene tree:
 - is_tree_compliant()
 - gene_tree_node()
 - gene_tree()
 - species_tree_node()
 - taxonomy_level() (alias to species_tree_node()->node_name())

=head1 APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

=head1 METHODS

=cut

package Bio::EnsEMBL::Compara::Homology;

use strict;
use warnings;

use Bio::EnsEMBL::Utils::Exception qw(throw warning deprecate);

use base ('Bio::EnsEMBL::Compara::AlignedMemberSet');


=head2 is_tree_compliant

  Arg [1]    : float $is_tree_compliant (optional)
  Example    : $is_compliant = $homology->is_tree_compliant();
               $homology->is_tree_compliant(1);
  Description: getter/setter for a flag that shows whether the homology is fully compliant with the tree
  Returntype : int
  Exceptions : none
  Caller     : general<commit_msg>Added plain-text descriptions of the homology types<commit_after>=head1 LICENSE

Copyright [1999-2014] Wellcome Trust Sanger Institute and the 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.

=cut

=head1 NAME

Bio::EnsEMBL::Compara::Homology - Homology between two proteins

=head1 DESCRIPTION

Homology is the object that stores orthology and paralogy data.
It inherits from AlignedMemberSet, and extends it on two aspects.
Firstly, each homology is reconciled with the gene tree and the
species tree. Secondly, we compute dN and dS values on some of the
homologies.

Please note that 1-to-many relations are stored as multiple pairs.
For instance, "hum" <-> ("rat1", "rat2") is stored as "hum" <-> "rat1"
and "hum" <-> "rat2".

=head1 INHERITANCE TREE

  Bio::EnsEMBL::Compara::Homology
  `- Bio::EnsEMBL::Compara::AlignedMemberSet

=head1 SYNOPSIS

Implemented methods:
 - description()

dN/dS values:
 - n()
 - s()
 - lnl()
 - threshold_on_ds()
 - dn()
 - ds()
 _ dnds_ratio()

Reconciliation with the gene tree:
 - is_tree_compliant()
 - gene_tree_node()
 - gene_tree()
 - species_tree_node()
 - taxonomy_level() (alias to species_tree_node()->node_name())

=head1 APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

=head1 METHODS

=cut

package Bio::EnsEMBL::Compara::Homology;

use strict;
use warnings;

use Bio::EnsEMBL::Utils::Exception qw(throw warning deprecate);

use base ('Bio::EnsEMBL::Compara::AlignedMemberSet');


# These are the general-purpose full-text descriptions of the homology types
our %PLAIN_TEXT_DESCRIPTIONS = (

      ortholog_one2one          => '1-to-1 orthologues',
      ortholog_one2many         => '1-to-many orthologues',
      ortholog_many2many        => 'many-to-many orthologues',

      homoeolog_one2one         => '1-to-1 homoeologues',
      homoeolog_one2many        => '1-to-many homoeologues',
      homoeolog_many2many       => 'many-to-many homoeologues',

      within_species_paralog    => 'Paralogues (same species)',
      other_paralog             => 'Ancient paralogues (same species)',
      between_species_paralog   => 'Paralogues (different species)',

      gene_split                => 'Split genes',

      alt_allele                => 'Alternative alleles'
);


# These are context-aware descriptions used by the web-code
our %PLAIN_TEXT_WEB_DESCRIPTIONS = (

      %PLAIN_TEXT_DESCRIPTIONS,

      ortholog_one2one          => '1-to-1',
      ortholog_one2many         => '1-to-many',
      ortholog_many2many        => 'many-to-many',

      homoeolog_one2one         => '1-to-1',
      homoeolog_one2many        => '1-to-many',
      homoeolog_many2many       => 'many-to-many',

);



=head2 is_tree_compliant

  Arg [1]    : float $is_tree_compliant (optional)
  Example    : $is_compliant = $homology->is_tree_compliant();
               $homology->is_tree_compliant(1);
  Description: getter/setter for a flag that shows whether the homology is fully compliant with the tree
  Returntype : int
  Exceptions : none
  Caller     : general
{'fraction_non_alphanumeric': 0.09175084175084175, 'fraction_numerical': 0.013131313131313131, 'mean_word_length': 3.7757234726688105, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 32, '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': '3298538', 'n_tokens_mistral': 1938, 'n_tokens_neox': 1805, 'n_words': 619}