Skip to content
Snippets Groups Projects
Commit b50c1062 authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

Properly formatted SYNOPSIS code, and removed syntax error.

Updated list of allowed linkage types with list from the Ensembl Core
schema.

Updated rest of package code to conform to relatively common Core API
coding practices.
parent f5a593da
No related branches found
No related tags found
No related merge requests found
#
# EnsEMBL module for GoXref.pl
#
# Cared for by Arne Stabenau <stabenau@ebi.ac.uk>
#
# Copyright EnsEMBL 2000-2003
#
# You may distribute this module under the same terms as perl itself
......@@ -16,38 +10,38 @@ Bio::EnsEMBL::GoXref
=head1 DESCRIPTION
This class extends the DBEntry in order to associate Evidence Tags to the
relationship between EnsEMBL objects and GO identifiers. The relationship
to GO that is stored in the database is actually derived through the
relationship of EnsEMBL peptides to SwissProt peptides.
This class extends the DBEntry in order to associate Evidence Tags
to the relationship between EnsEMBL objects and GO identifiers. The
relationship to GO that is stored in the database is actually derived
through the relationship of EnsEMBL peptides to SwissProt peptides.
I.e. The relationship is derived like this:
ENSP -> SWISSPROT -> GO
An the evidence tag describes the relationship between the SWISSPROT Peptide
and the GO entry.
ENSP -> SWISSPROT -> GO
An the evidence tag describes the relationship between the SWISSPROT
Peptide and the GO entry.
In reality, however, we store this in the database like this:
ENSP -> SWISSPROT
ENSP -> GO
and the evidence tag hangs off of the relationship between the ENSP and
the GO identifier. Some ENSPs are associated with multiple closely related
Swissprot entries which may both be associated with the same GO identifier but
with different evidence tags. For this reason a single 'GoXref' can have
multiple evidence tags.
and the evidence tag hangs off of the relationship between the ENSP
and the GO identifier. Some ENSPs are associated with multiple closely
related Swissprot entries which may both be associated with the same GO
identifier but with different evidence tags. For this reason a single
'GoXref' can have multiple evidence tags.
=head1 SYNOPSIS
my $goxref = Bio::EnsEMBL::GoXref->new;
$goxref->add_linkage_type('IEA')
my $goxref = Bio::EnsEMBL::GoXref->new;
$goxref->add_linkage_type('IEA');
foreach my $evtag (@{$goxref->get_all_linkage_types()}) {
print "$evtag\n";
}
foreach my $evtag ( @{ $goxref->get_all_linkage_types() } ) {
print "$evtag\n";
}
=head1 CONTACT
......@@ -61,15 +55,14 @@ package Bio::EnsEMBL::GoXref;
use vars qw(@ISA);
use strict;
@ISA = qw( Bio::EnsEMBL::DBEntry );
=head2 add_linkage_type
Arg [1] : string $value
allowed are "IC", "IDA", "IEA", "IEP", "IGI", "IMP", "IPI", "ISS",
"NAS", "NS", "TAS", "NR"
allowed values:
'IC', 'IDA', 'IEA', 'IEP', 'IGI', 'IMP', 'IPI',
'ISS', NAS', 'ND', 'TAS', 'NR', 'RCA'
Arg [2] : (optional) Bio::EnsEMBL::DBEntry $source
Example : $go_xref->add_linkage_type('IGI');
Description: Associates a linkage type and source DBEntry with this go_xref
......@@ -82,17 +75,20 @@ use strict;
=cut
sub add_linkage_type {
my $self = shift;
my $lt = shift;
my $source_dbentry = shift || undef();
$self->throw("linkage type argument required") if(!$lt);
$self->throw("source_xref must be a Bio::EnsEMBL::DBEntry")
if($source_dbentry
and ! UNIVERSAL::isa($source_dbentry,'Bio::EnsEMBL::DBEntry'));
my ( $self, $lt, $source_dbentry ) = @_;
$self->throw("linkage type argument required") if ( !$lt );
if ( defined($source_dbentry)
&& !$source_dbentry->isa('Bio::EnsEMBL::DBEntry') )
{
$self->throw("source_dbentry must be a Bio::EnsEMBL::DBEntry");
}
$self->{'linkage_types'} ||= [];
push @{$self->{'linkage_types'}}, [$lt, ( $source_dbentry || () )];
push @{ $self->{'linkage_types'} },
[ $lt, ( $source_dbentry || () ) ];
}
......@@ -111,7 +107,7 @@ sub add_linkage_type {
=cut
sub get_all_linkage_info {
my $self = shift;
my ($self) = @_;
return $self->{'linkage_types'} || [];
}
......@@ -120,7 +116,9 @@ sub get_all_linkage_info {
=head2 get_all_linkage_types
Arg [1] : none
Example : foreach my $et (@{$goxr->get_all_linkage_types}){ print "$et ";}
Example : print( join( ' ',
@{ $goxr->get_all_linkage_types() } ),
"\n" );
Description: Retrieves a unique list of evidence tags associated with
this go_xref
Returntype : none
......@@ -131,9 +129,12 @@ sub get_all_linkage_info {
=cut
sub get_all_linkage_types {
my $self = shift;
my ($self) = @_;
my %seen;
return[ grep{!$seen{$_}++} map{$_->[0]} @{$self->{'linkage_types'}} ];
return [ grep { !$seen{$_}++ }
map { $_->[0] } @{ $self->{'linkage_types'} } ];
#return [ map{ $_->[0]} @{ $self->{'linkage_types'} || [] } ];
}
......@@ -151,8 +152,8 @@ sub get_all_linkage_types {
=cut
sub flush_linkage_types {
my $self = shift;
my ($self) = @_;
$self->{'linkage_types'} = [];
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment