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
b0ec954c
Commit
b0ec954c
authored
21 years ago
by
Arne Stabenau
Browse files
Options
Downloads
Patches
Plain Diff
overlaps function added.
parent
92a52abb
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/Feature.pm
+61
-0
61 additions, 0 deletions
modules/Bio/EnsEMBL/Feature.pm
with
61 additions
and
0 deletions
modules/Bio/EnsEMBL/Feature.pm
+
61
−
0
View file @
b0ec954c
...
...
@@ -785,6 +785,67 @@ sub seq {
}
=head2 overlaps
Arg 1 : Bio::EnsEMBL::Feature $feature
Example : if( $this_feature->overlaps( $otherfeature ) ...
Description: Test if two features overlap. Strandedness is ignored. Both features have
to have slices. If they are not on the same coordinate system they need
as well database connection.
Returntype : boolean 0,1
Exceptions : on no slices, wrong argument type, more if not on same coord_system
Caller : general
=cut
sub
overlaps
{
my
$self
=
shift
;
my
$feature
=
shift
;
if
(
!
$feature
->
isa
(
"
Bio::EnsEMBL::Feature
"
))
{
throw
(
"
Need a Bio::EnsEMBL::Feature as argument
"
);
}
if
(
!
defined
$self
->
slice
()
||
!
defined
$feature
->
slice
()
)
{
throw
(
"
Features need to contain slices to support overlaps
"
);
}
if
(
$self
->
slice
()
->
coord_system
()
->
equals
(
$feature
->
slice
()
->
coord_system
()))
{
if
(
$self
->
seq_region_name
()
eq
$feature
->
seq_region_name
()
)
{
if
(
$feature
->
seq_region_start
()
<=
$self
->
seq_region_end
()
&&
$self
->
seq_region_start
()
<=
$feature
->
seq_region_end
()
)
{
return
1
;
}
else
{
return
0
;
}
}
else
{
return
0
;
}
}
# not same coord system
# have to project
my
$projection
=
$self
->
project
(
$feature
->
slice
()
->
coord_system
()
->
name
(),
$feature
->
slice
()
->
coord_system
()
->
version
());
for
my
$proj
(
@$projection
)
{
my
$slice
=
$proj
->
[
2
];
if
(
$slice
->
seq_region_name
()
eq
$feature
->
seq_region_name
()
&&
$slice
->
start
()
<=
$feature
->
seq_region_end
()
&&
$feature
->
seq_region_start
()
<=
$slice
->
end
()
)
{
return
1
;
}
return
0
;
}
}
##############################################
# Methods included for backwards compatibility
##############################################
...
...
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