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
91202fa8
Commit
91202fa8
authored
Jul 30, 2018
by
Marek Szuba
Browse files
MicroRNA: enforce hairpin-arm correctness in constructor and setter
parent
b09454db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
modules/Bio/EnsEMBL/MicroRNA.pm
modules/Bio/EnsEMBL/MicroRNA.pm
+25
-0
No files found.
modules/Bio/EnsEMBL/MicroRNA.pm
View file @
91202fa8
...
...
@@ -112,6 +112,9 @@ sub new { ## no critic (Subroutines::RequireArgUnpacking)
my
$type_id
=
2
;
my
(
$arm
)
=
rearrange
(["
ARM
"],
@
_
);
if
(
defined
(
$arm
))
{
_validate_arm_value
(
$arm
);
}
$self
->
{'
arm
'}
=
$arm
;
return
$self
;
...
...
@@ -135,6 +138,7 @@ sub arm {
my
(
$self
,
$arm
)
=
@_
;
if
(
defined
$arm
)
{
_validate_arm_value
(
$arm
);
$self
->
{'
arm
'}
=
$arm
;
}
elsif
(
!
defined
(
$self
->
{'
arm
'}))
{
my
$arm_attrs
=
$self
->
get_all_Attributes
('
mirna_arm
');
...
...
@@ -171,4 +175,25 @@ sub summary_as_hash {
return
$summary
;
}
# _validate_arm_value
# Arg [1] : int $arm which arm of the hairpin precursor this miRNA
# comes from
# Description: PRIVATE validates if its argument has one of the accepted
# values for specifying the miRNA hairpin arm.
# Returntype : none
# Exceptions : throw if the argument is out of bounds
# Caller : internal
# Status : Stable
sub
_validate_arm_value
{
my
(
$arm
)
=
@_
;
if
((
$arm
!=
3
)
&&
(
$arm
!=
5
))
{
throw
("
'
$arm
' is not a valid miRNA hairpin-arm specification
");
}
return
;
}
1
;
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