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
27844890
Commit
27844890
authored
16 years ago
by
Patrick Meidl
Browse files
Options
Downloads
Patches
Plain Diff
also look in gene_archive to determine initial_stable_id()
parent
c2daf69a
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/IdMapping/StableIdGenerator/EnsemblGeneric.pm
+39
-4
39 additions, 4 deletions
...Bio/EnsEMBL/IdMapping/StableIdGenerator/EnsemblGeneric.pm
with
39 additions
and
4 deletions
modules/Bio/EnsEMBL/IdMapping/StableIdGenerator/EnsemblGeneric.pm
+
39
−
4
View file @
27844890
...
...
@@ -115,22 +115,34 @@ sub initial_stable_id {
# use stable ID from configuration if set
if
(
$init_stable_id
=
$self
->
conf
->
param
("
starting_
${type}
_stable_id
"))
{
$self
->
logger
->
debug
("
Using pre-configured
$init_stable_id
as base for new
$type
stable IDs
\n
");
$self
->
logger
->
debug
("
Using pre-configured
$init_stable_id
as base for new
$type
stable IDs
.
\n
");
return
$init_stable_id
;
}
my
$s_dba
=
$self
->
cache
->
get_DBAdaptor
('
source
');
my
$s_dbh
=
$s_dba
->
dbc
->
db_handle
;
# look in the ${type}_stable_id table first
my
$sql
=
qq(SELECT MAX(stable_id) FROM ${type}_stable_id)
;
$init_stable_id
=
$self
->
fetch_value_from_db
(
$s_dbh
,
$sql
);
# also look in gene_archive to make sure there are no larger Ids there
unless
(
$type
eq
'
exon
')
{
$sql
=
qq(SELECT MAX(${type}_stable_id) FROM gene_archive)
;
my
$archived_stable_id
=
$self
->
fetch_value_from_db
(
$s_dbh
,
$sql
);
if
(
$archived_stable_id
and
$self
->
is_valid
(
$archived_stable_id
)
and
(
$archived_stable_id
gt
$init_stable_id
))
{
$init_stable_id
=
$archived_stable_id
;
}
}
if
(
$init_stable_id
)
{
# since $init_stable_id now is the highest existing stable Id for this
# object type, we need to increment it to find the first one we want to use
# for new assignments
$init_stable_id
=
$self
->
increment_stable_id
(
$init_stable_id
);
$self
->
logger
->
debug
("
Using
$init_stable_id
as base for new
$type
stable IDs
\n
");
$self
->
logger
->
debug
("
Using
$init_stable_id
as base for new
$type
stable IDs
.
\n
");
}
else
{
$self
->
logger
->
warning
("
Can't find highest
${type}
_stable_id in source db.
\n
");
...
...
@@ -160,10 +172,11 @@ sub increment_stable_id {
my
$self
=
shift
;
my
$stable_id
=
shift
;
unless
(
$s
table_id
and
(
$stable_id
=~
/ENS([A-Z]{1,4})(\d{11})/
))
{
unless
(
$s
elf
->
is_valid
(
$stable_id
))
{
throw
("
Unknown or missing stable ID:
$stable_id
.
");
}
$stable_id
=~
/ENS([A-Z]{1,4})(\d{11})/
;
my
$number
=
$
2
;
my
$new_stable_id
=
'
ENS
'
.
$
1
.
(
++
$number
);
...
...
@@ -171,6 +184,28 @@ sub increment_stable_id {
}
=head2 is_valid
Arg[1] : String $stable_id - the stable Id to check
Example : unless ($generator->is_valid($stable_id)) {
die "Invalid stable Id: $stable_id.\n";
}
Description : Tests a stable Id to be valid (according to the Ensembl stable
Id format definition).
Return type : Boolean - TRUE if valid, FALSE otherwise
Exceptions : none
Caller : general
Status : At Risk
: under development
=cut
sub
is_valid
{
my
(
$self
,
$stable_id
)
=
@_
;
return
(
$stable_id
and
(
$stable_id
=~
/ENS([A-Z]{1,4})(\d{11})/
));
}
=head2 calculate_version
Arg[1] : Bio::EnsEMBL::IdMapping::TinyFeature $s_obj - source object
...
...
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