Skip to content

Commit

Permalink
Merge pull request #5 from hgb-bin-proteomics/develop
Browse files Browse the repository at this point in the history
fix for #4
  • Loading branch information
michabirklbauer authored Jun 19, 2024
2 parents fd6e075 + f9b7301 commit 4277951
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions msannika_fdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# [email protected]

# version tracking
__version = "1.1.0"
__date = "2024-01-24"
__version = "1.1.5"
__date = "2024-06-19"

# REQUIREMENTS
# pip install numpy
Expand Down Expand Up @@ -60,6 +60,14 @@ def get_nr_proteins(row: pd.Series) -> int:
proteins_str = str(row["Accession A"]).strip(";") + ";" + str(row["Accession B"]).strip(";")
return len(proteins_str.split(";"))

@staticmethod
def get_xl_position_in_protein(row: pd.Series, alpha: bool) -> int:
if alpha:
positions = [float(pos) + float(row["Crosslinker Position A"]) for pos in str(row["A in protein"]).split(";")]
else:
positions = [float(pos) + float(row["Crosslinker Position B"]) for pos in str(row["B in protein"]).split(";")]
return ";".join([str(int(pos)) for pos in positions if not pd.isna(pos)])

@staticmethod
def get_best_csm_score(csms: List[pd.Series]) -> float:

Expand Down Expand Up @@ -124,8 +132,8 @@ def group(data: pd.DataFrame) -> pd.DataFrame:
"Protein Descriptions A": crosslinks[crosslink][0]["Accession A"],
"Protein Descriptions B": crosslinks[crosslink][0]["Accession B"],
"Best CSM Score": MSAnnika_CSM_Grouper.get_best_csm_score(crosslinks[crosslink]),
"In protein A": crosslinks[crosslink][0]["A in protein"],
"In protein B": crosslinks[crosslink][0]["B in protein"],
"In protein A": MSAnnika_CSM_Grouper.get_xl_position_in_protein(crosslinks[crosslink][0], True),
"In protein B": MSAnnika_CSM_Grouper.get_xl_position_in_protein(crosslinks[crosslink][0], False),
"Decoy": MSAnnika_CSM_Grouper.get_decoy_flag(crosslinks[crosslink][0]),
"Modifications A": crosslinks[crosslink][0]["Modifications A"],
"Modifications B": crosslinks[crosslink][0]["Modifications B"],
Expand Down

0 comments on commit 4277951

Please sign in to comment.