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
9718d7e8
Commit
9718d7e8
authored
14 years ago
by
Ian Longden
Browse files
Options
Downloads
Patches
Plain Diff
seq region synonym code
parent
8abf94cb
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/SeqRegionSynonymAdaptor.pm
+79
-0
79 additions, 0 deletions
modules/Bio/EnsEMBL/DBSQL/SeqRegionSynonymAdaptor.pm
modules/Bio/EnsEMBL/SeqRegionSynonym.pm
+108
-0
108 additions, 0 deletions
modules/Bio/EnsEMBL/SeqRegionSynonym.pm
with
187 additions
and
0 deletions
modules/Bio/EnsEMBL/DBSQL/SeqRegionSynonymAdaptor.pm
0 → 100644
+
79
−
0
View file @
9718d7e8
=head1 LICENSE
Copyright (c) 1999-2010 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license.
For license details, please see
http://www.ensembl.org/info/about/code_licence.html
=head1 CONTACT
Please email comments or questions to the public Ensembl
developers list at <dev@ensembl.org>.
Questions may also be sent to the Ensembl help desk at
<helpdesk@ensembl.org>.
INTO
=cut
package
Bio::EnsEMBL::DBSQL::
SeqRegionSynonymAdaptor
;
use
vars
qw(@ISA)
;
use
strict
;
use
Bio::EnsEMBL::DBSQL::
BaseAdaptor
;
use
Bio::EnsEMBL::Utils::
Exception
qw(throw deprecate warning stack_trace_dump)
;
use
Bio::EnsEMBL::
SeqRegionSynonym
;
@ISA
=
('
Bio::EnsEMBL::DBSQL::BaseAdaptor
');
sub
get_synonyms
{
my
$self
=
shift
;
my
$seq_id
=
shift
;
my
@results
;
my
$sth
=
$self
->
prepare
("
select seq_region_synonym_id, synonym, external_db_id from seq_region_synonym where seq_region_id = ?
");
$sth
->
bind_param
(
1
,
$seq_id
,
SQL_INTEGER
);
$sth
->
execute
();
my
$dbid
;
my
$alt_name
;
my
$ex_db
;
$sth
->
bind_columns
(
\
$dbid
,
\
$alt_name
,
\
$ex_db
);
while
(
$sth
->
fetch
()){
push
@results
,
Bio::EnsEMBL::
SeqRegionSynonym
->
new
(
-
adaptor
=>
$self
,
-
synonym
=>
$alt_name
,
-
dbID
=>
$dbid
,
-
external_db_id
=>
$ex_db
,
-
seq_region_id
=>
$seq_id
);
}
$sth
->
finish
;
return
\
@results
;
}
sub
store
{
my
$self
=
shift
;
my
$syn
=
shift
;
return
if
(
$syn
->
is_stored
(
$self
->
db
));
if
(
!
defined
(
$syn
->
seq_region_id
)){
throw
("
seq_region_id is needed to store a seq_region_synoym
");
}
my
$sth
=
$self
->
prepare
("
INSERT IGNORE INTO seq_region_synonym (seq_region_id, synonym, external_db_id) VALUES (?, ?, ?)
");
$sth
->
bind_param
(
1
,
$syn
->
seq_region_id
,
SQL_INTEGER
);
$sth
->
bind_param
(
2
,
$syn
->
name
,
SQL_VARCHAR
);
$sth
->
bind_param
(
3
,
$syn
->
external_db_id
,
SQL_INTEGER
);
$sth
->
execute
;
$syn
->
{'
dbID
'}
=
$sth
->
{'
mysql_insertid
'};
$sth
->
finish
;
}
1
;
This diff is collapsed.
Click to expand it.
modules/Bio/EnsEMBL/SeqRegionSynonym.pm
0 → 100644
+
108
−
0
View file @
9718d7e8
=head1 LICENSE
Copyright (c) 1999-2010 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license.
For license details, please see
http://www.ensembl.org/info/about/code_licence.html
=head1 CONTACT
Please email comments or questions to the public Ensembl
developers list at <dev@ensembl.org>.
Questions may also be sent to the Ensembl help desk at
<helpdesk@ensembl.org>.
=cut
=head1 NAME
Bio::EnsEMBL::SeqRegionSynonym -
Object representing an alternatice name.
=head1 SYNOPSIS
=head1 DESCRIPTION
This object holds information about alternative name to
Ensembl seq regions.
=head1 METHODS
=cut
package
Bio::EnsEMBL::
SeqRegionSynonym
;
use
strict
;
use
warnings
;
no
warnings
qw(uninitialized)
;
use
Bio::EnsEMBL::
Storable
;
use
Bio::Annotation::
DBLink
;
use
Bio::EnsEMBL::Utils::
Argument
qw(rearrange)
;
use
Bio::EnsEMBL::Utils::
Exception
qw(deprecate)
;
our
@ISA
=
qw(Bio::EnsEMBL::Storable)
;
=head2 new
Args [...] : list of named parameters
Example : my $srs = new Bio::EnsEMBL::SeqRegionSynonym(
-adaptor => $adaptor,
-synonym => $alt_name,
-external_db_id => 1234
-seq_region_id => 12);
Description: Creates a new SeqRegionSynonym object
Returntype : Bio::EnsEMBL::SeqRegionSynonym
Exceptions : none
Caller : Bio::EnsEMBL::SeqRegionSynonymAdaptor
Status : At Risk
=cut
sub
new
{
my
(
$class
,
@args
)
=
@_
;
my
$self
=
bless
{},
$class
;
my
(
$adaptor
,
$synonym
,
$ex_db
,
$seq_region_id
,
$dbid
)
=
rearrange
(
['
ADAPTOR
','
SYNONYM
','
EXTERNAL_DB_ID
','
SEQ_REGION_ID
','
DBID
'],
@args
);
$self
->
{'
adaptor
'}
=
$adaptor
;
if
(
defined
$ex_db
)
{
$self
->
external_db_id
(
$ex_db
)
}
if
(
defined
$seq_region_id
)
{
$self
->
seq_region_id
(
$seq_region_id
)
}
if
(
defined
$dbid
)
{
$self
->
{'
dbID
'}
=
$dbid
}
if
(
defined
$synonym
)
{
$self
->
name
(
$synonym
)
;
}
else
{
warn
"
No alternative name given
\n
";
return
undef
;
}
return
$self
;
}
sub
name
{
my
$self
=
shift
;
$self
->
{'
name
'}
=
shift
if
(
@
_
);
return
$self
->
{'
name
'};
}
sub
external_db_id
{
my
$self
=
shift
;
$self
->
{'
ex_db
'}
=
shift
if
(
@
_
);
return
$self
->
{'
ex_db
'};
}
sub
seq_region_id
{
my
$self
=
shift
;
$self
->
{'
seq_region_id
'}
=
shift
if
(
@
_
);
return
$self
->
{'
seq_region_id
'};
}
1
;
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