<commit_before>#
# BioPerl module for Exon
#
# Cared for by <NAME> <<EMAIL>>
#
# Copyright <NAME>
#
# You may distribute this module under the same terms as perl itself

# POD documentation - main docs before the code

=pod 

=head1 NAME

Bio::EnsEMBL::StickyExon - A Confirmed Exon which spans two or more contigs 
                           internally

=head1 SYNOPSIS

    $sticky = new Bio::EnsEMBL::Exon;

    # is a normal exon
    $sticky->start();
    $sticky->end();

    # has component_Exons
    foreach $sub ( @{$sticky->get_all_component_Exons} ) {
       # $sub is an exon that ends on a contig
    }

=head1 DESCRIPTION

Sticky Exons represent Exons which internally span contigs. 
They are made during the write back on slices, which writes the exons that 
span joins into the database.


=head1 CONTACT

The EnsEMBL developer mailing list for questions : <<EMAIL>>

=head1 APPENDIX

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

=cut


# Let the code begin...


package Bio::EnsEMBL::StickyExon;

use Bio::Seq;

use vars qw(@ISA $AUTOLOAD);
use strict;

# Object preamble - inherits from Bio::SeqFeature::Generic

use Bio::EnsEMBL::Exon;


@ISA = qw(Bio::EnsEMBL::Exon);

# _initialize is where the heavy stuff will happen when new is called

sub new {
  my($class,@args) = @_;
  
  my $self = Bio::EnsEMBL::Exon->new(@args);
  bless $self,$class;



  # Array to store exon tags
  $self->{_component_exons} = [];
  
  return $self;
}


=head2 id

 Title   : id
 Usage   : overrides id to get/set locally and sets all component exons
 Function:
 Example :
 Returns : 
 Args    :


=cut

sub id{
   my ($self,$value) = @_;

   if( defined $value ) {
       $self->{'_sticky_id'} = $value;
       foreach my $c ( @{$self->get_all_component_Exons} ) {
	   $c->id($value);
       }
   }

   return $self->{'_sticky_id'};

}



=head2 get_all_component_Exons

  Arg [1]    : 
  Example    : @component_exons = @{$exon->get_all_component_Exons}; 
  Description: Retrieves the component exons that comprise a sticky exon 
  Returntype : reference to a list of Bio::EnsEMBL::Exons
  Exceptions : none
  Caller     : general

=cut

sub get_all_component_Exons{
   my ($self,@args) = @_;

   return $self->{'_component_exons'};
}



=Head1 load_genomic_mapper

  Arg  1   : Bio::EnsEMBL::Mapper $mapper
             a mapper that will know hwo to go from cdna to genomic,
             after it is loaded here with the coordinates
  Arg  2   : int $id
             an id for the cdna, will probably be the address of the transcript
             that callewd this function. 

  Function : Loads the given mapper with cdna and genomic coordinates, so it can map 
             from one system to the other.

 Returntype: none
  Caller  : Bio::EnsEMBL::Transcript->convert_peptide_coordinate_to_contig


=cut


sub load_genomic_mapper {
  my ( $self, $mapper, $id, $start ) = @_;

  my $exons = $self->get_all_component_Exons;
  for my $exon ( @{$exons} ) {
    $mapper->add_map_coordinates( $id, $start, $start+$exon->length()-1,
				  $exon->strand(), $exon->contig,
				  $exon->start(), $exon->end() );
  }
}

=head2 adjust_start_end
<commit_msg>Fix to load_genomic_mapper method in StickyExon<commit_after>#
# BioPerl module for Exon
#
# Cared for by <NAME> <<EMAIL>>
#
# Copyright <NAME>
#
# You may distribute this module under the same terms as perl itself

# POD documentation - main docs before the code

=pod 

=head1 NAME

Bio::EnsEMBL::StickyExon - A Confirmed Exon which spans two or more contigs 
                           internally

=head1 SYNOPSIS

    $sticky = new Bio::EnsEMBL::Exon;

    # is a normal exon
    $sticky->start();
    $sticky->end();

    # has component_Exons
    foreach $sub ( @{$sticky->get_all_component_Exons} ) {
       # $sub is an exon that ends on a contig
    }

=head1 DESCRIPTION

Sticky Exons represent Exons which internally span contigs. 
They are made during the write back on slices, which writes the exons that 
span joins into the database.


=head1 CONTACT

The EnsEMBL developer mailing list for questions : <<EMAIL>>

=head1 APPENDIX

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

=cut


# Let the code begin...


package Bio::EnsEMBL::StickyExon;

use Bio::Seq;

use vars qw(@ISA $AUTOLOAD);
use strict;

# Object preamble - inherits from Bio::SeqFeature::Generic

use Bio::EnsEMBL::Exon;


@ISA = qw(Bio::EnsEMBL::Exon);

# _initialize is where the heavy stuff will happen when new is called

sub new {
  my($class,@args) = @_;
  
  my $self = Bio::EnsEMBL::Exon->new(@args);
  bless $self,$class;



  # Array to store exon tags
  $self->{_component_exons} = [];
  
  return $self;
}


=head2 id

 Title   : id
 Usage   : overrides id to get/set locally and sets all component exons
 Function:
 Example :
 Returns : 
 Args    :


=cut

sub id{
   my ($self,$value) = @_;

   if( defined $value ) {
       $self->{'_sticky_id'} = $value;
       foreach my $c ( @{$self->get_all_component_Exons} ) {
	   $c->id($value);
       }
   }

   return $self->{'_sticky_id'};

}



=head2 get_all_component_Exons

  Arg [1]    : 
  Example    : @component_exons = @{$exon->get_all_component_Exons}; 
  Description: Retrieves the component exons that comprise a sticky exon 
  Returntype : reference to a list of Bio::EnsEMBL::Exons
  Exceptions : none
  Caller     : general

=cut

sub get_all_component_Exons{
   my ($self,@args) = @_;

   return $self->{'_component_exons'};
}



=Head1 load_genomic_mapper

  Arg  1   : Bio::EnsEMBL::Mapper $mapper
             a mapper that will know hwo to go from cdna to genomic,
             after it is loaded here with the coordinates
  Arg  2   : int $id
             an id for the cdna, will probably be the address of the transcript
             that callewd this function. 

  Function : Loads the given mapper with cdna and genomic coordinates, so it can map 
             from one system to the other.

 Returntype: none
  Caller  : Bio::EnsEMBL::Transcript->convert_peptide_coordinate_to_contig


=cut


sub load_genomic_mapper {
  my ( $self, $mapper, $id, $start ) = @_;

  my $exons = $self->get_all_component_Exons;
  for my $exon ( @{$exons} ) {
    $mapper->add_map_coordinates( $id, $start, $start+$exon->length()-1,
				  $exon->strand(), $exon->contig,
				  $exon->start(), $exon->end() );
    $start += $exon->length;
  }
}

=head2 adjust_start_end

{'fraction_non_alphanumeric': 0.10807071483474251, 'fraction_numerical': 0.003996925441967717, 'mean_word_length': 3.096977329974811, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5879545', 'n_tokens_mistral': 2372, 'n_tokens_neox': 2189, 'n_words': 703}