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
249fb779
Commit
249fb779
authored
10 years ago
by
Kieron Taylor
Browse files
Options
Downloads
Patches
Plain Diff
[
ENSCORESW-1050
] Cure issues with get_nearest_Gene caused by minor invocation bugs.
parent
9861ea20
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/Bio/EnsEMBL/DBSQL/BaseFeatureAdaptor.pm
+2
-2
2 additions, 2 deletions
modules/Bio/EnsEMBL/DBSQL/BaseFeatureAdaptor.pm
modules/Bio/EnsEMBL/Feature.pm
+3
-2
3 additions, 2 deletions
modules/Bio/EnsEMBL/Feature.pm
modules/t/getNearestFeature.t
+15
-9
15 additions, 9 deletions
modules/t/getNearestFeature.t
with
20 additions
and
13 deletions
modules/Bio/EnsEMBL/DBSQL/BaseFeatureAdaptor.pm
+
2
−
2
View file @
249fb779
...
...
@@ -1476,8 +1476,8 @@ sub remove_by_feature_id {
sub
fetch_nearest_by_Feature
{
my
$self
=
shift
;
my
$feature
=
shift
;
my
@hits
=
@
{
$self
->
fetch_all_by_outward_search
(
-
FEATURE
=>
$feature
,
-
MAX_RANGE
=>
1000000
,
-
RANGE
=>
1000
-
LIMIT
=>
1
)
};
return
$hits
[
0
]
if
(
@hits
>
0
);
my
@hits
=
@
{
$self
->
fetch_all_by_outward_search
(
-
FEATURE
=>
$feature
,
-
MAX_RANGE
=>
1000000
,
-
RANGE
=>
1000
,
-
LIMIT
=>
1
)
};
return
$hits
[
0
]
if
(
scalar
@hits
>
0
);
return
;
}
...
...
This diff is collapsed.
Click to expand it.
modules/Bio/EnsEMBL/Feature.pm
+
3
−
2
View file @
249fb779
...
...
@@ -1440,7 +1440,7 @@ sub get_overlapping_Genes{
=head2 get_nearest_Gene
Description: Get the nearest genes to the feature
Returntype :
listref of
Bio::EnsEMBL::Gene
Returntype : Bio::EnsEMBL::Gene
Caller : general
Status : At risk
...
...
@@ -1449,7 +1449,8 @@ sub get_overlapping_Genes{
sub
get_nearest_Gene
{
my
$self
=
shift
;
my
$ga
=
Bio::EnsEMBL::
Registry
->
get_adaptor
(
$self
->
adaptor
->
db
->
species
,'
core
','
Gene
');
return
$ga
->
fetch_nearest_by_Feature
(
$self
);
my
(
$gene
,
$distance
)
=
@
{
$ga
->
fetch_nearest_by_Feature
(
$self
)
};
return
$gene
;
}
=head2 summary_as_hash
...
...
This diff is collapsed.
Click to expand it.
modules/t/getNearestFeature.t
+
15
−
9
View file @
249fb779
...
...
@@ -245,19 +245,13 @@ cmp_ok($results[3]->[0]->display_id, 'eq', 'c', 'Check for a feature found outsi
### Issues/Todos ###
#
#2 Ordering is wrong and seemingly arbitrary when dealing with negative numbers. Drop
# negative numbers, such that the distances are standardised.
# This will be useful for filtering, which will be a common task, and leave up/downsteam
# detection to users, as this will be much less common?
#6 For streamed queries we probably do not want to return features where the target measurement point is enclosed
# by the source feature. This suggests we should change the functionality of -NOT_OVERLAPPING to -INCLUDE_ENCLOSED
# Including overlaps should be the default for non-streamed queries
# 8 Strand tests seem lacking, so we need to add a target feature on the negative strand for each context?
# 10 STRAND could be renamed, as this is a little ambiguous to. Could be -TARGET_STRAND ?
# Also take +/- aswell as 1/-1?
# 13 Add iterator
note
("
Nathan's tests
");
my
$g
=
Bio::EnsEMBL::
SimpleFeature
->
new
(
...
...
@@ -458,11 +452,23 @@ sub print_what_you_got {
note
("
Results:
"
.
scalar
@$results
.
"
features
");
if
(
scalar
(
@$results
)
==
0
)
{
note
("
No hits
");
return
;}
for
(
my
$i
=
0
;
$i
<
scalar
(
@$results
);
$i
++
)
{
my
(
$feature
,
$distance
,
$effective
,
$length
,
$dbID
)
=
@
{
$results
->
[
$i
]};
my
(
$feature
,
$distance
)
=
@
{
$results
->
[
$i
]};
no
warnings
'
uninitialized
';
note
("
Feature:
"
.
$feature
->
display_id
.
"
at
"
.
$distance
.
"
,
"
.
$effective
.
"
, length:
"
.
$length
);
note
("
Feature:
"
.
$feature
->
display_id
.
"
at
"
.
$distance
);
}
}
# test utility functions get_nearest_Gene and
$dba
=
$db
->
get_DBAdaptor
('
core
');
my
$tra
=
$dba
->
get_TranscriptAdaptor
();
my
$ga
=
$dba
->
get_GeneAdaptor
();
my
$enst
=
$tra
->
fetch_by_stable_id
('
ENST00000300415
');
my
$gene
;
(
$gene
,
$distance
)
=
@
{
$ga
->
fetch_nearest_by_Feature
(
$enst
)
};
is
(
$gene
->
stable_id
,
'
ENSG00000101331
','
Simple usecase for fetch_nearest_by_Feature
');
my
$ensg
=
$enst
->
get_nearest_Gene
;
# diag(Dumper $ensg);
is
(
$ensg
->
stable_id
,'
ENSG00000101331
','
Simple usecase for get_nearest_Gene
');
done_testing
;
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