diff --git a/modules/Bio/EnsEMBL/DBSQL/SplicingEventAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SplicingEventAdaptor.pm new file mode 100644 index 0000000000000000000000000000000000000000..e4d860edcf411837c14b4b9d3769775df5c8ac40 --- /dev/null +++ b/modules/Bio/EnsEMBL/DBSQL/SplicingEventAdaptor.pm @@ -0,0 +1,469 @@ +=head1 LICENSE + + Copyright (c) 1999-2009 The European Bioinformatics Institute and + Genome Research Limited. All rights reserved. + + This software is distributed under a modified Apache license. + For license details, please see + + http://www.ensembl.org/info/about/code_licence.html + +=head1 CONTACT + + Please email comments or questions to the public Ensembl + developers list at <ensembl-dev@ebi.ac.uk>. + + Questions may also be sent to the Ensembl help desk at + <helpdesk@ensembl.org>. + +=cut + +=head1 NAME + +Bio::EnsEMBL::DBSQL::SlicingEventAdaptor - Database adaptor for the retrieval and +storage of SplicingEvent objects + +=head1 SYNOPSIS + + use Bio::EnsEMBL::Registry; + + Bio::EnsEMBL::Registry->load_registry_from_db( + -host => 'ensembldb.ensembl.org', + -user => 'anonymous', + ); + + $se_adaptor = + Bio::EnsEMBL::Registry->get_adaptor( "human", "core", "SplicingEvent" ); + + $se = $se_adaptor->fetch_by_dbID(12); + + @ses = $se_adaptor->fetch_by_stable_id('ENSG00000184129'); + + @sess = @{ $se_adaptor->fetch_by__name('...-CNE-1') }; + + $slice_adaptor = + Bio::EnsEMBL::Registry->get_adaptor( "human", "core", "slice" ); + + $slice = + $slice_adaptor->fetch_by_region( 'chromosome', '1', 1, 1000000 ); + + @ase = @{ $se_adaptor->fetch_all_by_Slice($slice) }; + +=head1 DESCRIPTION + +This is a database aware adaptor for the retrieval and storage ofSlicingEvents +objects. + +=head1 METHODS + +=cut +package Bio::EnsEMBL::DBSQL::SplicingEventAdaptor; + +use strict; + +use Bio::EnsEMBL::Utils::Exception qw( deprecate throw warning ); +use Bio::EnsEMBL::DBSQL::SliceAdaptor; +use Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor; +use Bio::EnsEMBL::DBSQL::DBAdaptor; +use Bio::EnsEMBL::SplicingEvent; + +use vars '@ISA'; +@ISA = qw(Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor); + + +=head2 list_dbIDs + + Example : @gene_ids = @{$gene_adaptor->list_dbIDs()}; + Description: Gets an array of internal ids for all genes in the current db + Arg[1] : <optional> int. not 0 for the ids to be sorted by the seq_region. + Returntype : Listref of Ints + Exceptions : none + Caller : general + Status : Stable + +=cut + +sub list_dbIDs { + my ($self,$ordered) = @_; + + return $self->_list_dbIDs("splicing_event", undef, $ordered); +} + + +=head2 fetch_all_by_Slice + + Arg [1] : Bio::EnsEMBL::Slice $slice + The slice to fetch genes on. + Arg [2] : type of Transcript event + Arg [3] : (optional) boolean $load_features + if true, transcript will be loaded immediately rather than + lazy loaded later. +=cut + +sub fetch_all_by_Slice{ + my $self = shift; + my $slice = shift; + my $type = shift; + my $load_features = shift; + + my $constraint = ""; + + if(defined($type)){ + $constraint .= " and se.type = '$type'"; + } + + my $tes = $self->SUPER::fetch_all_by_Slice_constraint($slice, $constraint); + + + # Is there any use in having a splice event without the paris and features?? + + + if(!$load_features || @$tes < 2) { + return $tes; + } + + ## do someother stuff.. + + foreach my $te (@$tes){ + $te->get_all_Features(); + $te->get_all_Pairs(); + } + + return $tes; +} + + + + + +sub fetch_all_by_Gene{ + my $self = shift; + my $gene = shift; + + my ($splicing_event_id,$seq_region_id, $seq_region_start, $seq_region_end, $seq_region_strand, $name, $gene_id, $type); + + my $sth = $self->dbc->prepare("select se.splicing_event_id , se.seq_region_id, se.seq_region_start, se.seq_region_end, se.seq_region_strand, se.name, se.type from splicing_event se where se.gene_id = ".$gene->dbID); + + $sth->execute(); + + $sth->bind_columns(\$splicing_event_id, \$seq_region_id, \$seq_region_start, \$seq_region_end, \$seq_region_strand, \$name, \$type); + + my @splicing_events; + + my $sa = $self->db->get_SliceAdaptor(); + + while($sth->fetch){ + + my $slice = $sa->fetch_by_seq_region_id($seq_region_id, $seq_region_start, $seq_region_end, $seq_region_strand); + + push( @splicing_events, + $self->_create_feature_fast( 'Bio::EnsEMBL::SplicingEvent', { + 'start' => $seq_region_start, + 'end' => $seq_region_end, + 'strand' => $seq_region_strand, + 'adaptor' => $self, + 'slice' => $slice, + 'dbID' => $splicing_event_id, + 'name' => $name, + 'gene_id' => $gene->dbID, + 'type' => $type + } ) ); + } + $sth->finish; + + foreach my $te (@splicing_events){ + $te->get_all_Features(); + $te->get_all_Pairs(); + } + return \@splicing_events; +} + +sub fetch_all_by_Exon{ + my $self = shift; + my $exon = shift; + + my $list = "("; + my $sth= $self->dbc->prepare("Select distinct(splicing_event_id) from splicing_event_feature where exon_id = ".$exon->dbID); + $sth->execute; + my ($se_id); + $sth->bind_columns(\$se_id); + while($sth->fetch){ + $list .= $se_id." ,"; + } + $sth->finish; + chop $list; # get rid of last "," + $list .= ")"; + + my ($splicing_event_id,$seq_region_id, $seq_region_start, $seq_region_end, $seq_region_strand, $name, $gene_id, $type); + + $sth = $self->dbc->prepare("select se.splicing_event_id , se.seq_region_id, se.seq_region_start, se.seq_region_end, se.seq_region_strand, se.name, se.type, se.gene_id from splicing_event se where se.splicing_event_id in ".$list); + + $sth->execute(); + + $sth->bind_columns(\$splicing_event_id, \$seq_region_id, \$seq_region_start, \$seq_region_end, \$seq_region_strand, \$name, \$type, \$gene_id); + + my @splicing_events; + + my $sa = $self->db->get_SliceAdaptor(); + + while($sth->fetch){ + + my $slice = $sa->fetch_by_seq_region_id($seq_region_id, $seq_region_start, $seq_region_end, $seq_region_strand); + + push( @splicing_events, + $self->_create_feature_fast( 'Bio::EnsEMBL::SplicingEvent', { + 'start' => $seq_region_start, + 'end' => $seq_region_end, + 'strand' => $seq_region_strand, + 'adaptor' => $self, + 'slice' => $slice, + 'dbID' => $splicing_event_id, + 'name' => $name, + 'gene_id' => $gene_id, + 'type' => $type + } ) ); + } + $sth->finish; + + foreach my $te (@splicing_events){ + $te->get_all_Features(); + $te->get_all_Pairs(); + } + return \@splicing_events; +} + +sub fetch_all_by_Transcript{ + my $self = shift; + my $tran = shift; + + my $list = "("; + my $sth= $self->dbc->prepare("Select distinct(splicing_event_id) from splicing_event_feature where transcript_id = ".$tran->dbID); + $sth->execute; + my ($se_id); + $sth->bind_columns(\$se_id); + while($sth->fetch){ + $list .= $se_id." ,"; + } + $sth->finish; + chop $list; # get rid of last "," + $list .= ")"; + + my ($splicing_event_id,$seq_region_id, $seq_region_start, $seq_region_end, $seq_region_strand, $name, $gene_id, $type); + + $sth = $self->dbc->prepare("select se.splicing_event_id , se.seq_region_id, se.seq_region_start, se.seq_region_end, se.seq_region_strand, se.name, se.type, se.gene_id from splicing_event se where se.splicing_event_id in ".$list); + + $sth->execute(); + + $sth->bind_columns(\$splicing_event_id, \$seq_region_id, \$seq_region_start, \$seq_region_end, \$seq_region_strand, \$name, \$type, \$gene_id); + + my @splicing_events; + + my $sa = $self->db->get_SliceAdaptor(); + + while($sth->fetch){ + + my $slice = $sa->fetch_by_seq_region_id($seq_region_id, $seq_region_start, $seq_region_end, $seq_region_strand); + + push( @splicing_events, + $self->_create_feature_fast( 'Bio::EnsEMBL::SplicingEvent', { + 'start' => $seq_region_start, + 'end' => $seq_region_end, + 'strand' => $seq_region_strand, + 'adaptor' => $self, + 'slice' => $slice, + 'dbID' => $splicing_event_id, + 'name' => $name, + 'gene_id' => $gene_id, + 'type' => $type + } ) ); + } + $sth->finish; + + foreach my $te (@splicing_events){ + $te->get_all_Features(); + $te->get_all_Pairs(); + } + return \@splicing_events; +} + +# _tables +# Arg [1] : none +# Description: PROTECTED implementation of superclass abstract method. +# Returns the names, aliases of the tables to use for queries. +# Returntype : list of listrefs of strings +# Exceptions : none +# Caller : internal +# Status : At Risk + +sub _tables { + my $self = shift; + + return ([ 'splicing_event', 'se' ]); +} + +# _columns +# Arg [1] : none +# Example : none +# Description: PROTECTED implementation of superclass abstract method. +# Returns a list of columns to use for queries. +# Returntype : list of strings +# Exceptions : none +# Caller : internal +# Status : At Risk + +sub _columns { + my $self = shift; + +# my $created_date = $self->db->dbc->from_date_to_seconds("gsi.created_date"); +# my $modified_date = $self->db->dbc->from_date_to_seconds("gsi.modified_date"); + + return ( 'se.splicing_event_id', 'se.seq_region_id', 'se.seq_region_start', 'se.seq_region_end', 'se.seq_region_strand', 'se.name', 'se.gene_id', 'se.type' ); + +} + +sub _objs_from_sth { + my ($self, $sth, $mapper, $dest_slice) = @_; + + my ($splicing_event_id,$seq_region_id, $seq_region_start, $seq_region_end, $seq_region_strand, $name, $gene_id, $type); + + + $sth->bind_columns(\$splicing_event_id, \$seq_region_id, \$seq_region_start, \$seq_region_end, \$seq_region_strand, \$name, \$gene_id, \$type); + + my $sa = $self->db()->get_SliceAdaptor(); + + + my @splicing_events; + my %slice_hash; + my %sr_name_hash; + my %sr_cs_hash; + + my $asm_cs; + my $cmp_cs; + my $asm_cs_vers; + my $asm_cs_name; + my $cmp_cs_vers; + my $cmp_cs_name; + if($mapper) { + $asm_cs = $mapper->assembled_CoordSystem(); + $cmp_cs = $mapper->component_CoordSystem(); + $asm_cs_name = $asm_cs->name(); + $asm_cs_vers = $asm_cs->version(); + $cmp_cs_name = $cmp_cs->name(); + $cmp_cs_vers = $cmp_cs->version(); + } + + my $dest_slice_start; + my $dest_slice_end; + my $dest_slice_strand; + my $dest_slice_length; + my $dest_slice_cs; + my $dest_slice_sr_name; + my $dest_slice_sr_id; + my $asma; + if($dest_slice) { + $dest_slice_start = $dest_slice->start(); + $dest_slice_end = $dest_slice->end(); + $dest_slice_strand = $dest_slice->strand(); + $dest_slice_length = $dest_slice->length(); + $dest_slice_cs = $dest_slice->coord_system(); + $dest_slice_sr_name = $dest_slice->seq_region_name(); + $dest_slice_sr_id = $dest_slice->get_seq_region_id(); + $asma = $self->db->get_AssemblyMapperAdaptor(); + } + + FEATURE: while($sth->fetch()) { + #need to get the internal_seq_region, if present + $seq_region_id = $self->get_seq_region_id_internal($seq_region_id); + + my $slice = $slice_hash{"ID:".$seq_region_id}; + my $dest_mapper = $mapper; + + if(!$slice) { + $slice = $sa->fetch_by_seq_region_id($seq_region_id); + $slice_hash{"ID:".$seq_region_id} = $slice; + $sr_name_hash{$seq_region_id} = $slice->seq_region_name(); + $sr_cs_hash{$seq_region_id} = $slice->coord_system(); + } + + #obtain a mapper if none was defined, but a dest_seq_region was + if(!$dest_mapper && $dest_slice && + !$dest_slice_cs->equals($slice->coord_system)) { + $dest_mapper = $asma->fetch_by_CoordSystems($dest_slice_cs, + $slice->coord_system); + $asm_cs = $dest_mapper->assembled_CoordSystem(); + $cmp_cs = $dest_mapper->component_CoordSystem(); + $asm_cs_name = $asm_cs->name(); + $asm_cs_vers = $asm_cs->version(); + $cmp_cs_name = $cmp_cs->name(); + $cmp_cs_vers = $cmp_cs->version(); + } + + my $sr_name = $sr_name_hash{$seq_region_id}; + my $sr_cs = $sr_cs_hash{$seq_region_id}; + # + # remap the feature coordinates to another coord system + # if a mapper was provided + # + if($dest_mapper) { + + ($seq_region_id,$seq_region_start,$seq_region_end,$seq_region_strand) = + $dest_mapper->fastmap($sr_name, $seq_region_start, $seq_region_end, + $seq_region_strand, $sr_cs); + + #skip features that map to gaps or coord system boundaries + next FEATURE if(!defined($seq_region_id)); + + #get a slice in the coord system we just mapped to + $slice = $slice_hash{"ID:".$seq_region_id} ||= + $sa->fetch_by_seq_region_id($seq_region_id); + } + + # + # If a destination slice was provided convert the coords + # If the dest_slice starts at 1 and is foward strand, nothing needs doing + # + if($dest_slice) { + if($dest_slice_start != 1 || $dest_slice_strand != 1) { + if($dest_slice_strand == 1) { + $seq_region_start = $seq_region_start - $dest_slice_start + 1; + $seq_region_end = $seq_region_end - $dest_slice_start + 1; + } else { + my $tmp_seq_region_start = $seq_region_start; + $seq_region_start = $dest_slice_end - $seq_region_end + 1; + $seq_region_end = $dest_slice_end - $tmp_seq_region_start + 1; + $seq_region_strand *= -1; + } + } + + #throw away features off the end of the requested slice + if($seq_region_end < 1 || $seq_region_start > $dest_slice_length || + ( $dest_slice_sr_id != $seq_region_id )) { + next FEATURE; + } + + $slice = $dest_slice; + } + + # Finally, create the new splicing_event. + push( @splicing_events, + $self->_create_feature_fast( 'Bio::EnsEMBL::SplicingEvent', { + 'start' => $seq_region_start, + 'end' => $seq_region_end, + 'strand' => $seq_region_strand, + 'adaptor' => $self, + 'slice' => $slice, + 'dbID' => $splicing_event_id, + 'name' => $name, + 'gene_id' => $gene_id, + 'type' => $type + } ) ); + + } + + return \@splicing_events; +} + + +1; + + diff --git a/modules/Bio/EnsEMBL/DBSQL/SplicingEventFeatureAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SplicingEventFeatureAdaptor.pm new file mode 100644 index 0000000000000000000000000000000000000000..4da7adf42073cda1b4c3cc9bbd1c518d0d83b378 --- /dev/null +++ b/modules/Bio/EnsEMBL/DBSQL/SplicingEventFeatureAdaptor.pm @@ -0,0 +1,147 @@ +=head1 LICENSE + + Copyright (c) 1999-2009 The European Bioinformatics Institute and + Genome Research Limited. All rights reserved. + + This software is distributed under a modified Apache license. + For license details, please see + + http://www.ensembl.org/info/about/code_licence.html + +=head1 CONTACT + + Please email comments or questions to the public Ensembl + developers list at <ensembl-dev@ebi.ac.uk>. + + Questions may also be sent to the Ensembl help desk at + <helpdesk@ensembl.org>. + +=cut + +=head1 NAME + +Bio::EnsEMBL::DBSQL::SlicingEventFeatureAdaptor - Database adaptor for the retrieval and +storage of SplicingEventFeature objects + +=head1 SYNOPSIS + + use Bio::EnsEMBL::Registry; + + Bio::EnsEMBL::Registry->load_registry_from_db( + -host => 'ensembldb.ensembl.org', + -user => 'anonymous', + ); + + $se_adaptor = + Bio::EnsEMBL::Registry->get_adaptor( "human", "core", "SplicingEventFeature" ); + + +=head1 DESCRIPTION + +This is a database aware adaptor for the retrieval and storage of SlicingEventFeatures +objects. + +=head1 METHODS + +=cut +package Bio::EnsEMBL::DBSQL::SplicingEventFeatureAdaptor; + +use strict; + +use Bio::EnsEMBL::Utils::Exception qw( deprecate throw warning ); +use Bio::EnsEMBL::DBSQL::SliceAdaptor; +use Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor; +use Bio::EnsEMBL::DBSQL::DBAdaptor; +use Bio::EnsEMBL::SplicingEventFeature; + +use vars '@ISA'; +@ISA = qw(Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor); + + + +sub fetch_all_by_SplicingEvent{ + my ($self, $splicing_event) = @_; + + + my ($splicing_event_feature_id, $splicing_event_id, $exon_id, $transcript_id, $feature_order, $transcript_association, $type, $start, $end); + + $splicing_event_id = $splicing_event->dbID; + + my $sql = "select splicing_event_feature_id, exon_id, transcript_id, feature_order, transcript_association, type, start, end from splicing_event_feature where splicing_event_id = $splicing_event_id"; + + my $sth = $self->prepare($sql); + + $sth->execute(); + $sth->bind_columns(\$splicing_event_feature_id, \$exon_id, \$transcript_id, \$feature_order, \$transcript_association, \$type, \$start, \$end); + + my @features; + + while($sth->fetch()){ + push( @features, + $self->_create_feature_fast( 'Bio::EnsEMBL::SplicingEventFeature', { + 'start' => $start, + 'end' => $end, + 'adaptor' => $self, + 'dbID' => $splicing_event_feature_id, + 'exon_id' => $exon_id, + 'transcript_id' => $transcript_id, + 'slice' => $splicing_event->slice, + 'type' => $type, + 'feature_order' => $feature_order, + 'transcript_association' => $transcript_association + } ) ); + + } + $sth->finish; + return \@features; + +} + + + + +# _tables +# Arg [1] : none +# Description: PROTECTED implementation of superclass abstract method. +# Returns the names, aliases of the tables to use for queries. +# Returntype : list of listrefs of strings +# Exceptions : none +# Caller : internal +# Status : At Risk + +sub _tables { + my $self = shift; + + return ([ 'splicing_event_feature', 'sef' ]); +} + +# _columns +# Arg [1] : none +# Example : none +# Description: PROTECTED implementation of superclass abstract method. +# Returns a list of columns to use for queries. +# Returntype : list of strings +# Exceptions : none +# Caller : internal +# Status : At Risk + +sub _columns { + my $self = shift; + +# my $created_date = $self->db->dbc->from_date_to_seconds("gsi.created_date"); +# my $modified_date = $self->db->dbc->from_date_to_seconds("gsi.modified_date"); + + return ( 'sef.splicing_event_id','sef.exon_id', 'sef.feature_order', 'sef.transcript_association', 'sef.type', 'sef.start', 'sef.end' ); + +} + +sub list_dbIDs { + my ($self,$ordered) = @_; + + return $self->_list_dbIDs("splicing_event_feature", undef, $ordered); +} + + +1; + + diff --git a/modules/Bio/EnsEMBL/DBSQL/SplicingTranscriptPairAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SplicingTranscriptPairAdaptor.pm new file mode 100644 index 0000000000000000000000000000000000000000..d52ff4769d04ba585776bde2e2d258d01b85a2d4 --- /dev/null +++ b/modules/Bio/EnsEMBL/DBSQL/SplicingTranscriptPairAdaptor.pm @@ -0,0 +1,143 @@ +=head1 LICENSE + + Copyright (c) 1999-2009 The European Bioinformatics Institute and + Genome Research Limited. All rights reserved. + + This software is distributed under a modified Apache license. + For license details, please see + + http://www.ensembl.org/info/about/code_licence.html + +=head1 CONTACT + + Please email comments or questions to the public Ensembl + developers list at <ensembl-dev@ebi.ac.uk>. + + Questions may also be sent to the Ensembl help desk at + <helpdesk@ensembl.org>. + +=cut + +=head1 NAME + +Bio::EnsEMBL::DBSQL::SlicingTranscriptPairAdaptor - Database adaptor for the retrieval and +storage of SplicingTranscriptPair objects + +=head1 SYNOPSIS + + use Bio::EnsEMBL::Registry; + + Bio::EnsEMBL::Registry->load_registry_from_db( + -host => 'ensembldb.ensembl.org', + -user => 'anonymous', + ); + + $se_adaptor = + Bio::EnsEMBL::Registry->get_adaptor( "human", "core", "SplicingTranscriptPair" ); + + +=head1 DESCRIPTION + +This is a database aware adaptor for the retrieval and storage of SplicingTranscriptPairs +objects. + +=head1 METHODS + +=cut +package Bio::EnsEMBL::DBSQL::SplicingTranscriptPairAdaptor; + +use strict; + +use Bio::EnsEMBL::Utils::Exception qw( deprecate throw warning ); +use Bio::EnsEMBL::DBSQL::SliceAdaptor; +use Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor; +use Bio::EnsEMBL::DBSQL::DBAdaptor; +use Bio::EnsEMBL::SplicingTranscriptPair; + +use vars '@ISA'; +@ISA = qw(Bio::EnsEMBL::DBSQL::BaseFeatureAdaptor); + + + +sub fetch_all_by_SplicingEvent{ + my ($self, $splicing_event) = @_; + + + my ($splicing_transcript_pair_id, $transcript_id_1, $transcript_id_2); + + my $splicing_event_id = $splicing_event->dbID; + + my $sql = "select splicing_transcript_pair_id, transcript_id_1, transcript_id_2 from splicing_transcript_pair where splicing_event_id = $splicing_event_id"; + + my $sth = $self->prepare($sql); + + $sth->execute(); + $sth->bind_columns(\$splicing_transcript_pair_id, \$transcript_id_1, \$transcript_id_2); + + my @pairs; + + while($sth->fetch()){ + push( @pairs, + $self->_create_feature_fast( 'Bio::EnsEMBL::SplicingTranscriptPair', { + 'adaptor' => $self, + 'dbID' => $splicing_transcript_pair_id, + 'transcript_id_1' => $transcript_id_1, + 'transcript_id_2' => $transcript_id_2, + 'start' => $splicing_event->start, + 'end' => $splicing_event->end + } ) ); + + } + $sth->finish; + return \@pairs; + +} + + + + +# _tables +# Arg [1] : none +# Description: PROTECTED implementation of superclass abstract method. +# Returns the names, aliases of the tables to use for queries. +# Returntype : list of listrefs of strings +# Exceptions : none +# Caller : internal +# Status : At Risk + +sub _tables { + my $self = shift; + + return ([ 'splicing_transcript_pair', 'stp' ]); +} + +# _columns +# Arg [1] : none +# Example : none +# Description: PROTECTED implementation of superclass abstract method. +# Returns a list of columns to use for queries. +# Returntype : list of strings +# Exceptions : none +# Caller : internal +# Status : At Risk + +sub _columns { + my $self = shift; + +# my $created_date = $self->db->dbc->from_date_to_seconds("gsi.created_date"); +# my $modified_date = $self->db->dbc->from_date_to_seconds("gsi.modified_date"); + + return ( 'stp.splicing_transcript_pair_id','stp.transcript_id_1', 'stp.transcript_id_2'); + +} + +sub list_dbIDs { + my ($self,$ordered) = @_; + + return $self->_list_dbIDs("splicing_transcript_pair", undef, $ordered); +} + + +1; + + diff --git a/modules/Bio/EnsEMBL/SplicingEvent.pm b/modules/Bio/EnsEMBL/SplicingEvent.pm new file mode 100644 index 0000000000000000000000000000000000000000..66ddff439a0c58653ab0c69c5c287c8577e0eae5 --- /dev/null +++ b/modules/Bio/EnsEMBL/SplicingEvent.pm @@ -0,0 +1,149 @@ +=head1 LICENSE + + Copyright (c) 1999-2009 The European Bioinformatics Institute and + Genome Research Limited. All rights reserved. + + This software is distributed under a modified Apache license. + For license details, please see + + http://www.ensembl.org/info/about/code_licence.html + +=head1 CONTACT + + Please email comments or questions to the public Ensembl + developers list at <ensembl-dev@ebi.ac.uk>. + + Questions may also be sent to the Ensembl help desk at + <helpdesk@ensembl.org>. + +=cut + +=head1 NAME + +Bio::EnsEMBL::SlicingEvent - Object representing an alternative splicing event + +=head1 SYNOPSIS + + my $ase = Bio::EnsEMBL::SplicingEvent->new( + -START => 123, + -END => 1045, + -STRAND => 1, + -GENE_ID => $gene->dbID, + -SLICE => $slice + ); + + # set some additional attributes + $ase->name('ENSG00000000003-CNE-3'); + $ase->type('CNE'); + +=head1 DESCRIPTION + +A representation of an Alternative Splicing Event within the Ensembl system. + +=head1 METHODS + +=cut + +package Bio::EnsEMBL::SplicingEvent; + +use strict; + +use POSIX; +use Bio::EnsEMBL::Feature; +use Bio::EnsEMBL::Utils::Argument qw(rearrange); +use Bio::EnsEMBL::Utils::Exception qw(throw warning deprecate); + +use vars qw(@ISA); +@ISA = qw(Bio::EnsEMBL::Feature); + + + +## Add to gene get_all_splicing_events + + + +sub gene_id{ + my $self = shift; + $self->{'gene_id'} = shift if (@_); + + if (defined $self->{'gene_id'}) { + return $self->{'gene_id'}; + } + + return undef; +} + +sub name{ + my $self = shift; + $self->{'name'} = shift if (@_); + + if (defined $self->{'name'}) { + return $self->{'name'}; + } + + return undef; +} + +sub type{ + my $self = shift; + $self->{'type'} = shift if (@_); + + if (defined $self->{'type'}) { + return $self->{'type'}; + } + + return undef; +} + +sub add_Feature{ + my ($self, $feat) = @_; + + if( !ref $feat || ! $feat->isa("Bio::EnsEMBL::SplicingEventFeature") ) { + throw("$feat is not a Bio::EnsEMBL::SplicingEventFeature!"); + } + + $self->{'_feature_array'} ||= []; + push(@{$self->{'_feature_array'}},$feat); +} + + +sub get_all_Features { + my $self = shift; + + if( ! exists $self->{'_feature_array'} ) { + if( defined $self->adaptor() ) { + my $fta = $self->adaptor()->db()->get_SplicingEventFeatureAdaptor(); + my $features = $fta->fetch_all_by_SplicingEvent( $self ); + $self->{'_feature_array'} = $features; + } + } + return $self->{'_feature_array'}; +} + +sub add_Pair{ + my ($self, $feat) = @_; + + if( !ref $feat || ! $feat->isa("Bio::EnsEMBL::SplicingEventPair") ) { + throw("$feat is not a Bio::EnsEMBL::SplicingEventPair!"); + } + + $self->{'_pair_array'} ||= []; + push(@{$self->{'_pair_array'}},$feat); +} + + +sub get_all_Pairs { + my $self = shift; + + if( ! exists $self->{'_pair_array'} ) { + if( defined $self->adaptor() ) { + my $pa = $self->adaptor()->db()->get_SplicingTranscriptPairAdaptor(); + my $pairs = $pa->fetch_all_by_SplicingEvent( $self ); + $self->{'_pair_array'} = $pairs; + } + } + return $self->{'_pair_array'}; +} + + +1; diff --git a/modules/Bio/EnsEMBL/SplicingEventFeature.pm b/modules/Bio/EnsEMBL/SplicingEventFeature.pm new file mode 100644 index 0000000000000000000000000000000000000000..064f39fd0b1e498af462547d7021f3870e2ab666 --- /dev/null +++ b/modules/Bio/EnsEMBL/SplicingEventFeature.pm @@ -0,0 +1,143 @@ +=head1 LICENSE + + Copyright (c) 1999-2009 The European Bioinformatics Institute and + Genome Research Limited. All rights reserved. + + This software is distributed under a modified Apache license. + For license details, please see + + http://www.ensembl.org/info/about/code_licence.html + +=head1 CONTACT + + Please email comments or questions to the public Ensembl + developers list at <ensembl-dev@ebi.ac.uk>. + + Questions may also be sent to the Ensembl help desk at + <helpdesk@ensembl.org>. + +=cut + +=head1 NAME + +Bio::EnsEMBL::SplicingEventFeature - Object representing an alternative splicing event + +=head1 SYNOPSIS + + my $ase = Bio::EnsEMBL::SplicingEventFeature->new( + -START => 123, + -END => 1045, + -EXON_ID => $exon->dbID + ); + + # set some additional attributes + $ase->type('flanking_exon'); + +=head1 DESCRIPTION + +A representation of an Alternative Splicing Event Feature within the Ensembl system. + +=head1 METHODS + +=cut + +package Bio::EnsEMBL::SplicingEventFeature; + +use strict; + +use POSIX; +use Bio::EnsEMBL::Feature; +use Bio::EnsEMBL::Utils::Argument qw(rearrange); +use Bio::EnsEMBL::Utils::Exception qw(throw warning deprecate); + +use vars qw(@ISA); +@ISA = qw(Bio::EnsEMBL::Feature); + + + +## Add to gene get_all_splicing_events + + + +sub exon_id{ + my $self = shift; + $self->{'exon_id'} = shift if (@_); + + if (defined $self->{'exon_id'}) { + return $self->{'exon_id'}; + } + + return undef; +} + +sub transcript_id{ + my $self = shift; + $self->{'transcript_id'} = shift if (@_); + + if (defined $self->{'transcript_id'}) { + return $self->{'transcript_id'}; + } + + return undef; +} + +sub feature_order{ + my $self = shift; + $self->{'feature_order'} = shift if (@_); + + if (defined $self->{'feature_order'}) { + return $self->{'feature_order'}; + } + + return undef; +} + +sub type{ + my $self = shift; + $self->{'type'} = shift if (@_); + + if (defined $self->{'type'}) { + return $self->{'type'}; + } + + return undef; +} + +sub start{ + my $self = shift; + $self->{'start'} = shift if (@_); + + if (defined $self->{'start'}) { + return $self->{'start'}; + } + + return undef; +} + +sub end{ + my $self = shift; + $self->{'end'} = shift if (@_); + + if (defined $self->{'end'}) { + return $self->{'end'}; + } + + return undef; +} + + +sub transcript_association{ + my $self = shift; + $self->{'transcript_association'} = shift if (@_); + + if (defined $self->{'transcript_association'}) { + return $self->{'transcript_association'}; + } + + return undef; +} + + + + +1; diff --git a/modules/Bio/EnsEMBL/SplicingTranscriptPair.pm b/modules/Bio/EnsEMBL/SplicingTranscriptPair.pm new file mode 100644 index 0000000000000000000000000000000000000000..957908aefd3d14d78029f647c56d52495e4eae53 --- /dev/null +++ b/modules/Bio/EnsEMBL/SplicingTranscriptPair.pm @@ -0,0 +1,106 @@ +=head1 LICENSE + + Copyright (c) 1999-2009 The European Bioinformatics Institute and + Genome Research Limited. All rights reserved. + + This software is distributed under a modified Apache license. + For license details, please see + + http://www.ensembl.org/info/about/code_licence.html + +=head1 CONTACT + + Please email comments or questions to the public Ensembl + developers list at <ensembl-dev@ebi.ac.uk>. + + Questions may also be sent to the Ensembl help desk at + <helpdesk@ensembl.org>. + +=cut + +=head1 NAME + +Bio::EnsEMBL::SplicingTranscriptPair - Object representing an alternative splicing transcript pair + +=head1 SYNOPSIS + + my $ase = Bio::EnsEMBL::SplicingTranscriptPair->new( + -START => 123, + -END => 1045, + -TRANSCRIPT_ID_1 => $tran1->dbID, + -TRANSCRIPT_ID_2 => %tran2->dbID + ); + +=head1 DESCRIPTION + +A representation of an Alternative Splicing Transcrript Pair within the Ensembl system. + +=head1 METHODS + +=cut + +package Bio::EnsEMBL::SplicingTranscriptPair; + +use strict; + +use POSIX; +use Bio::EnsEMBL::Feature; +use Bio::EnsEMBL::Utils::Argument qw(rearrange); +use Bio::EnsEMBL::Utils::Exception qw(throw warning deprecate); + +use vars qw(@ISA); +@ISA = qw(Bio::EnsEMBL::Feature); + + + + +sub transcript_id_1{ + my $self = shift; + $self->{'transcript_id_1'} = shift if (@_); + + if (defined $self->{'transcript_id_1'}) { + return $self->{'transcript_id_1'}; + } + + return undef; +} + +sub transcript_id_2{ + my $self = shift; + $self->{'transcript_id_2'} = shift if (@_); + + if (defined $self->{'transcript_id_2'}) { + return $self->{'transcript_id_2'}; + } + + return undef; +} + + +sub start{ + my $self = shift; + $self->{'start'} = shift if (@_); + + if (defined $self->{'start'}) { + return $self->{'start'}; + } + + return undef; +} + +sub end{ + my $self = shift; + $self->{'end'} = shift if (@_); + + if (defined $self->{'end'}) { + return $self->{'end'}; + } + + return undef; +} + + + + + +1;