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
Wiki
Requirements
Code
Merge requests
0
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
Tamara El Naboulsi
ensembl
Commits
5784cc0f
Commit
5784cc0f
authored
11 years ago
by
Andy Yates
Browse files
Options
Downloads
Patches
Plain Diff
[ENSCORESW-473]. Adding a fetch all CoordSystems by version for regulation.
parent
55faf258
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/Bio/EnsEMBL/DBSQL/CoordSystemAdaptor.pm
+22
-0
22 additions, 0 deletions
modules/Bio/EnsEMBL/DBSQL/CoordSystemAdaptor.pm
modules/t/coordSystemAdaptor.t
+22
-0
22 additions, 0 deletions
modules/t/coordSystemAdaptor.t
with
44 additions
and
0 deletions
modules/Bio/EnsEMBL/DBSQL/CoordSystemAdaptor.pm
+
22
−
0
View file @
5784cc0f
...
...
@@ -516,9 +516,31 @@ sub fetch_all_by_name {
return
$self
->
{'
_name_cache
'}
->
{
$name
}
||
[]
;
}
=head2 fetch_all_by_version
Arg [1] : string $version
The version of the coordinate systems to retrieve.
Example : foreach my $cs (@{$csa->fetch_all_by_version('GRCh37')}){
print $cs->name(), ' ', $cs->version();
}
Description: Retrieves all coordinate systems of a particular version
Returntype : ArrayRef of Bio::EnsEMBL::CoordSystem objects
Exceptions : throw if no name argument provided
Caller : general
Status : Stable
=cut
sub
fetch_all_by_version
{
my
(
$self
,
$version
)
=
@_
;
throw
"
Version argument is required
"
if
!
$version
;
my
$coord_systems
=
[
grep
{
$_
->
version
()
eq
$version
}
map
{
$self
->
{
_rank_cache
}
->
{
$_
}
}
sort
keys
%
{
$self
->
{
_rank_cache
}}
];
return
$coord_systems
;
}
=head2 fetch_by_dbID
...
...
This diff is collapsed.
Click to expand it.
modules/t/coordSystemAdaptor.t
+
22
−
0
View file @
5784cc0f
...
...
@@ -3,6 +3,7 @@ use strict;
use
Test::
More
;
use
Bio::EnsEMBL::Test::
MultiTestDB
;
use
Bio::EnsEMBL::Test::
TestUtils
;
use
Test::
Exception
;
our
$verbose
=
1
;
#set to 1 to turn on debug printouts
...
...
@@ -176,6 +177,27 @@ ok( @{$new_path} == 2 &&
my
$new_paths2
=
$csa
->
store_mapping_path
(
$cs
,
$cln_cs
);
ok
(
@
{
$new_paths2
}
==
0
);
# Should not update second time round
#
# Do some inserting of mock coord systems and
# do version retrieval
#
my
$newcs_two
=
Bio::EnsEMBL::
CoordSystem
->
new
(
-
NAME
=>
'
newsystem_number_two
',
-
VERSION
=>
'
NCBI35
',
-
DEFAULT
=>
0
,
-
SEQUENCE_LEVEL
=>
0
,
-
RANK
=>
11
);
$csa
->
store
(
$newcs_two
);
dies_ok
{
$csa
->
fetch_all_by_version
()
}
'
fetch_all_by_version should die if not given a version to check
';
is_deeply
(
$csa
->
fetch_all_by_version
('
NCBI35
'),
[
$cs
,
$newcs_two
],
'
Checking version rank retrieval works
');
is_deeply
(
$csa
->
fetch_all_by_version
('
NCBI33
'),
[
$csa
->
fetch_by_name
('
chromosome
')],
'
Retrieval by name should return the same as version for NCBI33
');
is_deeply
(
$csa
->
fetch_all_by_version
('
thisdoesnotexist
'),
[]
,
'
Bogus coordinate system results in no results
');
$multi
->
restore
('
core
',
'
coord_system
');
$multi
->
restore
('
core
',
'
meta
');
...
...
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