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
be84c574
Commit
be84c574
authored
11 years ago
by
Magali Ruffier
Browse files
Options
Downloads
Patches
Plain Diff
added remove methods for slices and sequences
parent
84a5e56d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm
+32
-0
32 additions, 0 deletions
modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
+69
-0
69 additions, 0 deletions
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
with
101 additions
and
0 deletions
modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm
+
32
−
0
View file @
be84c574
...
...
@@ -573,6 +573,38 @@ sub store {
return
;
}
=head2 remove
Arg [1] : int $seq_region_id the id of the sequence region this dna
is associated with.
Example : $seq_adaptor->remove(11);
Description: removes a dna sequence for a given seq_region_id
Returntype : none
Exceptions : throw if the database delete fails
Caller : Internal
Status : Stable
=cut
sub
remove
{
my
(
$self
,
$seq_region_id
)
=
@_
;
if
(
!
$seq_region_id
)
{
throw
('
seq_region_id is required
');
}
my
$statement
=
$self
->
prepare
("
DELETE FROM dna WHERE seq_region_id = ?
");
$statement
->
bind_param
(
1
,
$seq_region_id
,
SQL_INTEGER
);
$statement
->
execute
();
$statement
->
finish
();
return
;
}
...
...
This diff is collapsed.
Click to expand it.
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
+
69
−
0
View file @
be84c574
...
...
@@ -2053,6 +2053,75 @@ sub store {
return
$seq_region_id
;
}
=head2 remove
Arg [1] : Bio::EnsEMBL::Slice $slice
The slice to remove from the database
Example : $slice_adaptor->remove($slice);
Description: Removes a slice completely from the database.
All associated seq_region_attrib are removed as well.
If dna is attached to the slice, it is also removed.
Returntype : none
Exceptions : throw if slice has no coord system.
throw if slice argument is not passed
warning if slice is not stored in this database
Caller : general
Status : Stable
=cut
sub
remove
{
my
$self
=
shift
;
my
$slice
=
shift
;
#
# Get all of the sanity checks out of the way before storing anything
#
if
(
!
ref
(
$slice
)
||
!
(
$slice
->
isa
('
Bio::EnsEMBL::Slice
')
or
$slice
->
isa
('
Bio::EnsEMBL::LRGSlice
')))
{
throw
('
Slice argument is required
');
}
my
$cs
=
$slice
->
coord_system
();
throw
("
Slice must have attached CoordSystem.
")
if
(
!
$cs
);
my
$db
=
$self
->
db
();
my
$seq_region_id
=
$slice
->
get_seq_region_id
();
if
(
$cs
->
is_sequence_level
())
{
my
$seq_adaptor
=
$db
->
get_SequenceAdaptor
();
$seq_adaptor
->
remove
(
$seq_region_id
);
}
if
(
defined
(
$slice
->
{'
synonym
'})){
foreach
my
$syn
(
@
{
$slice
->
{'
synonym
'}}
){
$syn
->
seq_region_id
(
$seq_region_id
);
# set the seq_region_id
$syn
->
adaptor
->
remove
(
$syn
);
}
}
my
$attrib_adaptor
=
$self
->
db
->
get_AttributeAdaptor
();
$attrib_adaptor
->
remove_from_Slice
(
$slice
);
my
$sr_name
=
$slice
->
seq_region_name
();
#remove the seq_region
my
$sth
=
$db
->
dbc
->
prepare
("
DELETE FROM seq_region
"
.
"
WHERE name = ? AND
"
.
"
coord_system_id = ?
"
);
$sth
->
bind_param
(
1
,
$sr_name
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$cs
->
dbID
,
SQL_INTEGER
);
$sth
->
execute
();
return
;
}
=head2 fetch_assembly
Arg [1] : Bio::EnsEMBL::Slice $asm_slice
...
...
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