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

Adapt to new alphabase #216

Merged
merged 6 commits into from
Feb 18, 2025
Merged
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
3 changes: 1 addition & 2 deletions peptdeep/psm_frag_reader/maxquant_frag_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ def __init__(
def fragment_intensity_df(self):
return self._fragment_intensity_df

def _load_file(self, filename):
df = MaxQuantReader._load_file(self, filename)
def _pre_process(self, df):
df = filter_phos(df, self._phos_prob)
df = df[
(df.Score >= self._score_thres) | ((df.Score >= 60) & (df.PhosProbs != ""))
Expand Down
36 changes: 20 additions & 16 deletions peptdeep/psm_frag_reader/psmlabel_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,22 @@ def __init__(
PSMReader_w_FragBase.__init__(
self, frag_types=frag_types, max_frag_charge=max_frag_charge, **kwargs
)
pFindReader.__init__(self)
pFindReader.__init__(
self,
column_mapping={
"sequence": "peptide",
"charge": "charge",
"rt": "RT",
"raw_name": "raw_name",
"query_id": "spec",
"scan_num": "scan_num",
},
)

psmlabel_columns = "b,b-NH3,b-H20,b-ModLoss,y,y-HN3,y-H20,y-ModLoss".split(",")
self.psmlabel_frag_columns = []
self.frag_df_columns = {}

psmlabel_columns = "b,b-NH3,b-H20,b-ModLoss,y,y-HN3,y-H20,y-ModLoss".split(",")
for _type in psmlabel_columns:
frag_idxes = [
i
Expand All @@ -44,18 +55,11 @@ def __init__(
self.psmlabel_frag_columns.append(_type)
self.frag_df_columns[_type] = np.array(frag_idxes, dtype=int)

def _init_column_mapping(self):
self.column_mapping = {
"sequence": "peptide",
"charge": "charge",
"rt": "RT",
"raw_name": "raw_name",
"query_id": "spec",
"scan_num": "scan_num",
}

def _load_file(self, filename):
psmlabel_df = pd.read_csv(filename, sep="\t")
df = pd.read_csv(filename, sep="\t")
return df

def _pre_process(self, psmlabel_df: pd.DataFrame):
psmlabel_df.fillna("", inplace=True)

if psmlabel_df["spec"].values[0].count(".") >= 4: # pfind
Expand All @@ -79,16 +83,16 @@ def _load_modifications(self, psmlabel_df: pd.DataFrame):
*psmlabel_df["modinfo"].apply(get_pFind_mods)
)

def _translate_decoy(self, df):
def _translate_decoy(self):
pass

def _translate_score(self, df):
def _translate_score(self):
pass

def _translate_modifications(self):
self._psm_df["mods"] = self._psm_df["mods"].apply(translate_pFind_mod)

def _post_process(self, psmlabel_df: pd.DataFrame):
def _post_process(self, psmlabel_df):
psmlabel_df["nAA"] = psmlabel_df.peptide.str.len()
self._psm_df["nAA"] = psmlabel_df.nAA
psmlabel_df = psmlabel_df[~self._psm_df["mods"].isna()].reset_index(drop=True)
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ lxml
pyteomics

streamlit>=1.23.0
alphabase>=1.1.0
alphabase>=1.5.0
alpharaw>=0.2.0
2 changes: 1 addition & 1 deletion requirements/requirements_loose.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ lxml
pyteomics

streamlit>=1.23.0
alphabase>=1.1.0
alphabase>=1.5.0
alpharaw>=0.2.0
Empty file modified tests/run_tests.sh
100644 → 100755
Empty file.
Loading