Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl
Commits
671df1a0
Commit
671df1a0
authored
Mar 19, 2019
by
Marek Szuba
Browse files
Avoid using unless and the postfix form of if
parent
ede045fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
13 deletions
+36
-13
modules/Bio/EnsEMBL/DBSQL/RNAProductAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/RNAProductAdaptor.pm
+9
-3
modules/Bio/EnsEMBL/RNAProduct.pm
modules/Bio/EnsEMBL/RNAProduct.pm
+22
-9
modules/t/rnaProduct.t
modules/t/rnaProduct.t
+5
-1
No files found.
modules/Bio/EnsEMBL/DBSQL/RNAProductAdaptor.pm
View file @
671df1a0
...
...
@@ -178,7 +178,9 @@ sub fetch_all_by_external_name {
sub
fetch_all_by_type
{
my
(
$self
,
$type_code
)
=
@_
;
throw
("
type code argument is required
")
unless
$type_code
;
if
(
!
defined
$type_code
)
{
throw
("
type code argument is required
");
}
return
(
$self
->
_fetch_direct_query
(['
pt.code
',
$type_code
,
SQL_VARCHAR
]));
}
...
...
@@ -203,7 +205,9 @@ sub fetch_all_by_type {
sub
fetch_by_dbID
{
my
(
$self
,
$dbID
)
=
@_
;
throw
("
dbID argument is required
")
unless
defined
(
$dbID
);
if
(
!
defined
$dbID
)
{
throw
("
dbID argument is required
");
}
return
(
$self
->
_fetch_direct_query
(['
rp.rnaproduct_id
',
$dbID
,
SQL_INTEGER
]))
->
[
0
];
}
...
...
@@ -225,7 +229,9 @@ sub fetch_by_dbID {
sub
fetch_by_stable_id
{
my
(
$self
,
$stable_id
)
=
@_
;
throw
("
stable id argument is required
")
unless
$stable_id
;
if
(
!
defined
$stable_id
)
{
throw
("
stable id argument is required
");
}
return
(
$self
->
_fetch_direct_query
(['
rp.stable_id
',
$stable_id
,
SQL_VARCHAR
]))
->
[
0
];
}
...
...
modules/Bio/EnsEMBL/RNAProduct.pm
View file @
671df1a0
...
...
@@ -258,7 +258,9 @@ sub cdna_start {
sub
created_date
{
my
$self
=
shift
;
$self
->
{'
created_date
'}
=
shift
if
(
@
_
);
if
(
@
_
)
{
$self
->
{'
created_date
'}
=
shift
;
}
return
$self
->
{'
created_date
'};
}
...
...
@@ -298,7 +300,9 @@ sub display_id {
sub
end
{
my
$self
=
shift
;
$self
->
{'
end
'}
=
shift
if
(
@
_
);
if
(
@
_
)
{
$self
->
{'
end
'}
=
shift
;
}
return
$self
->
{'
end
'};
}
...
...
@@ -592,7 +596,9 @@ sub get_all_xrefs { ## no critic (Subroutines::RequireArgUnpacking)
sub
modified_date
{
my
$self
=
shift
;
$self
->
{'
modified_date
'}
=
shift
if
(
@
_
);
if
(
@
_
)
{
$self
->
{'
modified_date
'}
=
shift
;
}
return
$self
->
{'
modified_date
'};
}
...
...
@@ -635,7 +641,9 @@ sub length { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
sub
load
{
my
(
$self
,
$load_xrefs
)
=
@_
;
$load_xrefs
=
1
unless
defined
(
$load_xrefs
);
if
(
!
defined
$load_xrefs
)
{
$load_xrefs
=
1
;
}
$self
->
seq
();
...
...
@@ -682,8 +690,7 @@ sub seq {
}
return
''
unless
defined
(
$self
->
{'
seq
'});
return
$self
->
{'
seq
'};
return
(
$self
->
{'
seq
'}
//
q{}
);
}
...
...
@@ -703,7 +710,9 @@ sub seq {
sub
stable_id
{
my
$self
=
shift
;
$self
->
{'
stable_id
'}
=
shift
if
(
@
_
);
if
(
@
_
)
{
$self
->
{'
stable_id
'}
=
shift
;
}
return
$self
->
{'
stable_id
'};
}
...
...
@@ -758,7 +767,9 @@ sub stable_id_version {
sub
start
{
my
$self
=
shift
;
$self
->
{'
start
'}
=
shift
if
(
@
_
);
if
(
@
_
)
{
$self
->
{'
start
'}
=
shift
;
}
return
$self
->
{'
start
'};
}
...
...
@@ -969,7 +980,9 @@ sub type_code {
sub
version
{
my
$self
=
shift
;
$self
->
{'
version
'}
=
shift
if
(
@
_
);
if
(
@
_
)
{
$self
->
{'
version
'}
=
shift
;
}
return
$self
->
{'
version
'};
}
...
...
modules/t/rnaProduct.t
View file @
671df1a0
...
...
@@ -31,7 +31,11 @@ use Test::Warnings;
use
Test::
Exception
;
my
$loaded
=
0
;
END
{
print
"
not ok 1 - Test set-up completed
\n
"
unless
$loaded
;
}
END
{
if
(
!
$loaded
)
{
print
"
not ok 1 - Test set-up completed
\n
";
}
}
use
Bio::EnsEMBL::Test::
MultiTestDB
;
...
...
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