Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl
Commits
1289dac2
Commit
1289dac2
authored
Sep 26, 2002
by
Graham McVicker
Browse files
Added remove method for database feature removal to the BaseFeatureAdaptor
parent
aef7c979
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
8 deletions
+123
-8
modules/Bio/EnsEMBL/BaseAlignFeature.pm
modules/Bio/EnsEMBL/BaseAlignFeature.pm
+1
-1
modules/Bio/EnsEMBL/DBSQL/BaseFeatureAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/BaseFeatureAdaptor.pm
+44
-2
modules/Bio/EnsEMBL/DBSQL/DnaAlignFeatureAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/DnaAlignFeatureAdaptor.pm
+1
-1
modules/Bio/EnsEMBL/DBSQL/ProxyDnaAlignFeatureAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/ProxyDnaAlignFeatureAdaptor.pm
+75
-2
modules/Bio/EnsEMBL/RepeatFeature.pm
modules/Bio/EnsEMBL/RepeatFeature.pm
+1
-1
modules/Bio/EnsEMBL/SimpleFeature.pm
modules/Bio/EnsEMBL/SimpleFeature.pm
+1
-1
No files found.
modules/Bio/EnsEMBL/BaseAlignFeature.pm
View file @
1289dac2
...
...
@@ -247,7 +247,7 @@ sub transform{
sub
dbID
{
my
(
$self
,
$arg
)
=
@_
;
if
(
$arg
){
if
(
defined
$arg
){
$self
->
{
_database_id
}
=
$arg
;
}
...
...
modules/Bio/EnsEMBL/DBSQL/BaseFeatureAdaptor.pm
View file @
1289dac2
...
...
@@ -586,6 +586,48 @@ sub store{
}
=head2 remove
Arg [1] : A feature $feature
Example : $feature_adaptor->remove($feature);
Description: This removes a feature from the database. The table the
feature is removed from is defined by the abstract method
_tablename, and the primary key of the table is assumed
to be _tablename() . '_id'. The feature argument must
be an object implementing the dbID method, and for the
feature to be removed from the datasbase a dbID value must
be returned.
Returntype : none
Exceptions : thrown if $feature arg does not implement dbID(), or if
$feature->dbID is not a true value
Caller : general
=cut
sub
remove
{
my
(
$self
,
$feature
)
=
@_
;
unless
(
$feature
->
can
('
dbID
'))
{
$self
->
throw
("
Feature [
$feature
] does not implement method dbID
");
}
unless
(
$feature
->
dbID
)
{
$self
->
warn
("
BaseFeatureAdaptor::remove - dbID not defined -
"
.
"
feature could not be removed
");
}
my
$table
=
$self
->
_tablename
();
my
$sth
=
$self
->
prepare
("
DELETE FROM
$table
WHERE
${table}
_id = ?
");
$sth
->
execute
(
$feature
->
dbID
());
#unset the feature dbID
$feature
->
dbID
('');
return
;
}
=head2 _tablename
Args : none
...
...
@@ -629,7 +671,7 @@ sub _columns {
}
=head2 _obj_from_
hashref
=head2 _obj
s
_from_
sth
Arg [1] : DBI::row_hashref $hashref containing key-value pairs
for each of the columns specified by the _columns method
...
...
@@ -643,7 +685,7 @@ sub _columns {
=cut
sub
_obj_from_
hashref
{
sub
_obj
s
_from_
sth
{
my
$self
=
shift
;
$self
->
throw
("
abstract method _obj_from_hashref not defined by implementing
"
...
...
modules/Bio/EnsEMBL/DBSQL/DnaAlignFeatureAdaptor.pm
View file @
1289dac2
...
...
@@ -120,7 +120,7 @@ sub store {
my
$tablename
=
$self
->
_tablename
();
if
(
scalar
(
@sf
)
==
0
)
{
$self
->
throw
("
Must call store with
contig_id then
sequence features
");
$self
->
throw
("
Must call store with sequence features
");
}
my
$sth
=
$self
->
prepare
("
...
...
modules/Bio/EnsEMBL/DBSQL/ProxyDnaAlignFeatureAdaptor.pm
View file @
1289dac2
...
...
@@ -52,7 +52,7 @@ use vars qw(@ISA);
Arg [1] : string $constraint
Arg [2] : string $logic_name
Example :
Example :
none
Description: Overrides the Bio::EnsEMBL::DNAAlignFeatureAdaptor generic_fetch
method. Normally requests will still be forwarded to the
core (primary) database with the exception of requests that
...
...
@@ -76,12 +76,85 @@ sub generic_fetch {
return
$est_adaptor
->
generic_fetch
(
$constraint
,
$logic_name
);
}
}
#use the core adaptor
return
$self
->
{'
_primary_adaptor
'}
->
generic_fetch
(
$constraint
,
$logic_name
);
}
=head2 store
Arg [1] : Bio::EnsEMBL::DnaDnaAlignFeature $feature
Example : none
Description: overrides the store method to ensure that the est database
is used to store ex_e2g_features
Returntype : see DnaAlignFeatureAdaptor::store
Exceptions : none
Caller : general
=cut
sub
store
{
my
(
$self
,
@sfs
)
=
@_
;
my
$est_features
=
[]
;
my
$core_features
=
[]
;
my
$est_db
=
$self
->
db
()
->
get_db_adaptor
('
est
');
if
(
defined
$est_db
)
{
foreach
my
$f
(
@sfs
)
{
if
(
$f
->
analysis
()
&&
$f
->
analysis
()
->
logic_name
()
eq
'
ex_e2g_feat
')
{
push
@$est_features
,
$f
;
}
else
{
push
@$core_features
,
$f
;
}
#forward request to the EST db
my
$est_adaptor
=
$est_db
->
get_DnaAlignFeatureAdaptor
();
if
(
scalar
@$est_features
)
{
$est_adaptor
->
store
(
@$est_features
);
}
if
(
scalar
@$core_features
)
{
$self
->
{'
_primary_adaptor
'}
->
store
(
@$core_features
);
}
}
}
#use the core adaptor
return
$self
->
{'
_primary_adaptor
'}
->
store
(
@sfs
);
}
=head2 remove
Arg [1] : Bio::EnsEMBL::DnaDnaAlignFeature $feature
Example : none
Description: overrides the remove method to ensure that the est database
is used to remove ex_e2g_features
Returntype : none
Exceptions : none
Caller : general
=cut
sub
remove
{
my
(
$self
,
$feature
)
=
@_
;
if
(
$feature
&&
$feature
->
analysis
&&
$feature
->
analysis
()
->
logic_name
()
eq
'
ex_e2g_feat
')
{
my
$est_db
=
$self
->
db
()
->
get_db_adaptor
('
est
');
if
(
defined
$est_db
)
{
#forward request to the EST db
my
$est_adaptor
=
$est_db
->
get_DnaAlignFeatureAdaptor
();
return
$est_adaptor
->
remove
(
$feature
);
}
}
#use the core adaptor
return
$self
->
{'
_primary_adaptor
'}
->
remove
(
$feature
);
}
...
...
modules/Bio/EnsEMBL/RepeatFeature.pm
View file @
1289dac2
...
...
@@ -69,7 +69,7 @@ sub get_RepeatConsensus {
sub
dbID
{
my
(
$self
,
$db_id
)
=
@_
;
if
(
$db_id
)
{
if
(
defined
$db_id
)
{
$self
->
{'
_db_id
'}
=
$db_id
;
}
return
$self
->
{'
_db_id
'};
...
...
modules/Bio/EnsEMBL/SimpleFeature.pm
View file @
1289dac2
...
...
@@ -77,7 +77,7 @@ sub display_label{
sub
dbID
{
my
(
$self
,
$arg
)
=
@_
;
if
(
$arg
){
if
(
defined
$arg
){
$self
->
{
_database_id
}
=
$arg
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment