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
ae2b2483
Commit
ae2b2483
authored
22 years ago
by
Alistair Rust
Browse files
Options
Downloads
Patches
Plain Diff
- Removed a couple of delete_* methods.
- Refactored the remove method.
parent
e8cb5843
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/CloneAdaptor.pm
+18
-59
18 additions, 59 deletions
modules/Bio/EnsEMBL/DBSQL/CloneAdaptor.pm
with
18 additions
and
59 deletions
modules/Bio/EnsEMBL/DBSQL/CloneAdaptor.pm
+
18
−
59
View file @
ae2b2483
...
...
@@ -295,79 +295,38 @@ sub list_embl_version_by_accession {
}
=head2
delete_by_dbID
=head2
remove
Arg [1] : string $clone_id
the EMBL accession of the clone to delete
Example : $clone_adaptor->delete($clone_id);
Arg [1] : Bio::Ensembl::Clone $clone
Example : $clone_adaptor->remove($clone);
Description: Deletes clone (itself), including contigs and features,
but not its genes
Returntype : none
Exceptions : thrown if any portion of deletion fails
Exceptions : thrown if the clone deletion fails
throw if attached to the wrong database
Caller : ?
=cut
sub
delete_by_dbID
{
my
(
$self
,
$clone_id
)
=
@_
;
# a list of feature adaptors to be looped over
my
@adaptor_list
=
qw( SimpleFeature RepeatFeature PredictionTranscript
ProteinAlignFeature DnaAlignFeature)
;
# Make a list of all contig and dna entries to delete
my
$sth
=
$self
->
prepare
(
qq{
SELECT contig_id, dna_id
FROM contig
WHERE clone_id = $clone_id
}
);
$sth
->
execute
;
sub
remove
{
my
(
$self
,
$clone
)
=
@_
;
my
(
@contigs
,
@dnas
);
while
(
my
(
$c
,
$d
)
=
$sth
->
fetchrow_array
)
{
push
(
@contigs
,
$c
);
push
(
@dnas
,
$d
);
}
# Delete features for each contig, and each contig
foreach
my
$contig_id
(
@contigs
)
{
# grab each feature adaptor in turn
# admittedly not the most efficient way..
foreach
my
$adaptor
(
@adaptor_list
)
{
my
$adaptor_type
=
"
get_
"
.
$adaptor
.
"
Adaptor
";
my
$fa
=
$self
->
db
->
$adaptor_type
;
if
(
!
$fa
)
{
$self
->
throw
("
Couldn't get a '
$adaptor
'Adaptor
");
}
$fa
->
delete_by_RawContig_id
(
$contig_id
);
}
my
$sth
=
$self
->
prepare
("
DELETE FROM contig WHERE contig_id =
$contig_id
");
$sth
->
execute
;
$self
->
throw
("
Failed to delete contigs for contig_id '
$contig_id
'
")
unless
$sth
->
rows
;
if
(
$clone
->
adaptor
ne
$self
)
{
$self
->
throw
("
Trying to delete a clone attached to a different database.
");
}
# Delete DNA as long as we aren't using a remote DNA database.
if
(
$self
->
db
ne
$self
->
db
->
dnadb
)
{
$self
->
warn
("
Using a remote dna database - not deleting dna
\n
");
}
else
{
foreach
my
$dna_id
(
@dnas
)
{
$sth
=
$self
->
prepare
("
DELETE FROM dna WHERE dna_id =
$dna_id
");
$sth
->
execute
;
$self
->
throw
("
Failed to delete dna for dna_id '
$dna_id
'
")
unless
$sth
->
rows
;
}
# Delete all contigs and related features
my
$contigs
=
$clone
->
get_all_Contigs
;
my
$rca
=
$self
->
db
->
get_RawContigAdaptor
;
foreach
my
$contig
(
@$contigs
)
{
$rca
->
remove
(
$contig
);
}
# Delete the row for the clone
$sth
=
$self
->
prepare
("
DELETE FROM clone WHERE clone_id =
$clone_id
");
$sth
->
execute
;
$self
->
throw
("
Failed to delete clone for clone_id '
$clone
_id
'
")
my
$sth
=
$self
->
prepare
("
DELETE FROM clone WHERE clone_id =
?
");
$sth
->
execute
(
$clone
->
dbID
)
;
$self
->
throw
("
Failed to delete clone for clone_id '
$clone
->dbID
'
")
unless
$sth
->
rows
;
}
...
...
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