<commit_before>=head1 LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016] 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

=pod


=head1 NAME

SequenceOntologyMapper - Translates EnsEMBL objects into Sequence Ontology terms

=head1 SYNOPSIS

use Bio::EnsEMBL::Utils::SequenceOntologyMapper

# get an Ensembl feature somehow in scalar $feature 
...
...

my $ontology_adaptor = $registry->get_adaptor( 'Multi', 'Ontology', 'OntologyTerm' );
my $mapper = SequenceOntologyMapper->new($ontology_adaptor);

print $mapper->to_accession($feature), "\n";
print $mapper->to_name($feature), "\n";

=head1 DESCRIPTION

Basic mapper from Ensembl feature or related objects to Sequence Ontology 
(http://www.sequenceontology.org) terms.

The interface allows to map to SO accessions and names.

=cut

package Bio::EnsEMBL::Utils::SequenceOntologyMapper;

use strict;
use warnings;

use Bio::EnsEMBL::Utils::Cache;
use Bio::EnsEMBL::Utils::Exception;

my %gene_so_mapping = 
  (
   'protein_coding' 		=> 'SO:0001217', # protein_coding_gene
   'pseudogene' 			=> 'SO:0000336', # pseudogene
   'processed_transcript' 	=> 'SO:0001503', # processed_transcript
   'lincRNA' 				=> 'SO:0001641', # lincRNA_gene
   'polymorphic_pseudogene'=> 'SO:0000336',		 # pseudogene
   'Mt_tRNA' 				=> 'SO:0000088', # mt_gene
   'IG_D_gene' 			=> 'SO:0000510',	 # D_gene
   'snoRNA' 				=> 'SO:0001267', #snoRNA_gene
   'misc_RNA' 				=> 'SO:0000356', #RNA
   'miRNA' 				=> 'SO:0001265', #miRNA_gene
   'rRNA' 					=> 'SO:0001637', #rRNA_gene
   'snRNA'					=> 'SO:0001268', #snRNA_gene
   'snRNA_pseudogene'		=> 'SO:0000336', # pseudogene
   'tRNA_pseudogene'		=> 'SO:0000778', # pseudogenic_tRNA
   'rRNA_pseudogene'		=> 'SO:0000777', # pseudogenic_rRNA
   'TR_J_gene'				=> 'SO:0000470', # J_gene
   'TR_V_gene'				=> 'SO:0000466', # V_gene
   'TR_C_gene'				=> 'SO:0000478', # C_gene
   'ncRNA'					=> 'SO:0001263', # ncRNA_gene
   'tRNA'					=> 'SO:0001272', # tRNA_gene
   'retrotransposed'		=> 'SO:0000569', # retrotransposed
   ## heavily abbreviated
  );

my %transcript_so_mapping = 
  (
   'processed_transcript' 				=> 'SO:0001503', # processed_transcript
   'nonsense_mediated_decay' 			=> 'SO:0001621', # NMD_transcript_variant
   'retained_intron' 					=> 'SO:0000681', # aberrant_processed_transcript
   'transcribed_unprocessed_pseudogene'=> 'SO:0000516', # pseudogenic_transcript
   'processed_pseudogene' 				=> 'SO:0000043', # processed_pseudogene
   'unprocessed_pseudogene' 			=> 'SO:0000336', # pseudogene
   'unitary_pseudogene'				=> 'SO:0000336',        # pseudogene
   'pseudogene' 						=> 'SO:0000336', # pseudogene
   'transcribed_processed_pseudogene'	=> 'SO:0000043',                # processed_pseudogene
   'retrotransposed' 					=> 'SO:0000569', #retrotransposed
   'ncrna_host' 						=> 'SO:0000483', # nc_primary_transcript
   'polymorphic_pseudogene'			=> 'SO:0000336',        # pseudogene
   'lincRNA'							=> 'SO:0001463', # lincRNA
   'ncrna_host'						=> 'SO:0000483', # nc_primary_transcript
   '3prime_overlapping_ncrna'			=> 'SO:0000483',         # nc_primary_transcript
   'TR_V_gene'							=> 'SO:0000466', # V_gene_segment
   'TR_V_pseudogene'					=> 'SO:0000336', # pseudogene
   'TR_J_gene'							=> 'SO:0000470',
   'IG_C_gene'							=> 'SO:0000478',
   'IG_C_pseudogene'					=> 'SO:0000336', # pseudogene
   'TR_C_gene'							=> 'SO:0000478', # C_gene_segment
   'IG_J_pseudogene'					=> 'SO:0000336', # pseudogene
   'miRNA'								=> 'SO:0000276', #miRNA
   'miRNA_pseudogene'					=> 'SO:0000336', # pseudogene
   'disrupted_domain' 					=> 'SO:0000681', # aberrant_processed_transcript<commit_msg>missing mRNA biotype for transcripts<commit_after>=head1 LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016] 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

=pod


=head1 NAME

SequenceOntologyMapper - Translates EnsEMBL objects into Sequence Ontology terms

=head1 SYNOPSIS

use Bio::EnsEMBL::Utils::SequenceOntologyMapper

# get an Ensembl feature somehow in scalar $feature 
...
...

my $ontology_adaptor = $registry->get_adaptor( 'Multi', 'Ontology', 'OntologyTerm' );
my $mapper = SequenceOntologyMapper->new($ontology_adaptor);

print $mapper->to_accession($feature), "\n";
print $mapper->to_name($feature), "\n";

=head1 DESCRIPTION

Basic mapper from Ensembl feature or related objects to Sequence Ontology 
(http://www.sequenceontology.org) terms.

The interface allows to map to SO accessions and names.

=cut

package Bio::EnsEMBL::Utils::SequenceOntologyMapper;

use strict;
use warnings;

use Bio::EnsEMBL::Utils::Cache;
use Bio::EnsEMBL::Utils::Exception;

my %gene_so_mapping = 
  (
   'protein_coding' 		=> 'SO:0001217', # protein_coding_gene
   'pseudogene' 			=> 'SO:0000336', # pseudogene
   'processed_transcript' 	=> 'SO:0001503', # processed_transcript
   'lincRNA' 				=> 'SO:0001641', # lincRNA_gene
   'polymorphic_pseudogene'=> 'SO:0000336',		 # pseudogene
   'Mt_tRNA' 				=> 'SO:0000088', # mt_gene
   'IG_D_gene' 			=> 'SO:0000510',	 # D_gene
   'snoRNA' 				=> 'SO:0001267', #snoRNA_gene
   'misc_RNA' 				=> 'SO:0000356', #RNA
   'miRNA' 				=> 'SO:0001265', #miRNA_gene
   'rRNA' 					=> 'SO:0001637', #rRNA_gene
   'snRNA'					=> 'SO:0001268', #snRNA_gene
   'snRNA_pseudogene'		=> 'SO:0000336', # pseudogene
   'tRNA_pseudogene'		=> 'SO:0000778', # pseudogenic_tRNA
   'rRNA_pseudogene'		=> 'SO:0000777', # pseudogenic_rRNA
   'TR_J_gene'				=> 'SO:0000470', # J_gene
   'TR_V_gene'				=> 'SO:0000466', # V_gene
   'TR_C_gene'				=> 'SO:0000478', # C_gene
   'ncRNA'					=> 'SO:0001263', # ncRNA_gene
   'tRNA'					=> 'SO:0001272', # tRNA_gene
   'retrotransposed'		=> 'SO:0000569', # retrotransposed
   ## heavily abbreviated
  );

my %transcript_so_mapping = 
  (
   'processed_transcript' 				=> 'SO:0001503', # processed_transcript
   'nonsense_mediated_decay' 			=> 'SO:0001621', # NMD_transcript_variant
   'retained_intron' 					=> 'SO:0000681', # aberrant_processed_transcript
   'transcribed_unprocessed_pseudogene'=> 'SO:0000516', # pseudogenic_transcript
   'processed_pseudogene' 				=> 'SO:0000043', # processed_pseudogene
   'unprocessed_pseudogene' 			=> 'SO:0000336', # pseudogene
   'unitary_pseudogene'				=> 'SO:0000336',        # pseudogene
   'pseudogene' 						=> 'SO:0000336', # pseudogene
   'transcribed_processed_pseudogene'	=> 'SO:0000043',                # processed_pseudogene
   'retrotransposed' 					=> 'SO:0000569', #retrotransposed
   'ncrna_host' 						=> 'SO:0000483', # nc_primary_transcript
   'polymorphic_pseudogene'			=> 'SO:0000336',        # pseudogene
   'lincRNA'							=> 'SO:0001463', # lincRNA
   'ncrna_host'						=> 'SO:0000483', # nc_primary_transcript
   '3prime_overlapping_ncrna'			=> 'SO:0000483',         # nc_primary_transcript
   'TR_V_gene'							=> 'SO:0000466', # V_gene_segment
   'TR_V_pseudogene'					=> 'SO:0000336', # pseudogene
   'TR_J_gene'							=> 'SO:0000470',
   'IG_C_gene'							=> 'SO:0000478',
   'IG_C_pseudogene'					=> 'SO:0000336', # pseudogene
   'TR_C_gene'							=> 'SO:0000478', # C_gene_segment
   'IG_J_pseudogene'					=> 'SO:0000336', # pseudogene
   'miRNA'								=> 'SO:0000276', #miRNA
   'protein_coding'                                     => 'SO:0000276', #miRNA
   'miRNA_pseudogene'					=> 'SO:0000336', # pseudogene
   'disrupted_domain' 					=> 'SO:0000681', # aberrant_processed_transcript
{'fraction_non_alphanumeric': 0.1312492682355696, 'fraction_numerical': 0.08113804004214963, 'mean_word_length': 4.036556603773585, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 104, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '130246', 'n_tokens_mistral': 4002, 'n_tokens_neox': 3010, 'n_words': 632}