Skip to content

Commit

Permalink
Merge pull request #203 from compomics/timstof_models
Browse files Browse the repository at this point in the history
Timstof models
  • Loading branch information
RalfG authored Sep 12, 2023
2 parents a76619a + 4d48c1c commit a312411
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
15 changes: 15 additions & 0 deletions ms2pip/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,20 @@
"model_20220104_CID_TMT_Y.xgboost": "299539179ca55d4ac82e9aed6a4e0bd134a9a41e",
},
},
"timsTOF": {
"id": 12,
"ion_types": ["B", "Y"],
"peaks_version": "general",
"features_version": "normal",
"xgboost_model_files": {
"b": "model_20230912_timsTOF_B.xgboost",
"y": "model_20230912_timsTOF_Y.xgboost",
},
"model_hash": {
"model_20230912_timsTOF_B.xgboost": "6beb557052455310d8c66311c86866dda8291f4b",
"model_20230912_timsTOF_Y.xgboost": "8edd87e0fba5f338d0a0881b5afbcf2f48ec5268",
},
},
}

MODELS["HCD"] = MODELS["HCD2021"]
15 changes: 12 additions & 3 deletions ms2pip/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,18 @@ def _assemble_training_data(results: List[ProcessingResult], model: str) -> pd.D
]
)
for ion_type in ion_types:
training_data[f"target_{ion_type}"] = np.concatenate(
[r.observed_intensity[ion_type] for r in results if r.feature_vectors is not None]
)
if ion_type in ["a", "b", "b2", "c"]:
training_data[f"target_{ion_type}"] = np.concatenate(
[r.observed_intensity[ion_type] for r in results if r.feature_vectors is not None]
)
elif ion_type in ["x", "y", "y2", "z"]:
training_data[f"target_{ion_type}"] = np.concatenate(
[
r.observed_intensity[ion_type][::-1]
for r in results
if r.feature_vectors is not None
]
)

# Reorder columns
training_data = training_data[
Expand Down

0 comments on commit a312411

Please sign in to comment.