Skip to content

Commit

Permalink
calibration bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbinBouwmeester committed May 8, 2023
1 parent d5a9168 commit ad37433
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [2.1.1] - 2023-05-08

### Changed
- Calibration bug fix

# [2.1.0] - 2023-05-08

### Changed
Expand Down
4 changes: 2 additions & 2 deletions deeplc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def run(
dict_cal_divider=dict_divider,
write_library=write_library,
use_library=use_library,
pygam_calibration=pygam_calibration,
batch_num=batch_num,
n_jobs=n_threads,
verbose=verbose,
Expand All @@ -181,12 +182,11 @@ def run(
# Calibrate the original model based on the new retention times
if len(psm_list_cal) > 0:
logger.info("Selecting best model and calibrating predictions...")
print(psm_list_cal)
dlc.calibrate_preds(psm_list=psm_list_cal)

# Make predictions; calibrated or uncalibrated
logger.info("Making predictions using model: %s", dlc.model)
if file_cal:
if len(psm_list_cal) > 0:
preds = dlc.make_preds(seq_df=df_pred, infile=file_pred, psm_list=psm_list_pred)
else:
preds = dlc.make_preds(seq_df=df_pred, infile=file_pred, psm_list=psm_list_pred, calibrate=False)
Expand Down
5 changes: 3 additions & 2 deletions deeplc/_argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def parse_arguments(gui=False):
calibration_group.add_argument(
"--pygam_calibration",
dest="pygam_calibration",
action="store_true",
default=True,
help=(
"use pyGAM generalized additive model as calibration method; "
"recommended; default"
Expand All @@ -150,7 +150,8 @@ def parse_arguments(gui=False):
calibration_group.add_argument(
"--transfer_learning",
dest="transfer_learning",
action="store_false",
#action="store_false",
default=False,
help="use transfer learning as calibration method",
**gooey_args["transfer_learning"]
)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='deeplc',
version='2.1.0',
version='2.1.1',
license='apache-2.0',
description='DeepLC: Retention time prediction for (modified) peptides using Deep Learning.',
long_description=LONG_DESCRIPTION,
Expand Down
8 changes: 5 additions & 3 deletions tests/test_deeplc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ def test_cli_full():

command = [
"deeplc", "--file_pred", file_path_pred, "--file_cal", file_path_cal,
"--file_pred_out", file_path_out
"--file_pred_out", file_path_out,
]
subprocess.run(command, check=True)

preds_df = pd.read_csv(file_path_out)
model_r2 = r2_score(preds_df['tr'], preds_df['predicted_tr'])
train_df = pd.read_csv(file_path_pred)
model_r2 = r2_score(train_df['tr'], preds_df['predicted retention time'])
logging.info(f"{len(train_df.index)}{len(preds_df.index)}")
logging.info("DeepLC R2 score on %s: %f", file_path_pred, model_r2)
assert model_r2 > 0.90, f"DeepLC R2 score on {file_path_pred} below 0.95 \
assert model_r2 > 0.90, f"DeepLC R2 score on {file_path_pred} below 0.9 \
(was {model_r2})"


Expand Down

0 comments on commit ad37433

Please sign in to comment.