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
775da1f9
Commit
775da1f9
authored
10 years ago
by
Alessandro Vullo
Browse files
Options
Downloads
Patches
Plain Diff
[
ENSCORESW-1117
]. Method to access the list of all top level slices for a given genome component.
parent
950d35f4
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
+89
-0
89 additions, 0 deletions
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
with
89 additions
and
0 deletions
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
+
89
−
0
View file @
775da1f9
...
@@ -1139,6 +1139,95 @@ sub fetch_all {
...
@@ -1139,6 +1139,95 @@ sub fetch_all {
return
\
@out
;
return
\
@out
;
}
}
=head2 fetch_all_by_genome_component
Arg [1] : string $genome_component_name
The name of the genome component to retrieve slices of.
Example :
Description:
Returntype : listref of Bio::EnsEMBL::Slices
Exceptions : If argument is not provided or is not a valid genome
component
Caller : general
Status : Stable
=cut
sub
fetch_all_by_genome_component
{
my
$self
=
shift
;
my
$genome_component
=
shift
;
defined
$genome_component
or
throw
"
Undefined genome component
";
# check the provided genome component is valid
my
$gc
=
$self
->
db
->
get_adaptor
('
GenomeContainer
');
my
$is_valid_component
=
grep
{
$_
eq
$genome_component
}
@
{
$gc
->
get_genome_components
};
throw
"
Invalid genome component
"
unless
$is_valid_component
;
#
# Retrieve the toplevel seq_regions from the database
#
my
$sth
=
$self
->
prepare
(
"
SELECT sr.seq_region_id, sr.name, sr.length, sr.coord_system_id
"
.
"
FROM seq_region sr
"
.
"
JOIN seq_region_attrib sa1 USING (seq_region_id)
"
.
"
JOIN attrib_type a1 ON sa1.attrib_type_id = a1.attrib_type_id
"
.
"
JOIN seq_region_attrib sa2 USING (seq_region_id)
"
.
"
JOIN attrib_type a2 ON sa2.attrib_type_id = a2.attrib_type_id
"
.
"
WHERE sa2.value=? and a1.code='toplevel' and a2.code='genome_component'
"
);
if
(
looks_like_number
(
$genome_component
))
{
$sth
->
bind_param
(
1
,
$genome_component
,
SQL_INTEGER
);
}
else
{
$sth
->
bind_param
(
1
,
$genome_component
,
SQL_VARCHAR
);
}
$sth
->
execute
();
my
(
$seq_region_id
,
$name
,
$length
,
$cs_id
);
$sth
->
bind_columns
(
\
(
$seq_region_id
,
$name
,
$length
,
$cs_id
)
);
my
$cache_count
=
0
;
my
@out
;
my
$csa
=
$self
->
db
->
get_CoordSystemAdaptor
();
while
(
$sth
->
fetch
())
{
my
$cs
=
$csa
->
fetch_by_dbID
(
$cs_id
);
throw
("
seq_region
$name
references non-existent coord_system
$cs_id
.
")
unless
$cs
;
# cache values for future reference, but stop adding to the cache once we
# we know we have filled it up
if
(
$cache_count
<
$
Bio::EnsEMBL::Utils::SeqRegionCache::
SEQ_REGION_CACHE_SIZE
)
{
my
$arr
=
[
$seq_region_id
,
$name
,
$cs_id
,
$length
];
$self
->
{'
sr_name_cache
'}
->
{"
$name
:
$cs_id
"}
=
$arr
;
$self
->
{'
sr_id_cache
'}
->
{"
$seq_region_id
"}
=
$arr
;
$cache_count
++
;
}
my
$slice
=
push
@out
,
Bio::EnsEMBL::
Slice
->
new_fast
({
'
start
'
=>
1
,
'
end
'
=>
$length
,
'
strand
'
=>
1
,
'
seq_region_name
'
=>
$name
,
'
seq_region_length
'
=>
$length
,
'
coord_system
'
=>
$cs
,
'
adaptor
'
=>
$self
});
}
return
\
@out
;
}
=head2 fetch_all_karyotype
=head2 fetch_all_karyotype
Example : my $top = $slice_adptor->fetch_all_karyotype()
Example : my $top = $slice_adptor->fetch_all_karyotype()
...
...
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