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
ba272226
Commit
ba272226
authored
18 years ago
by
Patrick Meidl
Browse files
Options
Downloads
Patches
Plain Diff
implemented score filters to limit the number of nodes in the history tree
parent
fa964f59
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/DBSQL/ArchiveStableIdAdaptor.pm
+50
-18
50 additions, 18 deletions
modules/Bio/EnsEMBL/DBSQL/ArchiveStableIdAdaptor.pm
with
50 additions
and
18 deletions
modules/Bio/EnsEMBL/DBSQL/ArchiveStableIdAdaptor.pm
+
50
−
18
View file @
ba272226
...
...
@@ -76,7 +76,8 @@ use Bio::EnsEMBL::StableIdEvent;
use
Bio::EnsEMBL::
StableIdHistoryTree
;
use
Bio::EnsEMBL::Utils::
Exception
qw(deprecate warning)
;
use
Data::
Dumper
;
use
constant
MAX_ROWS
=>
50
;
use
constant
NUM_HIGH_SCORERS
=>
20
;
=head2 fetch_by_stable_id
...
...
@@ -622,7 +623,13 @@ sub fetch_history_tree_by_stable_id {
# while we got someting to do
while
(
my
(
$id
)
=
keys
(
%do
))
{
warn
"
$id
\n
";
# if we already have more than MAX_ROWS stable IDs in this tree, we can't
# build the full tree. Return undef.
if
(
scalar
(
keys
(
%done
))
>
MAX_ROWS
)
{
warning
("
Too many related stable IDs to draw a history tree.
");
$sth
->
finish
;
return
undef
;
}
# mark this stable ID as done
delete
$do
{
$id
};
...
...
@@ -633,6 +640,8 @@ sub fetch_history_tree_by_stable_id {
$sth
->
bind_param
(
2
,
$id
,
SQL_VARCHAR
);
$sth
->
execute
;
my
@events
;
while
(
my
$r
=
$sth
->
fetchrow_hashref
)
{
#
...
...
@@ -641,8 +650,6 @@ sub fetch_history_tree_by_stable_id {
#
my
(
$old_id
,
$new_id
);
Data::Dumper::
Dumper
(
$r
);
if
(
$r
->
{'
old_stable_id
'})
{
$old_id
=
Bio::EnsEMBL::
ArchiveStableId
->
new
(
-
stable_id
=>
$r
->
{'
old_stable_id
'},
...
...
@@ -653,12 +660,6 @@ sub fetch_history_tree_by_stable_id {
-
type
=>
$r
->
{'
type
'},
-
adaptor
=>
$self
);
# add to history tree
$history
->
add_ArchiveStableIds
(
$old_id
);
# mark stable IDs as todo if appropriate
$do
{
$old_id
->
stable_id
}
=
1
unless
$done
{
$old_id
->
stable_id
};
}
if
(
$r
->
{'
new_stable_id
'})
{
...
...
@@ -671,12 +672,6 @@ sub fetch_history_tree_by_stable_id {
-
type
=>
$r
->
{'
type
'},
-
adaptor
=>
$self
);
# add to history tree
$history
->
add_ArchiveStableIds
(
$new_id
);
# mark stable IDs as todo if appropriate
$do
{
$new_id
->
stable_id
}
=
1
unless
$done
{
$new_id
->
stable_id
};
}
my
$event
=
Bio::EnsEMBL::
StableIdEvent
->
new
(
...
...
@@ -685,10 +680,47 @@ sub fetch_history_tree_by_stable_id {
-
score
=>
$r
->
{'
score
'}
);
# add to history tree
$history
->
add_StableIdEvents
(
$event
);
push
@events
,
$event
;
}
# filter out low-scoring events; the number of highest scoring events
# returned is defined by NUM_HIGH_SCORERS
my
@others
;
foreach
my
$event
(
@events
)
{
my
$old_id
=
$event
->
old_ArchiveStableId
;
my
$new_id
=
$event
->
new_ArchiveStableId
;
# creation, deletion and mapping-to-self events are added to the history
# tree directly
if
(
!
$old_id
||
!
$new_id
||
(
$old_id
->
stable_id
eq
$new_id
->
stable_id
))
{
$history
->
add_StableIdEvents
(
$event
);
}
else
{
push
@others
,
$event
;
}
}
if
(
scalar
(
@others
)
>
NUM_HIGH_SCORERS
)
{
warn
"
Filtering
"
.
(
scalar
(
@others
)
-
NUM_HIGH_SCORERS
)
.
"
low-scoring events.
\n
";
}
my
$k
=
0
;
foreach
my
$event
(
sort
{
$b
->
score
<=>
$a
->
score
}
@others
)
{
$history
->
add_StableIdEvents
(
$event
);
# mark stable IDs as todo if appropriate
$do
{
$event
->
old_ArchiveStableId
->
stable_id
}
=
1
unless
$done
{
$event
->
old_ArchiveStableId
->
stable_id
};
$do
{
$event
->
new_ArchiveStableId
->
stable_id
}
=
1
unless
$done
{
$event
->
new_ArchiveStableId
->
stable_id
};
last
if
(
++
$k
==
NUM_HIGH_SCORERS
);
}
}
$sth
->
finish
;
...
...
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