Skip to content

Commit

Permalink
updated biofilm call + temp_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Nov 23, 2022
1 parent be2f32b commit f9c45bc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ Throughout the program, several output files are generated and stored in the fol


#### Validate your model using the **eval** mode
You can also use CheRRIs **eval** mode to create a validation result table and than use the [coupute_f1](./scripts/plots/compute_f1.py) to get the F1 score.
You can also use CheRRIs **eval** mode to create a validation result table and than use the [compute_f1](./scripts/plots/compute_f1.py) to get the F1 score.

In the following is a example call to validate a theoretical model build from DataA
```
cherri eval -i1 /path/to/Model_folder/DataA/feature_files/feature_filtered_<DataA>_context_<150>_pos_occ -g human -l human -o /path/to/Model_folder -n <val_modelA> -c 150 -st on -m /path/to/Model_folder/DataA/model/optimized/full_<DataA>_context_<150>.model -mp /path/to/Model_folder/DataA/feature_files/training_data_<DataA>_context_<150>.npz -j 10 -on evaluation -hf on
```
Than use the result file to compute the F1 score using [coupute_f1](./scripts/plots/compute_f1.py).
Than use the result file to compute the F1 score using [compute_f1](./scripts/plots/compute_f1.py).

### Build a new CheRRI model in training mode

Expand Down
28 changes: 23 additions & 5 deletions bin/cherri
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import sys
import rrieval.lib as rl
from scipy.sparse import csr_matrix, vstack, hstack, load_npz, save_npz
from ubergauss.tools import loadfile, dumpfile
#import logging
## DeBug, INFO
# import subprocess

#logging.basicConfing(filenema='cherri.log'level=logging.DEBUG)


__version__ = "0.5"
__version__ = "0.6"

"""
Expand Down Expand Up @@ -201,7 +203,9 @@ def setup_argument_parser():
p_mrg.add_argument("-on", "--out_name",
default="non",
help= "Name for the output directory, default 'date_Cherri_evaluating_RRIs' ")

p_mrg.add_argument("-tp", "--temp_dir",
default="off",
help= "Set a temporary directory for autosklearn. Either provede a path or 'out' to set it to the output directory Defalut:off")


return p
Expand Down Expand Up @@ -542,6 +546,7 @@ def main_train(args):
mixed = args.mixed
filter_hybrid = args.filter_hybrid
out_name = args.out_name
temp_dir = args.temp_dir


methods = (f'extra_trees passive_aggressive random_forest sgd '
Expand Down Expand Up @@ -728,12 +733,18 @@ def main_train(args):

if use_structure == 'ON' or use_structure == 'on':
loaddata = f' --infile {feat_output} '
opt_call = (f'python -W ignore -m biofilm.biofilm-optimize6 {loaddata} '
opt_call = (f'python -W ignore -m biofilm.optimize6 {loaddata} '
f'--memoryMBthread {memoryPerThread} --folds 0 '
f'--out {opt_path}{midel_name} --preprocess True '
f'--n_jobs {n_jobs} --time {run_time} --methods {methods}'
# f' --tmp_folder {opt_path}\autosklearn_temp'
)
if temp_dir != 'off':
if temp_dir == 'out' or temp_dir == 'OUT':
opt_call = opt_call + f' --tmp_folder {opt_path}/autosklearn_temp'
else:
opt_call = opt_call + f' --tmp_folder {temp_dir}/autosklearn_temp'


print('4a. Optimize model\n')
#print(opt_call)
Expand All @@ -750,10 +761,17 @@ def main_train(args):
rl.call_script(call_refit)
elif use_structure == 'OFF' or use_structure == 'off':
loaddata = f' --infile {feat_output} --featurefile {out_feat}'
opt_call = (f'python -W ignore -m biofilm.biofilm-optimize6 {loaddata} '
opt_call = (f'python -W ignore -m biofilm.optimize6 {loaddata} '
f'--memoryMBthread {memoryPerThread} --folds 0 '
f'--out {opt_path}{midel_name} --preprocess True '
f'--n_jobs {n_jobs} --time {run_time} --methods {methods}')
if temp_dir != 'off':
if temp_dir == 'out' or temp_dir == 'OUT':
opt_call= f'{opt_call} --tmp_folder {opt_path}\autosklearn_temp'
else:
opt_call= f'{opt_call} --tmp_folder {temp_dir}\autosklearn_temp'


print('4b. Optimize model\n')
#print(opt_call)
out = rl.call_script(opt_call, reprot_stdout=True,asset_err=False)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name='cherri',
version='0.5',
version='0.6',
description='Cherri is a tool for classification of RNA-RNA interactions.',
long_description=readme,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit f9c45bc

Please sign in to comment.