Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Ludovic PLATON
/
IRSOM
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Ludovic PLATON
2018-05-09 14:50:24 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
12e17b2a23f2170a87a5ad348fbb2ad21aefabc7
12e17b2a
1 parent
bf817d9d
Fix missing rejection threshold for prediction
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
scripts/predict.py
scripts/predict.py
View file @
12e17b2
""" Test SLSOM model on ncRNA.
Usage:
predict.py --featurer=<path> --file=<path_fasta> --model=<path> --output=<path> [--keep_features]
predict.py --featurer=<path> --file=<path_fasta> --model=<path> --output=<path> [--
reject=<value>] [--
keep_features]
predict.py (-h | --help)
predict.py --version
...
...
@@ -11,6 +11,7 @@ Options:
--file=<path> Path to the fasta file
--model=<path> Path to the folder containing the model
--output=<path> Path to the output dir
--reject=<value> Rejection threshold.
--keep_features Keep the features computed in the "output" folder.
--version
...
...
@@ -27,7 +28,7 @@ from SLSOM.SOM import *
from
SLSOM.util
import
*
def
save_pred
(
som
,
data
,
data_names
,
y
,
proba
,
bmu
,
path
):
y_label
=
[
"Noncoding"
if
x
==
1
else
"Coding
"
for
x
in
y
]
y_label
=
[
"Noncoding"
if
x
==
1
else
if
x
==
0
"Coding"
else
"Rejected
"
for
x
in
y
]
res
=
np
.
array
([
[
data_names
[
i
],
bmu
[
i
],
y_label
[
i
]]
+
[
proba
[
i
,
j
]
for
j
in
range
(
proba
.
shape
[
1
])]
for
i
in
range
(
data
.
shape
[
0
])])
...
...
@@ -66,6 +67,8 @@ def main():
print
(
"Model loaded"
)
y
,
proba
=
ssom
.
predict
(
data
)
y
=
np
.
array
(
y
)
if
not
arguments
[
"--reject"
]:
y
[
proba
<
float
(
arguments
[
"--reject"
])]
=
-
1
bmu
=
np
.
array
(
som
.
get_BMUS
(
data
))
save_pred
(
som
,
data
,
data_names
,
y
,
proba
,
bmu
,
output_path
)
...
...
Please
register
or
login
to post a comment