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
a695c506
Commit
a695c506
authored
23 years ago
by
Web Admin
Browse files
Options
Downloads
Patches
Plain Diff
added caching and embl db call
parent
ef55b4e4
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/LiteAdaptor.pm
+52
-3
52 additions, 3 deletions
modules/Bio/EnsEMBL/DBSQL/LiteAdaptor.pm
with
52 additions
and
3 deletions
modules/Bio/EnsEMBL/DBSQL/LiteAdaptor.pm
+
52
−
3
View file @
a695c506
...
...
@@ -52,6 +52,8 @@ sub new {
sub
fetch_virtualgenes_start_end
{
my
(
$self
,
$chr
,
$vc_start
,
$vc_end
)
=
@_
;
my
$_db_name
=
$self
->
{'
_lite_db_name
'};
my
$cache_name
=
"
_virtualgenes_cache_
$chr
"
.
"
_
$vc_start
"
.
"
_
$vc_end
";
return
$self
->
{
$cache_name
}
if
(
$self
->
{
$cache_name
}
);
my
$sth
=
$self
->
prepare
(
"
select g.gene, g.name,
g.chr_name, g.gene_chrom_start, g.gene_chrom_end,
...
...
@@ -61,7 +63,10 @@ sub fetch_virtualgenes_start_end {
g.chr_name = ? and g.gene_chrom_start <= ? and
g.gene_chrom_end >= ?
"
);
$sth
->
execute
(
$chr
,
$vc_end
,
$vc_start
);
eval
{
$sth
->
execute
(
$chr
,
$vc_end
,
$vc_start
);
};
return
[]
if
(
$@
);
my
@genes
;
while
(
my
$row
=
$sth
->
fetchrow_arrayref
()
)
{
push
@genes
,
{
...
...
@@ -77,21 +82,64 @@ sub fetch_virtualgenes_start_end {
'
db
'
=>
$row
->
[
7
]
};
}
return
$self
->
{
$cache_name
}
=
\
@genes
;
return
\
@genes
}
sub
fetch_EMBLgenes_start_end
{
my
(
$self
,
$chr
,
$vc_start
,
$vc_end
)
=
@_
;
my
$_db_name
=
$self
->
{'
_lite_db_name
'};
my
$cache_name
=
"
_emblgenes_cache_
$chr
"
.
"
_
$vc_start
"
.
"
_
$vc_end
";
return
$self
->
{
$cache_name
}
if
(
$self
->
{
$cache_name
}
);
my
$sth
=
$self
->
prepare
(
"
select g.gene, g.name,
g.chr_name, g.gene_chrom_start, g.gene_chrom_end,
g.chrom_strand, gx.display_id, gx.db_name, g.type
from
$_db_name
.embl_gene as g,
$_db_name
.embl_gene_xref as gx
where g.gene = gx.gene and
g.chr_name = ? and g.gene_chrom_start <= ? and
g.gene_chrom_end >= ?
"
);
eval
{
$sth
->
execute
(
$chr
,
$vc_end
,
$vc_start
);
};
return
[]
if
(
$@
);
my
@genes
;
while
(
my
$row
=
$sth
->
fetchrow_arrayref
()
)
{
push
@genes
,
{
'
gene
'
=>
$row
->
[
0
],
'
stable_id
'
=>
$row
->
[
1
],
'
chr_name
'
=>
$row
->
[
2
],
'
chr_start
'
=>
$row
->
[
3
],
'
chr_end
'
=>
$row
->
[
4
],
'
start
'
=>
$row
->
[
3
]
-
$vc_start
+
1
,
'
end
'
=>
$row
->
[
4
]
-
$vc_start
+
1
,
'
strand
'
=>
$row
->
[
5
],
'
synonym
'
=>
$row
->
[
6
],
'
db
'
=>
$row
->
[
7
],
'
type
'
=>
$row
->
[
8
]
};
}
return
$self
->
{
$cache_name
}
=
\
@genes
;
return
\
@genes
}
sub
fetch_virtualRepeatFeatures_start_end
{
my
(
$self
,
$chr
,
$vc_start
,
$vc_end
,
$type
,
$glob_bp
)
=
@_
;
my
$cache_name
=
"
_repeats_
$type
"
.
"
_cache_
$chr
"
.
"
_
$vc_start
"
.
"
_
$vc_end
";
return
$self
->
{
$cache_name
}
if
(
$self
->
{
$cache_name
}
);
my
$glob_bp
||=
0
;
my
$_db_name
=
$self
->
{'
_lite_db_name
'};
my
$sth
=
$self
->
prepare
(
"
select r.id, r.hid, r.chr_name, r.repeat_chrom_start, r.repeat_chrom_end, r.repeat_chrom_strand
from
$_db_name
.repeat as r
where r.chr_name = ? and r.repeat_chrom_start <= ? and r.repeat_chrom_end >= ?
"
.
(
(
defined
$type
&&
$type
ne
'')
?
"
and
hid like
'
$type
\
%
'
"
:
''
)
(
(
defined
$type
&&
$type
ne
'')
?
"
and
r.type =
'
$type
'
"
:
''
)
);
$sth
->
execute
(
$chr
,
$vc_end
,
$vc_start
);
eval
{
$sth
->
execute
(
$chr
,
$vc_end
,
$vc_start
);
};
return
[]
if
(
$@
);
my
@repeats
;
my
$old_end
=
-
99999999999999999
;
...
...
@@ -114,6 +162,7 @@ sub fetch_virtualRepeatFeatures_start_end {
}
$old_end
=
$end
;
}
return
$self
->
{
$cache_name
}
=
\
@repeats
;
return
\
@repeats
;
}
...
...
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