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
19445692
Commit
19445692
authored
10 years ago
by
Magali Ruffier
Browse files
Options
Downloads
Patches
Plain Diff
ENSCORESW-926
: add update method for sliceAdaptor
parent
dc9ce250
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!25
GFF3 export: unstranded features and using analysis.gff_source
,
!25
GFF3 export: unstranded features and using analysis.gff_source
,
!25
GFF3 export: unstranded features and using analysis.gff_source
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
+64
-0
64 additions, 0 deletions
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
modules/t/sliceAdaptor.t
+13
-0
13 additions, 0 deletions
modules/t/sliceAdaptor.t
with
77 additions
and
0 deletions
modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
+
64
−
0
View file @
19445692
...
...
@@ -2054,6 +2054,70 @@ sub store {
return
$seq_region_id
;
}
sub
update
{
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
();
if
(
$slice
->
start
!=
1
||
$slice
->
strand
!=
1
)
{
throw
("
Slice must have start==1 and strand==1.
");
}
if
(
$slice
->
end
()
!=
$slice
->
seq_region_length
())
{
throw
("
Slice must have end==seq_region_length
");
}
my
$sr_len
=
$slice
->
length
();
my
$sr_name
=
$slice
->
seq_region_name
();
if
(
!
$sr_name
)
{
throw
("
Slice must have valid seq region name.
");
}
#update the seq_region
my
$seq_region_id
=
$slice
->
get_seq_region_id
();
my
$update_sql
=
qq(
UPDATE seq_region
SET name = ?,
length = ?,
coord_system_id = ?
WHERE seq_region_id = ?
)
;
my
$sth
=
$db
->
dbc
->
prepare
(
$update_sql
);
$sth
->
bind_param
(
1
,
$sr_name
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$sr_len
,
SQL_INTEGER
);
$sth
->
bind_param
(
3
,
$cs
->
dbID
,
SQL_INTEGER
);
$sth
->
bind_param
(
4
,
$seq_region_id
,
SQL_INTEGER
);
$sth
->
execute
();
#synonyms
if
(
defined
(
$slice
->
{'
synonym
'})){
foreach
my
$syn
(
@
{
$slice
->
{'
synonym
'}}
){
$syn
->
seq_region_id
(
$seq_region_id
);
# set the seq_region_id
my
$syn_adaptor
=
$db
->
get_SeqRegionSynonymAdaptor
();
$syn_adaptor
->
store
(
$syn
);
}
}
}
=head2 remove
Arg [1] : Bio::EnsEMBL::Slice $slice
...
...
This diff is collapsed.
Click to expand it.
modules/t/sliceAdaptor.t
+
13
−
0
View file @
19445692
...
...
@@ -297,6 +297,19 @@ ok($chr_slice->length() == $chr_len);
ok
(
$chr_slice
->
seq_region_length
()
==
$chr_len
);
ok
(
$chr_slice
->
seq_region_name
eq
$name
);
#
# Update a slice
#
$chr_slice
->
add_synonym
('
testregion3
');
$slice_adaptor
->
update
(
$chr_slice
);
my
$updated_slice
=
$slice_adaptor
->
fetch_by_region
('
chromosome
',
'
testregion3
');
ok
(
$updated_slice
->
length
()
==
$chr_len
);
ok
(
$updated_slice
->
seq_region_length
()
==
$chr_len
);
ok
(
$updated_slice
->
seq_region_name
eq
$name
);
#
# Store an assembly between the slices
#
...
...
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