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
286390ee
Commit
286390ee
authored
17 years ago
by
Patrick Meidl
Browse files
Options
Downloads
Patches
Plain Diff
fixed SyntenyRegion sorting
parent
8dd423fb
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/IdMapping/SyntenyFramework.pm
+23
-3
23 additions, 3 deletions
modules/Bio/EnsEMBL/IdMapping/SyntenyFramework.pm
with
23 additions
and
3 deletions
modules/Bio/EnsEMBL/IdMapping/SyntenyFramework.pm
+
23
−
3
View file @
286390ee
...
...
@@ -89,10 +89,15 @@ sub build_synteny {
push
@synteny_regions
,
$sr
;
}
unless
(
@synteny_regions
)
{
$self
->
logger
->
warning
("
No synteny regions could be identified.
\n
");
return
;
}
# sort synteny regions
my
@sorted
=
sort
{
$a
->
source_seq_region_name
cmp
$b
->
source_seq
_region
_name
or
$a
->
source_start
<=>
$b
->
source_start
}
@synteny_regions
;
my
@sorted
=
sort
_by_overlap
@synteny
_region
s
;
$self
->
logger
->
info
("
SyntenyRegions before merging:
"
.
scalar
(
@sorted
)
.
"
\n
")
;
# now create merged regions from overlapping syntenies, but only merge a
# maximum of 2 regions (otherwise you end up with large synteny blocks which
...
...
@@ -122,7 +127,22 @@ sub build_synteny {
$self
->
add_SyntenyRegion
(
$last_sr
->
stretch
(
2
));
$last_merged
=
0
;
}
$self
->
logger
->
info
("
SyntenyRegions after merging:
"
.
scalar
(
@
{
$self
->
get_all_SyntenyRegions
})
.
"
\n
");
}
sub
_by_overlap
{
# first sort by seq_region
my
$retval
=
(
$a
->
source_seq_region_name
cmp
$b
->
source_seq_region_name
);
return
$retval
if
(
$retval
);
# then sort by overlap:
# return -1 if $a is downstream, 1 if it's upstream, 0 if they overlap
if
(
$a
->
source_end
<
$b
->
source_start
)
{
return
-
1
;
}
if
(
$a
->
source_start
<
$b
->
source_end
)
{
return
1
;
}
return
0
;
}
...
...
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