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
afc25421
Commit
afc25421
authored
14 years ago
by
Nathan Johnson
Browse files
Options
Downloads
Patches
Plain Diff
fetch_all_by_name - Replaced fuzzy matching logic with simple like
parent
76b92b4a
No related branches found
Branches containing commit
Tags
cvs/release/ensemblgenomes/19-72
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/OntologyTermAdaptor.pm
+4
-38
4 additions, 38 deletions
modules/Bio/EnsEMBL/DBSQL/OntologyTermAdaptor.pm
with
4 additions
and
38 deletions
modules/Bio/EnsEMBL/DBSQL/OntologyTermAdaptor.pm
+
4
−
38
View file @
afc25421
...
@@ -123,12 +123,8 @@ sub ontology {
...
@@ -123,12 +123,8 @@ sub ontology {
Arg [1] : String - Name of term
Arg [1] : String - Name of term
Arg [2] : int - Fuzzy match flag:
Description : Fetches an ontology term(s) given a name, which may
1 = Try with spaces and underscores or none
contain MySQL wildcards i.e. _ or %
2 = Pre/Append wildcards
3 = Both of the above
Description : Fetches an ontology term(s) given a name.
Example :
Example :
...
@@ -139,37 +135,7 @@ sub ontology {
...
@@ -139,37 +135,7 @@ sub ontology {
=cut
=cut
sub
fetch_all_by_name
{
sub
fetch_all_by_name
{
my
(
$this
,
$name
,
$fuzzy
)
=
@_
;
my
(
$this
,
$name
)
=
@_
;
#fetch_all because term-ontolgy does not have unique key
#And fuzzy may bring back >1 term
#Case insensitivity is implicit due to table character collection
my
(
$name_clause
,
$name_string
);
if
(
!
$fuzzy
){
$name_clause
=
'
term.name = ?
';
$name_string
=
$name
;
}
elsif
(
$fuzzy
==
2
){
$name_clause
=
'
term.name like ?
';
$name_string
=
"
\
%
${name}
\
%
";
}
elsif
(
$fuzzy
<
4
){
#$fuzzy == 3
$name_clause
=
'
term.name rlike ?
';
(
$name_string
=
$name
)
=~
s/[\s_]+/\[ _\]*/g
;
#no need for .* at flanks as this is the default rlike behaviour
if
(
$fuzzy
==
1
){
$name_string
=
"
^
${name_string}
\$
";
}
}
else
{
throw
("
Fuzzy match level can only be set to 1, 2 or 3 not
$fuzzy
");
}
my
$statement
=
q(
my
$statement
=
q(
SELECT term.term_id,
SELECT term.term_id,
...
@@ -182,7 +148,7 @@ FROM ontology,
...
@@ -182,7 +148,7 @@ FROM ontology,
term
term
WHERE ontology.name = ?
WHERE ontology.name = ?
AND ontology.ontology_id = term.ontology_id
AND ontology.ontology_id = term.ontology_id
AND
)
.
$name_clause
;
AND
term.name like ?')
;
my
$sth
=
$this
->
prepare
(
$statement
);
my
$sth
=
$this
->
prepare
(
$statement
);
$sth
->
bind_param
(
1
,
$this
->
{'
ontology
'},
SQL_VARCHAR
);
$sth
->
bind_param
(
1
,
$this
->
{'
ontology
'},
SQL_VARCHAR
);
...
...
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