Skip to content

Commit

Permalink
fix SpectronautLoader.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mschwoer committed Oct 28, 2024
1 parent 6f8fc80 commit 84718ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions alphastats/gui/utils/ui_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ def init_session_state() -> None:
class StateKeys:
## 02_Data Import
# on 1st run
ORGANISM = "organism"
ORGANISM = "organism" # TODO this is essentially a constant
USER_SESSION_ID = "user_session_id"
LOADER = "loader"
# on sample run (function load_sample_data), removed on new session click
DATASET = "dataset" # functions upload_metadatafile

Expand Down
6 changes: 4 additions & 2 deletions alphastats/loader/SpectronautLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _reshape_long_to_wide(self):
other proteomics softwares use a wide format (column for each sample)
reshape to a wider format
"""
self.rawinput["sample"] = (
self.rawinput["tmp_sample"] = (
self.rawinput[self.sample_column]
+ SPECTRONAUT_COLUMN_DELIM
+ self.intensity_column
Expand All @@ -98,9 +98,11 @@ def _reshape_long_to_wide(self):
indexing_columns.append(self.gene_names_column)

df = self.rawinput.pivot(
columns="sample", index=indexing_columns, values=self.intensity_column
columns="tmp_sample", index=indexing_columns, values=self.intensity_column
)
df.reset_index(inplace=True)
# get rid of tmp_sample again, which can cause troubles when working with indices downstream
df.rename_axis(columns=None, inplace=True)

return df

Expand Down

0 comments on commit 84718ca

Please sign in to comment.