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
4778200f
Commit
4778200f
authored
10 years ago
by
Kieron Taylor
Browse files
Options
Downloads
Plain Diff
Merge pull request #30 from juettemann/master
Updated caching
parents
6441270b
92f143db
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/DBSQL/UnmappedObjectAdaptor.pm
+58
-13
58 additions, 13 deletions
modules/Bio/EnsEMBL/DBSQL/UnmappedObjectAdaptor.pm
with
58 additions
and
13 deletions
modules/Bio/EnsEMBL/DBSQL/UnmappedObjectAdaptor.pm
+
58
−
13
View file @
4778200f
...
...
@@ -55,6 +55,7 @@ use strict;
use
POSIX
;
use
Bio::EnsEMBL::Utils::
Cache
;
use
Bio::EnsEMBL::Utils::
Exception
qw(throw warning)
;
use
Bio::EnsEMBL::Funcgen::Utils::
EFGUtils
qw(dump_data)
;
use
Bio::EnsEMBL::DBSQL::
BaseFeatureAdaptor
;
use
Bio::EnsEMBL::
UnmappedObject
;
use
Bio::EnsEMBL::
Analysis
;
...
...
@@ -74,13 +75,34 @@ use Bio::EnsEMBL::Analysis;
=cut
our
%desc_to_id
;
sub
new
{
my
$proto
=
shift
;
my
$class
=
ref
(
$proto
)
||
$proto
;
my
$self
=
$class
->
SUPER::
new
(
@
_
);
my
$sth
=
$self
->
prepare
("
SELECT
unmapped_reason_id,
full_description
FROM
unmapped_reason
");
$sth
->
execute
();
my
(
$id
,
$desc
);
$sth
->
bind_columns
(
\
(
$id
,
$desc
)
);
while
(
$sth
->
fetch
()
)
{
$desc_to_id
{
$desc
}
=
$id
;
}
$sth
->
finish
();
return
$self
;
}
...
...
@@ -279,28 +301,51 @@ sub store{
my
$analysis_id
;
if
(
$analysis
->
is_stored
(
$db
))
{
$analysis_id
=
$analysis
->
dbID
();
}
else
{
}
else
{
$analysis_id
=
$db
->
get_AnalysisAdaptor
->
store
(
$analysis
);
}
$sth_fetch_reason
->
execute
(
$uo
->
{'
description
'});
my
$unmapped_reason
=
$sth_fetch_reason
->
fetchrow_arrayref
();
# Check if unmapped reason is cached
# Check if it has been added since the cache was created
# Try to store it
#First check to see unmapped reason is stored
if
(
!
defined
$unmapped_reason
){
if
(
!
defined
(
$desc_to_id
{
$uo
->
{'
description
'}})){
$sth_reason
->
bind_param
(
1
,
$uo
->
{'
summary
'},
SQL_VARCHAR
);
$sth_reason
->
bind_param
(
2
,
$uo
->
{'
description
'},
SQL_VARCHAR
);
$sth_reason
->
execute
();
$uo
->
{'
unmapped_reason_id
'}
=
$self
->
last_insert_id
;
if
(
!
eval
{
$sth_reason
->
execute
();
1
}){
# DBI Trace possible here?
warn
$@
;
my
$msg
;
$msg
.=
"
INSERT INTO unmapped_reason (summary_description, full_description) VALUES (
";
$msg
.=
$uo
->
{'
summary
'}
.
'
,
'
.
$uo
->
{'
description
'}
.
'
)
';
warn
("
Qeury:
\n
$msg
");
print
STDERR
"
UnmappedObject:
\n
";
print
STDERR
dump_data
(
$uo
,
1
,
1
);
$sth_fetch_reason
->
execute
(
$uo
->
{'
description
'});
my
$unmapped_reasons
=
$sth_fetch_reason
->
fetchrow_arrayref
();
if
(
!
defined
(
$unmapped_reasons
)){
my
$msg
=
$uo
->
{'
description
'}
.
"
unable to store. Check MySQL schema, maybe PK not big enough?
";
throw
(
$msg
);
}
if
(
scalar
@$unmapped_reasons
!=
1
){
throw
("
Multiple results for this description
");
}
$uo
->
{'
unmapped_reason_id
'}
=
$unmapped_reasons
->
[
0
];
}
else
{
# print 'Last mohican: '.$self->last_insert_id ."\n";
$uo
->
{'
unmapped_reason_id
'}
=
$self
->
last_insert_id
;
}
}
else
{
# description is not unique, multiple results possible?
if
(
scalar
@$unmapped_reason
!=
1
){
throw
("
Multiple results for this description
");
}
$uo
->
{'
unmapped_reason_id
'}
=
$unmapped_reason
->
[
0
];
$uo
->
{'
unmapped_reason_id
'}
=
$desc_to_id
{
$uo
->
{'
description
'}};
}
$sth_unmapped_object
->
bind_param
(
1
,
$uo
->
{'
type
'},
SQL_VARCHAR
);
$sth_unmapped_object
->
bind_param
(
2
,
$uo
->
analysis
->
dbID
,
SQL_INTEGER
);
...
...
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