Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl
Commits
465d3bc0
Commit
465d3bc0
authored
May 22, 2013
by
Andy Yates
Browse files
[
ENSCORESW-476
]. Fixed backwards compatibility for anything which is older than release 72
parent
d836fc70
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
8 deletions
+48
-8
modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm
+17
-0
modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm
modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm
+1
-1
modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
+30
-7
No files found.
modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm
View file @
465d3bc0
...
...
@@ -845,6 +845,23 @@ sub ignore_cache_override {
return
$self
->
{'
_override
'};
}
=head2 schema_version
Description : Returns the schema version of the currently connected
DBAdaptor. The subroutine also caches this value so
repeated calls continue to be speedy.
Example : $adaptor->schema_version();
Returntype : Integer
=cut
sub
schema_version
{
my
(
$self
)
=
@_
;
return
$self
->
{
_schema_version
}
if
exists
$self
->
{
_schema_version
};
my
$mc
=
$self
->
db
()
->
get_MetaContainer
();
return
$self
->
{
_schema_version
}
=
$mc
->
get_schema_version
();
}
#_tables
#
# Args : none
...
...
modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm
View file @
465d3bc0
...
...
@@ -72,7 +72,7 @@ sub get_schema_version {
if
(
!
defined
(
$ver
)
)
{
# old style format
return
0
;
}
return
$ver
;
return
$ver
*
1
;
#multiply by 1 to get this into a number
}
else
{
warning
(
sprintf
(
...
...
modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
View file @
465d3bc0
...
...
@@ -1282,8 +1282,11 @@ sub _fetch_by_object_type {
throw
("
Can't fetch_by_EnsObject_type without a type
");
}
### TODO - SCHEMA VERSION HACK. Please remove sometime in the future once we do not want backwards compatibility
my
$schema_version
=
$self
->
schema_version
();
# my $sth = $self->prepare("
my
$sql
=
(
<<
S
SQL
);
my
$
columns_
sql
=
(
<<
COLUMNS_
SQL
);
SELECT
xref
.
xref_id
,
xref
.
dbprimary_acc
,
xref
.
display_label
,
xref
.
version
,
exDB
.
priority
,
exDB
.
db_name
,
exDB
.
db_release
,
exDB
.
status
,
exDB
.
db_display_name
,
...
...
@@ -1295,20 +1298,40 @@ sub _fetch_by_object_type {
idt
.
cigar_line
,
idt
.
score
,
idt
.
evalue
,
oxr
.
analysis_id
,
gx
.
linkage_type
,
xref
.
info_type
,
xref
.
info_text
,
exDB
.
type
,
gx
.
source_xref_id
,
oxr
.
linkage_annotation
,
xref
.
description
,
ax
.
xref_id
,
ax
.
source_xref_id
,
ax
.
condition_type
,
ax
.
associated_group_id
,
ax
.
rank
oxr
.
linkage_annotation
,
xref
.
description
COLUMNS_SQL
my
$tables_sql
=
<<'TABLES_SQL';
FROM (xref xref, external_db exDB, object_xref oxr)
LEFT JOIN external_synonym es on es.xref_id = xref.xref_id
LEFT JOIN identity_xref idt on idt.object_xref_id = oxr.object_xref_id
LEFT JOIN ontology_xref gx on gx.object_xref_id = oxr.object_xref_id
LEFT
JOIN
associated_xref
ax
ON
ax
.
object_xref_id
=
oxr
.
object_xref_id
LEFT
JOIN
associated_group
ag
ON
ax
.
associated_group_id
=
ag
.
associated_group_id
TABLES_SQL
my
$where_sql
=
<<'WHERE_SQL';
WHERE xref.xref_id = oxr.xref_id
AND xref.external_db_id = exDB.external_db_id
AND oxr.ensembl_id = ?
AND oxr.ensembl_object_type = ?
SSQL
WHERE_SQL
if
(
$schema_version
>=
72
)
{
$columns_sql
.=
'
,
';
#need the extra comma
$columns_sql
.=
<<'EXTRA';
ax.xref_id, ax.source_xref_id, ax.condition_type, ax.associated_group_id, ax.rank
EXTRA
$tables_sql
.=
<<'EXTRA';
LEFT JOIN associated_xref ax ON ax.object_xref_id = oxr.object_xref_id
LEFT JOIN associated_group ag ON ax.associated_group_id = ag.associated_group_id
EXTRA
}
#Join the above together into one statement
my
$sql
=
"
$columns_sql
$tables_sql
$where_sql
";
# warn $sql; # uncomment me to see the full SQL generated
if
(
defined
(
$exdbname
)
)
{
if
(
index
(
$exdbname
,
'
%
'
)
!=
-
1
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment