Skip to content
Open
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
12 changes: 10 additions & 2 deletions predict_protein/train_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,16 @@ def get_train_test(self,
:return: x_train, x_test, y_train, y_test
"""

y_df = self.df[[protein_to_do + '_proteomics']]
y_df = y_df.dropna(subset=[protein_to_do + '_proteomics'])
#y_df = self.df[[protein_to_do + '_proteomics']]
#AB 03.15

#y_df = y_df.dropna(subset=[protein_to_do + '_proteomics'])
#AB: use a REGEX
regex_pattern = protein_to_do + '_proteomics$'
y_df = self.df.filter(regex=regex_pattern)
# After filtering, the column names in y_df will be exactly those that matched the regex,
# so you can safely call dropna() on the entire DataFrame without specifying a subset.
y_df = y_df.dropna()

# skip proteins with fewer than 20 samples
# 2021-11-12 this should be filtered at the protein step (y_df) rather than the
Expand Down