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
a641c2b9
Commit
a641c2b9
authored
19 years ago
by
Glenn Proctor
Browse files
Options
Downloads
Patches
Plain Diff
Moved to RegulatoryFactorAdaptor.pm
parent
aec8a3c0
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/RegulatoryMotifAdaptor.pm
+0
-185
0 additions, 185 deletions
modules/Bio/EnsEMBL/DBSQL/RegulatoryMotifAdaptor.pm
with
0 additions
and
185 deletions
modules/Bio/EnsEMBL/DBSQL/RegulatoryMotifAdaptor.pm
deleted
100644 → 0
+
0
−
185
View file @
aec8a3c0
#
# EnsEMBL module for Bio::EnsEMBL::DBSQL::RegulatoryMotifAdaptor
#
# Copyright EMBL/EBI
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::EnsEMBL::DBSQL::RegulatoryMotifAdaptor
=head1
$rma = $database_adaptor->get_RegulatoryMotifAdaptor();
$regulatory_motif = $rma->fetch_by_dbID(132);
$regulatory_motif = $rma->fetch_by_name('Motif1');
@regulatory_motifs = $rma->fetch_all_by_type("promoter");
$rma->store($rm1, $rm2, $rm3);
=head1 DESCRIPTION
This is an adaptor for the retrieval and storage of RegulatoryMotif objects.
=head1 AUTHOR - Glenn Proctor
Email glenn@ebi.ac.uk
=head1 CONTACT
Post questions to the EnsEMBL developer list ensembl-dev@ebi.ac.uk
=head1 METHODS
=cut
package
Bio::EnsEMBL::DBSQL::
RegulatoryMotifAdaptor
;
use
strict
;
use
Bio::EnsEMBL::DBSQL::
BaseAdaptor
;
use
Bio::EnsEMBL::
RegulatoryMotif
;
use
Bio::EnsEMBL::Utils::
Exception
qw(throw deprecate)
;
use
vars
qw(@ISA)
;
@ISA
=
('
Bio::EnsEMBL::DBSQL::BaseAdaptor
');
=head2 fetch_by_dbID
Arg [1] : int $db_id
The database identifier for the RegulatoryMotif to obtain
Example : $regulatory_motif = $rma->fetch_by_dbID(4);
Description: Obtains a RegulatoryMotif object from the database via its
primary key.
Returntype : Bio::EnsEMBL::RegulatoryMotif
Exceptions : none
Caller : general, Bio::EnsEMBL::RegulatoryMotifAdaptor
=cut
sub
fetch_by_dbID
{
my
(
$self
,
$db_id
)
=
@_
;
my
(
$rc
)
=
@
{
$self
->
_generic_fetch
("
regulatory_motif_id =
$db_id
")};
return
$rc
;
}
=head2 fetch_by_name
Arg [1] : string $name
the name of the regulatory motif to obtain
Example : $rc = $rma->fetch_by_name('Motif');
Description: Obtains a regulatory motif from the database via its name
Returntype : Bio::EnsEMBL::RegulatoryMotif
Exceptions : none
Caller : general
=cut
sub
fetch_by_name
{
my
(
$self
,
$name
)
=
@_
;
my
(
$rc
)
=
@
{
$self
->
_generic_fetch
("
name = '
$name
'
")};
return
$rc
;
}
=head2 fetch_all_by_type
Arg [1] : string $type
the type of regulatory motif to obtain
Example : $rm = $rma->fetch_all_by_type('promoter');
Description: Obtains all regulatory motifs of a particular type
Returntype : listREF of Bio::EnsEMBL::RegulatoryMotifs
Exceptions : none
Caller : general
=cut
sub
fetch_all_by_type
{
my
(
$self
,
$type
)
=
@_
;
return
$self
->
_generic_fetch
("
type = '
$type
'
");
}
=head2 _generic_fetch
Arg [1] : string $where_clause
Example : none
Description: PRIVATE used to create RegulatoryMotif features from an
SQL constraint
Returntype : listref of Bio::EnsEMBL::RegulatoryMotif objects
Exceptions : none
Caller : internal
=cut
sub
_generic_fetch
{
my
(
$self
,
$where_clause
)
=
@_
;
my
(
$regulatory_motif_id
,
$name
,
$type
);
my
$sth
=
$self
->
prepare
(
qq{
SELECT regulatory_motif_id, name, type
FROM regulatory_motif
WHERE }
.
$where_clause
);
$sth
->
execute
;
$sth
->
bind_columns
(
\
$regulatory_motif_id
,
\
$name
,
\
$type
);
my
@motifs
;
while
(
$sth
->
fetch
)
{
push
@motifs
,
Bio::EnsEMBL::
RegulatoryMotif
->
new
(
-
DBID
=>
$regulatory_motif_id
,
-
NAME
=>
$name
,
-
TYPE
=>
$type
);
}
return
\
@motifs
;
}
=head2 store
Arg [1] : list of Bio::EnsEMBL::RegulatoryMotifs @motifs
Example : $rma->store(@motifs);
Description: stores a list of RegulatoryMotif objects in the database
Returntype : none
Exceptions : none
Caller : ?
=cut
sub
store
{
my
(
$self
,
@motifs
)
=
@_
;
my
$sth
=
$self
->
prepare
("
INSERT into regulatory_motif (name, type) VALUES (?,?)
");
foreach
my
$rm
(
@motifs
)
{
my
$name
=
$rm
->
name
or
throw
("
name not set
");
my
$type
=
$rm
->
type
or
throw
("
type not set
");
$sth
->
execute
(
$name
,
$type
);
my
$db_id
=
$sth
->
{'
mysql_insertid
'}
or
throw
("
Didn't get an insertid from the INSERT statement
");
$rm
->
dbID
(
$db_id
);
$rm
->
adaptor
(
$self
);
}
}
1
;
__END__
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