Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/de duplication #87

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion spectrum_io/search_result/maxquant.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def read_result(self, tmt_labeled: str) -> pd.DataFrame:
"MASS", # = Calculated Precursor mass; TODO get column with experimental Precursor mass instead
"SCORE",
"REVERSE",
"PROTEINS",
],
sep="\t",
)
Expand All @@ -73,7 +74,13 @@ def read_result(self, tmt_labeled: str) -> pd.DataFrame:

df = MaxQuant.update_columns_for_prosit(df, tmt_labeled)
return filter_valid_prosit_sequences(df)
# a method for replacing missing proteins
@staticmethod
def sanity_check(PROTEINS: pd.Series) -> pd.Series:
return PROTEINS.apply(lambda x: 'missing_protein' if pd.isna(x) else x)



@staticmethod
def update_columns_for_prosit(df: pd.DataFrame, tmt_labeled: str) -> pd.DataFrame:
"""
Expand Down Expand Up @@ -117,7 +124,11 @@ def update_columns_for_prosit(df: pd.DataFrame, tmt_labeled: str) -> pd.DataFram
df["MODIFIED_SEQUENCE"] = maxquant_to_internal(df["MODIFIED_SEQUENCE"].to_numpy())
df["SEQUENCE"] = internal_without_mods(df["MODIFIED_SEQUENCE"])
df["PEPTIDE_LENGTH"] = df["SEQUENCE"].apply(lambda x: len(x))

# adding protein column in the end
df['PROTEINS'] = df.pop('PROTEINS')
# calling the static method to replace unkown proteins
df['PROTEINS'] = MaxQuant.sanity_check(df['PROTEINS'])

return df

def generate_internal_timstof_metadata(self):
Expand Down
3 changes: 2 additions & 1 deletion spectrum_io/search_result/sage.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def update_columns_for_prosit(df: pd.DataFrame, tmt_labeled: str) -> pd.DataFram
# converting proforma to unimode
print(df)
df["MODIFIED_SEQUENCE"] = sage_to_internal(df["MODIFIED_SEQUENCE"])

#adding protein column in the end
df['PROTEINS'] = df.pop('PROTEINS')
print(df.columns)
return df
Loading