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
b5f973cd
Commit
b5f973cd
authored
21 years ago
by
Graham McVicker
Browse files
Options
Downloads
Patches
Plain Diff
SliceAdaptor::fetch_all now knows about special toplevel coord system
parent
70b76679
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/SliceAdaptor.pm
+38
-65
38 additions, 65 deletions
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
with
38 additions
and
65 deletions
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
+
38
−
65
View file @
b5f973cd
...
...
@@ -490,9 +490,10 @@ sub get_seq_region_attribs {
formerly on the ChromosomeAdaptor, RawContigAdaptor and
CloneAdaptor classes. Slices fetched span the entire
seq_regions and are on the forward strand.
If the coordinate system with the provided name and version
does not exist an empty list is returned.
Returntype : listref of Bio::EnsEMBL::Slices
Exceptions : throw if invalid coord system is provided
throw if max_length < 1 is provided
Exceptions : throw if max_length < 1 is provided
throw if overlap < 0 is provided
throw if overlap is provided but max_length is not
throw if overlap is greater than max_length
...
...
@@ -524,36 +525,56 @@ sub fetch_all {
}
if
(
$max_length
<=
$overlap
)
{
throw
("
Overlap must be less than max_length.
");
}
}
}
#
# verify existance of requested coord system and get its id
#
my
$csa
=
$self
->
db
->
get_CoordSystemAdaptor
();
my
$cs
=
$csa
->
fetch_by_name
(
$cs_name
,
$cs_version
);
my
$csa
=
$self
->
db
->
get_CoordSystemAdaptor
();
my
$orig_cs
=
$csa
->
fetch_by_name
(
$cs_name
,
$cs_version
);
return
[]
if
(
!
$orig_cs
);
my
$sth
;
#
# Retrieve the seq_region from the database
# Retrieve the seq_region
s
from the database
#
my
$sth
=
$self
->
prepare
('
SELECT seq_region_id, name, length
'
.
'
FROM seq_region
'
.
'
WHERE coord_system_id =?
');
$sth
->
execute
(
$cs
->
dbID
);
if
(
$orig_cs
->
is_top_level
())
{
$sth
=
$self
->
prepare
("
SELECT sr.seq_region_id, sr.name, sr.length,
"
.
"
sr.coord_system_id
"
.
"
FROM seq_region sr,
"
.
"
seq_region_attrib sra, attrib_type at
"
.
"
WHERE at.code='toplevel'
"
.
"
AND at.attrib_type_id=sra.attrib_type_id
"
.
"
AND sra.seq_region_id=sr.seq_region_id
");
$sth
->
execute
();
}
else
{
$sth
=
$self
->
prepare
('
SELECT seq_region_id, name, length, coord_system_id
'
.
'
FROM seq_region
'
.
'
WHERE coord_system_id =?
');
$sth
->
execute
(
$orig_cs
->
dbID
);
}
my
(
$seq_region_id
,
$name
,
$length
);
$sth
->
bind_columns
(
\
$seq_region_id
,
\
$name
,
\
$length
);
my
(
$seq_region_id
,
$name
,
$length
,
$cs_id
);
$sth
->
bind_columns
(
\
$seq_region_id
,
\
$name
,
\
$length
,
\
$cs_id
);
my
$name_cache
=
$self
->
{'
_name_cache
'};
my
$id_cache
=
$self
->
{'
_id_cache
'};
my
$cache_count
=
0
;
my
$cs_key
=
lc
(
$cs
->
name
()
.
'
:
'
.
$cs_version
);
my
@out
;
while
(
$sth
->
fetch
())
{
my
$cs
=
$csa
->
fetch_by_dbID
(
$cs_id
);
if
(
!
$cs
)
{
throw
("
seq_region
$name
references non-existent coord_system
$cs_id
.
");
}
my
$cs_key
=
lc
(
$cs
->
name
()
.
'
:
'
.
$cs_version
);
#cache values for future reference, but stop adding to the cache once we
#we know we have filled it up
...
...
@@ -608,60 +629,12 @@ sub fetch_all {
$start
+=
$multiple
;
}
}
$sth
->
finish
();
return
\
@out
;
}
=head2 fetch_all_non_redundant
Arg [1] : none
Example : @all = @{$slice_adaptor->fetch_all_non_redundant()};
Description: Retrieves all non-redundant slices, i.e. those which have
the attribute 'nonredundant' set
Returntype : listref of Bio::EnsEMBL::Slices
Exceptions : none
Caller : general
=cut
sub
fetch_all_non_redundant
{
my
$self
=
shift
;
my
$sth
=
$self
->
prepare
("
SELECT s.name, s.length, c.coord_system_id
"
.
"
FROM seq_region s, coord_system c, seq_region_attrib sra, attrib_type at
"
.
"
WHERE s.coord_system_id=c.coord_system_id
"
.
"
AND at.code='nonredundant'
"
.
"
AND at.attrib_type_id=sra.attrib_type_id
"
.
"
AND sra.seq_region_id=s.seq_region_id
");
$sth
->
execute
();
my
(
$name
,
$length
,
$cs_id
);
$sth
->
bind_columns
(
\
$name
,
\
$length
,
\
$cs_id
);
# Slice expects a CoordSystem object
my
$cs_adaptor
=
$self
->
db
->
get_CoordSystemAdaptor
();
my
@out
;
while
(
$sth
->
fetch
())
{
my
$cs
=
$cs_adaptor
->
fetch_by_dbID
(
$cs_id
);
push
@out
,
Bio::EnsEMBL::
Slice
->
new
(
-
START
=>
1
,
-
END
=>
$length
,
-
STRAND
=>
1
,
-
SEQ_REGION_NAME
=>
$name
,
-
SEQ_REGION_LENGTH
=>
$length
,
-
COORD_SYSTEM
=>
$cs
,
-
ADAPTOR
=>
$self
);
}
return
\
@out
;
}
sub
deleteObj
{
my
$self
=
shift
;
...
...
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