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
7e646b02
Commit
7e646b02
authored
21 years ago
by
Graham McVicker
Browse files
Options
Downloads
Patches
Plain Diff
removed seq_region_attrib functions now present on AttributeAdaptor instead
parent
8b27ca5d
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
+0
-125
0 additions, 125 deletions
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
with
0 additions
and
125 deletions
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
+
0
−
125
View file @
7e646b02
...
...
@@ -410,131 +410,6 @@ sub get_seq_region_id {
}
=head2 get_seq_region_attribs
Arg [1] : Bio::EnsEMBL::Slice $slice
The slice to fetch attributes for
Example : %attribs = %{$slice_adaptor->get_seq_region_attribs($slice)};
($htg_phase) = @{$attribs->{'htg_phase'} || []};
@synonyms = @{$attribs->{'synonym'} || []};
Description: Retrieves a reference to a hash containing attrib code values
and listref value keys.
Returntype : hashref
Exceptions : throw if the seq_region of the slice is not in the db
throw if incorrect arg provided
Caller : Bio::EnsEMBL::Slice
=cut
sub
get_seq_region_attribs
{
my
$self
=
shift
;
my
$slice
=
shift
;
if
(
!
ref
(
$slice
)
||
!
$slice
->
isa
('
Bio::EnsEMBL::Slice
'))
{
throw
('
Slice argument is required
');
}
my
$srid
=
$self
->
get_seq_region_id
(
$slice
);
if
(
!
$srid
)
{
throw
('
Slice is not on a seq_region stored in this database.
');
}
$self
->
{'
_attribs_cache
'}
||=
{};
if
(
$self
->
{'
_attribs_cache
'}
->
{
$srid
})
{
return
$self
->
{'
_attribs_cache
'}
->
{
$srid
};
}
my
$sth
=
$self
->
prepare
('
SELECT at.code, sra.value
'
.
'
FROM seq_region_attrib sra, attrib_type at
'
.
'
WHERE sra.seq_region_id = ?
'
.
'
AND at.attrib_type_id = sra.attrib_type_id
');
$sth
->
execute
(
$srid
);
my
(
$code
,
$attrib
);
$sth
->
bind_columns
(
\
$code
,
\
$attrib
);
my
%attrib_hash
;
while
(
$sth
->
fetch
())
{
$attrib_hash
{
uc
(
$code
)}
||=
[]
;
push
@
{
$attrib_hash
{
uc
(
$code
)}},
$attrib
;
}
$sth
->
finish
();
$self
->
{'
_attribs_cache
'}
->
{
$srid
}
=
\
%attrib_hash
;
return
\
%attrib_hash
;
}
=head2 set_seq_region_attrib
Arg [1] : Bio::EnsEMBL::Slice $slice
The seq_region of the slice is the one which gets this attribute set
Arg [2] : string $code
code in attrib_type table. This method can not set name or description in
that table.
Arg [3] : string $value
An attribute value for the given code and seq_region
Example : $slice_adaptor->set_seq_region_attrib
( $chromosome_slice, "GeneCount", 23332 )
Description: Set an attribute for given slices seq_region.
Returntype : none
Exceptions : none
Caller : general
=cut
sub
set_seq_region_attrib
{
my
$self
=
shift
;
my
$slice
=
shift
;
my
$code
=
shift
;
my
$value
=
shift
;
my
$sth
=
$self
->
prepare
("
INSERT IGNORE INTO attrib_type set code = ?
");
$sth
->
execute
(
$code
);
my
$atid
=
$sth
->
{'
mysql_insertid
'};
$sth
->
finish
();
if
(
$self
->
db
->
db_handle
->
{'
mysql_info
'}
==
0
){
# the insert failed because the code is already stored
$sth
=
$self
->
prepare
("
SELECT attrib_type_id FROM attrib_type
"
.
"
WHERE code = ?
");
$sth
->
execute
(
$code
);
(
$atid
)
=
$sth
->
fetchrow_array
();
$sth
->
finish
();
if
(
!
$atid
)
{
throw
("
Could not store or fetch attrib_type code [
$code
]
\n
"
.
"
Wrong permissions?
");
}
}
my
$srid
=
$self
->
get_seq_region_id
(
$slice
);
$sth
=
$self
->
prepare
("
INSERT INTO seq_region_attrib
"
.
"
SET seq_region_id=?, value=?, attrib_type_id=?
"
);
$sth
->
execute
(
$srid
,
$value
,
$atid
);
$sth
->
finish
();
#update the cache if it exists already
if
(
exists
$self
->
{'
_attribs_cache
'}
&&
exists
$self
->
{'
_attribs_cache
'}
->
{
$srid
})
{
$self
->
{'
_attribs_cache
'}
->
{
$srid
}
->
{
uc
(
$code
)}
||=
[]
;
push
(
@
{
$self
->
{'
_attribs_cache
'}
->
{
$srid
}
->
{
uc
(
$code
)}},
$value
);
}
return
;
}
=head2 fetch_all
...
...
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