Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
f9043558
Commit
f9043558
authored
18 years ago
by
Patrick Meidl
Browse files
Options
Downloads
Patches
Plain Diff
added pod, get_attribute() and ident_string()
parent
c8a418ad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/StableIdEvent.pm
+112
-1
112 additions, 1 deletion
modules/Bio/EnsEMBL/StableIdEvent.pm
with
112 additions
and
1 deletion
modules/Bio/EnsEMBL/StableIdEvent.pm
+
112
−
1
View file @
f9043558
...
...
@@ -6,6 +6,26 @@ Bio::EnsEMBL::StableIdEvent- object representing a stable ID mapping event
=head1 SYNOPSIS
my $old_id = Bio::EnsEMBL::ArchiveStableId->new(
-stable_id => 'ENSG001'
-version => 1,
-type => 'Gene',
);
my $new_id = Bio::EnsEMBL::ArchiveStableId->new(
-stable_id => 'ENSG001'
-version => 2,
-type => 'Gene',
);
my $event = Bio::EnsEMBL::StableIdEvent->new(
-old_id => $old_id,
-new_id => $new_id,
-score => 0.997
);
# directly access attributes in old and new ArchiveStableId
my $old_stable_id = $event->get_attribute('old', 'stable_id');
=head1 DESCRIPTION
...
...
@@ -14,9 +34,18 @@ ArchiveStableIds with a mapping score.
=head1 METHODS
score
new
old_ArchiveStableId
new_ArchiveStableId
score
get_attribute
ident_string
=head1 RELATED MODULES
Bio::EnsEMBL::ArchiveStableId
Bio::EnsEMBL::DBSQL::ArchiveStableIdAdaptor
Bio::EnsEMBL::StableIdHistoryTree
=head1 LICENCE
...
...
@@ -180,5 +209,87 @@ sub score {
}
=head2 get_attribute
Arg[1] : String $type - determines whether to get attribute from 'old'
or 'new' ArchiveStableId
Arg[2] : String $attr - ArchiveStableId attribute to fetch
Example : my $old_stable_id = $event->get_attribute('old', 'stable_id');
Description : Accessor to attributes of the ArchiveStableIds attached to this
event. Convenience method that does the check for undef old
and/or new ArchiveStableId for you.
Return type : same as respective method in Bio::EnsEMBL::ArchiveStableId, or
undef
Exceptions : thrown on wrong arguments
Caller : general
Status : At Risk
: under development
=cut
sub
get_attribute
{
my
(
$self
,
$type
,
$attr
)
=
@_
;
throw
("
First argument passed to this function has to be 'old' or 'new'.
")
unless
(
$type
eq
'
old
'
or
$type
eq
'
new
');
my
%allowed_attribs
=
map
{
$_
=>
1
}
qw(stable_id version db_name release assembly)
;
throw
("
Attribute
$attr
not allowed.
")
unless
$allowed_attribs
{
$attr
};
my
$call
=
$type
.
'
_ArchiveStableId
';
if
(
my
$id
=
$self
->
$call
)
{
return
$id
->
$attr
;
}
else
{
return
undef
;
}
}
=head2 ident_string
Example : print $event->ident_string, "\n";
Description : Returns a string that can be used to identify your StableIdEvent.
Useful in debug warnings.
Return type : String
Exceptions : none
Caller : general
Status : At Risk
: under development
=cut
sub
ident_string
{
my
$self
=
shift
;
my
$old_id
=
$self
->
old_ArchiveStableId
;
my
$new_id
=
$self
->
new_ArchiveStableId
;
my
$str
;
if
(
$old_id
)
{
$str
=
$old_id
->
stable_id
.
'
.
'
.
$old_id
->
version
.
'
(
'
.
$old_id
->
release
.
'
)
';
}
else
{
$str
=
'
null
';
}
$str
.=
'
->
';
if
(
$new_id
)
{
$str
.=
$new_id
->
stable_id
.
'
.
'
.
$new_id
->
version
.
'
(
'
.
$new_id
->
release
.
'
)
';
}
else
{
$str
.=
'
null
';
}
$str
.=
'
[
'
.
$self
->
score
.
'
]
';
return
$str
;
}
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment