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
ba568ca2
Commit
ba568ca2
authored
12 years ago
by
Magali Ruffier
Browse files
Options
Downloads
Patches
Plain Diff
using array reference rather than an array
parent
b64d1356
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/Bio/EnsEMBL/Pipeline/Production/GeneCount.pm
+16
-14
16 additions, 14 deletions
modules/Bio/EnsEMBL/Pipeline/Production/GeneCount.pm
modules/Bio/EnsEMBL/Pipeline/Production/StatsGenerator.pm
+29
-9
29 additions, 9 deletions
modules/Bio/EnsEMBL/Pipeline/Production/StatsGenerator.pm
with
45 additions
and
23 deletions
modules/Bio/EnsEMBL/Pipeline/Production/GeneCount.pm
+
16
−
14
View file @
ba568ca2
...
...
@@ -9,25 +9,27 @@ use base qw/Bio::EnsEMBL::Pipeline::Production::StatsGenerator/;
sub
get_attrib_codes
{
my
(
$self
)
=
@_
;
my
@attrib_codes
=
('
coding_cnt
',
'
pseudogene_cnt
',
'
noncoding_cnt
');
return
@attrib_codes
;
my
%biotypes
;
foreach
my
$code
(
@attrib_codes
)
{
my
(
$group
)
=
$code
=~
/(\w+)\_cnt/
;
my
$biotypes
=
$self
->
get_biotype_group
(
$group
);
$biotypes
{
$code
}
=
$biotypes
;
}
return
%biotypes
;
}
sub
get_total
{
my
(
$self
)
=
@_
;
my
$species
=
$self
->
param
('
species
');
my
$total
=
scalar
(
@
{
Bio::EnsEMBL::
Registry
->
get_adaptor
(
$species
,
'
core
',
'
gene
')
->
fetch_all
});
return
$total
;
}
sub
get_feature_count
{
my
(
$self
,
$slice
,
$key
)
=
@_
;
my
$prod_dba
=
$self
->
get_production_DBAdaptor
();
my
$prod_helper
=
$prod_dba
->
dbc
()
->
sql_helper
();
my
(
$group
)
=
$key
=~
/(\w+)\_cnt/
;
my
$sql
=
q{
SELECT name
FROM biotype
WHERE biotype_group = ?
AND object_type = 'gene'
AND is_current = 1
AND db_type like '%core%' }
;
my
@biotypes
=
@
{
$prod_helper
->
execute_simple
(
-
SQL
=>
$sql
,
-
PARAMS
=>
[
$group
])
};
my
(
$self
,
$slice
,
$key
,
$biotypes
)
=
@_
;
my
$count
=
0
;
foreach
my
$biotype
(
@biotypes
)
{
foreach
my
$biotype
(
@
$
biotypes
)
{
$count
+=
scalar
(
@
{
$slice
->
get_all_Genes_by_type
(
$biotype
)
});
}
return
$count
;
...
...
This diff is collapsed.
Click to expand it.
modules/Bio/EnsEMBL/Pipeline/Production/StatsGenerator.pm
+
29
−
9
View file @
ba568ca2
...
...
@@ -13,23 +13,27 @@ sub run {
my
$species
=
$self
->
param
('
species
');
my
$dba
=
Bio::EnsEMBL::
Registry
->
get_DBAdaptor
(
$species
,
'
core
');
my
@attrib_codes
=
$self
->
get_attrib_codes
();
$self
->
delete_old_attrib
(
$dba
,
@attrib_codes
);
my
%attrib_codes
=
$self
->
get_attrib_codes
();
$self
->
delete_old_attrib
(
$dba
,
%attrib_codes
);
my
$total
=
$self
->
get_total
();
my
$sum
=
0
;
my
$slices
=
Bio::EnsEMBL::
Registry
->
get_adaptor
(
$species
,
'
core
',
'
slice
')
->
fetch_all
('
toplevel
');
while
(
my
$slice
=
shift
@$slices
)
{
foreach
my
$code
(
@attrib_codes
)
{
my
$count
=
$self
->
get_feature_count
(
$slice
,
$code
);
if
(
$count
>
0
)
{
$self
->
store_attrib
(
$slice
,
$count
,
$code
);
}
foreach
my
$code
(
keys
%attrib_codes
)
{
my
$count
=
$self
->
get_feature_count
(
$slice
,
$code
,
$attrib_codes
{
$code
});
$self
->
store_attrib
(
$slice
,
$count
,
$code
);
$sum
+=
$count
;
}
if
(
$sum
>=
$total
)
{
last
;
}
}
}
sub
delete_old_attrib
{
my
(
$self
,
$dba
,
@
attrib_codes
)
=
@_
;
my
(
$self
,
$dba
,
%
attrib_codes
)
=
@_
;
my
$helper
=
$dba
->
dbc
()
->
sql_helper
();
my
$sql
=
q{
DELETE sa
...
...
@@ -39,7 +43,7 @@ sub delete_old_attrib {
AND at.attrib_type_id = sa.attrib_type_id
AND cs.species_id = ?
AND at.code = ? }
;
foreach
my
$code
(
@
attrib_codes
)
{
foreach
my
$code
(
keys
%
attrib_codes
)
{
$helper
->
execute_update
(
-
SQL
=>
$sql
,
-
PARAMS
=>
[
$dba
->
species_id
(),
$code
]);
}
}
...
...
@@ -77,6 +81,22 @@ sub store_attrib {
$aa
->
store_on_Slice
(
$slice
,
\
@attribs
);
}
sub
get_biotype_group
{
my
(
$self
,
$biotype
)
=
@_
;
my
$prod_dba
=
$self
->
get_production_DBAdaptor
();
my
$helper
=
$prod_dba
->
dbc
()
->
sql_helper
();
my
$sql
=
q{
SELECT name
FROM biotype
WHERE object_type = 'gene'
AND is_current = 1
AND biotype_group = ?
AND db_type like '%core%' }
;
my
@biotypes
=
@
{
$helper
->
execute_simple
(
-
SQL
=>
$sql
,
-
PARAMS
=>
[
$biotype
])
};
return
\
@biotypes
;
}
1
;
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