Skip to content

Commit

Permalink
Merge pull request #2 from compomics/optimizations
Browse files Browse the repository at this point in the history
use_single_model
  • Loading branch information
rodvrees authored Apr 14, 2024
2 parents 01d0397 + c29f8fd commit 25b2a72
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions im2deep/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,21 @@ def setup_logging(passed_level):
default=2,
help="Charge state to use for calibration. Only used if calibrate_per_charge is set to False.",
)
@click.option(
"--use_single_model",
type=click.BOOL,
default=False,
help="Use a single model for prediction.",
)

def main(
psm_file: str,
calibration_file: Optional[str] = None,
output_file: Optional[str] = None,
model_name: Optional[str] = "tims",
log_level: Optional[str] = "info",
n_jobs: Optional[int] = None,
use_single_model: Optional[bool] = False,
calibrate_per_charge: Optional[bool] = True,
use_charge_state: Optional[int] = 2,
):
Expand Down Expand Up @@ -185,6 +193,7 @@ def main(
calibrate_per_charge=calibrate_per_charge,
use_charge_state=use_charge_state,
n_jobs=n_jobs,
use_single_model=use_single_model,
)
except IM2DeepError as e:
LOGGER.error(e)
Expand Down
2 changes: 1 addition & 1 deletion im2deep/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_ccs_shift(
"""Calculating CCS shift based on {} overlapping peptide-charge pairs
between PSMs and reference dataset""".format(both.shape[0])
)
LOGGER.debug(both.columns)

# How much CCS in calibration data is larger than reference CCS, so predictions
# need to be increased by this amount
return 0 if both.shape[0] == 0 else np.mean(both["ccs_observed"] - both["CCS"])
Expand Down
3 changes: 3 additions & 0 deletions im2deep/im2deep.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def predict_ccs(
model_name="tims",
calibrate_per_charge=True,
use_charge_state=2,
use_single_model=False,
n_jobs=None,
write_output=True,
):
Expand All @@ -31,6 +32,8 @@ def predict_ccs(
path_model = Path(__file__).parent / "models" / "TIMS"

path_model_list = list(path_model.glob("*.hdf5"))
if use_single_model:
path_model_list = [path_model_list[0]]

dlc = DeepLC(path_model=path_model_list, n_jobs=n_jobs, predict_ccs=True)
LOGGER.info("Predicting CCS values...")
Expand Down

0 comments on commit 25b2a72

Please sign in to comment.