Skip to content

Commit

Permalink
Mokapot: Also consider run for merging peptide level info
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfG committed Apr 17, 2024
1 parent bc9532c commit bc51050
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ms2rescore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""MS²Rescore: Sensitive PSM rescoring with predicted MS² peak intensities and RTs."""

__version__ = "3.1.0-dev3"
__version__ = "3.1.0-dev4"

from warnings import filterwarnings

Expand Down
18 changes: 10 additions & 8 deletions ms2rescore/rescoring_engines/mokapot.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,19 @@ def rescore(
psm_list["pep"] = q[:, 2]

# Repeat for peptide-level scores
peptide_info = pd.concat(
[
confidence_results.confidence_estimates["peptides"].set_index(["peptide"])[keys],
confidence_results.decoy_confidence_estimates["peptides"].set_index(["peptide"])[keys],
],
axis=0,
).to_dict(orient="index")
peptides_targets = confidence_results.confidence_estimates["peptides"].set_index(
["peptide", "run"]
)[keys]
peptides_decoys = confidence_results.decoy_confidence_estimates["peptides"].set_index(
["peptide", "run"]
)[keys]
peptide_info = pd.concat([peptides_targets, peptides_decoys], axis=0).to_dict(orient="index")

peptidoform_without_charge = re.compile(r"(/\d+$)")
for psm in psm_list:
peptide_scores = peptide_info[peptidoform_without_charge.sub("", str(psm.peptidoform), 1)]
peptide_scores = peptide_info[
(peptidoform_without_charge.sub("", str(psm.peptidoform), 1), psm.run)
]
psm.metadata.update(
{
"peptide_score": peptide_scores["mokapot score"],
Expand Down

0 comments on commit bc51050

Please sign in to comment.