Skip to content

Commit

Permalink
Improve runtime (#44)
Browse files Browse the repository at this point in the history
* expose max workers parameter to cli

* update triqler package to fix the issue with calculating PEPs which is extremely slow

* make grid search run with multithreading

* test max_workers cli argument

* fix format

* update triqler

Co-authored-by: Siegfried Gessulat <[email protected]>
Co-authored-by: Tobias <[email protected]>
  • Loading branch information
3 people authored Mar 9, 2022
1 parent bed4946 commit 1c76a7e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
8 changes: 8 additions & 0 deletions mokapot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ def _parser():
),
)

parser.add_argument(
"-w",
"--max_workers",
default=1,
type=int,
help="The number of processes to use for model training.",
)

parser.add_argument(
"-r",
"--file_root",
Expand Down
2 changes: 1 addition & 1 deletion mokapot/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def __init__(
"""Initialize a PercolatorModel"""
svm_model = LinearSVC(dual=False)
estimator = GridSearchCV(
svm_model, param_grid=PERC_GRID, refit=False, cv=3
svm_model, param_grid=PERC_GRID, refit=False, cv=3, n_jobs=-1
)

super().__init__(
Expand Down
6 changes: 5 additions & 1 deletion mokapot/mokapot.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ def main():

# Fit the models:
psms, models = brew(
datasets, model=model, test_fdr=config.test_fdr, folds=config.folds
datasets,
model=model,
test_fdr=config.test_fdr,
folds=config.folds,
max_workers=config.max_workers,
)

if config.dest_dir is not None:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ install_requires =
pandas>=1.0.3
scikit-learn>=0.22.1
numba>=0.48.0
triqler>=0.3.0
matplotlib>=3.1.3
lxml>=4.6.2
triqler>=0.6.2

[options.extras_require]
docs =
Expand Down
2 changes: 2 additions & 0 deletions tests/system_tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def test_cli_options(tmp_path, scope_files):
"--keep_decoys",
"--subset_max_train",
"50000",
"--max_workers",
"3",
]

subprocess.run(cmd, check=True)
Expand Down

0 comments on commit 1c76a7e

Please sign in to comment.