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
3964c3c0
Commit
3964c3c0
authored
21 years ago
by
Graham McVicker
Browse files
Options
Downloads
Patches
Plain Diff
Arne's uncommitted changes: addition of snp count calculations
parent
af938a0e
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
misc-scripts/density_feature/seq_region_stats.pl
+52
-2
52 additions, 2 deletions
misc-scripts/density_feature/seq_region_stats.pl
with
52 additions
and
2 deletions
misc-scripts/density_feature/seq_region_stats.pl
+
52
−
2
View file @
3964c3c0
use
strict
;
use
Bio::EnsEMBL::DBSQL::
DBAdaptor
;
use
Bio::EnsEMBL::Lite::
DBAdaptor
;
use
Getopt::
Long
;
my
(
$host
,
$user
,
$pass
,
$port
,
$dbname
);
...
...
@@ -42,6 +43,10 @@ if( ! $seq_region_count ) {
exit
();
}
my
$snps_present
=
lite_attach
(
$db
);
my
$slice_adaptor
=
$db
->
get_SliceAdaptor
();
my
$attrib_adaptor
=
$db
->
get_AttributeAdaptor
();
...
...
@@ -53,7 +58,7 @@ foreach my $slice (@$top_slices) {
my
$num_genes
=
0
;
my
$num_pseudo_genes
=
0
;
print
"
Processing seq_region
",
$slice
->
seq_region_name
(),
"
\n
";
print
STDERR
"
Processing seq_region
",
$slice
->
seq_region_name
(),
"
\n
";
my
@genes
=
@
{
$slice
->
get_all_Genes
()};
...
...
@@ -88,11 +93,20 @@ foreach my $slice (@$top_slices) {
-
VALUE
=>
$num_pseudo_genes
,
-
DESCRIPTION
=>
'
Total Number of PseudoGenes
');
if
(
$snps_present
)
{
my
$snps
=
$slice
->
get_all_SNPs
();
push
@attribs
,
Bio::EnsEMBL::
Attribute
->
new
(
-
NAME
=>
'
SNP Count
',
-
CODE
=>
'
SNPCount
',
-
VALUE
=>
scalar
(
@$snps
),
-
DESCRIPTION
=>
'
Total Number of SNPs
');
}
$attrib_adaptor
->
store_on_Slice
(
$slice
,
\
@attribs
);
# print_chromo_stats([$slice]);
}
print_chromo_stats
(
\
@chromosomes
);
sub
print_chromo_stats
{
my
$chromosomes
=
shift
;
...
...
@@ -106,6 +120,42 @@ sub print_chromo_stats {
}
#
# tries to attach lite.
#
sub
lite_attach
{
my
$db
=
shift
;
my
$core_db_name
;
$core_db_name
=
$db
->
dbname
();
if
(
$core_db_name
!~
/_core_/
)
{
return
0
;
}
#
# get a lost of all databases on that server
#
my
$sth
=
$db
->
prepare
(
"
show databases
"
);
$sth
->
execute
();
my
$all_db_names
=
$sth
->
fetchall_arrayref
();
my
%all_db_names
=
map
{(
$_
->
[
0
]
,
1
)}
@$all_db_names
;
my
$snp_db_name
=
$core_db_name
;
$snp_db_name
=~
s/_core_/_lite_/
;
if
(
!
exists
$all_db_names
{
$snp_db_name
}
)
{
return
0
;
}
my
$snp_db
=
Bio::EnsEMBL::Lite::
DBAdaptor
->
new
(
-
host
=>
$db
->
host
(),
-
user
=>
$db
->
username
(),
-
pass
=>
$db
->
password
(),
-
port
=>
$db
->
port
(),
-
dbname
=>
$snp_db_name
);
$db
->
add_db_adaptor
(
"
lite
",
$snp_db
);
return
1
;
}
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