Skip to content

Commit

Permalink
Merge pull request #274 from ibludau/na_bugfix
Browse files Browse the repository at this point in the history
Fix normalization from 'per protein' to 'per sample'.
  • Loading branch information
boopthesnoot authored May 17, 2024
2 parents d503c25 + 1bdfbde commit 18ff81b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions alphastats/DataSet_Preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,20 @@ def _normalization(self, method: str):

if method == "zscore":
scaler = sklearn.preprocessing.StandardScaler()
normalized_array = scaler.fit_transform(self.mat.values)
normalized_array = scaler.fit_transform(self.mat.values.transpose()).transpose()

elif method == "quantile":
qt = sklearn.preprocessing.QuantileTransformer(random_state=0)
normalized_array = qt.fit_transform(self.mat.values)
normalized_array = qt.fit_transform(self.mat.values.transpose()).transpose()

elif method == "linear":
normalized_array = self._linear_normalization(self.mat)

elif method == "vst":
minmax = sklearn.preprocessing.MinMaxScaler()
scaler = sklearn.preprocessing.PowerTransformer()
minmaxed_array = minmax.fit_transform(self.mat.values)
normalized_array = scaler.fit_transform(minmaxed_array)
minmaxed_array = minmax.fit_transform(self.mat.values.transpose())
normalized_array = scaler.fit_transform(minmaxed_array).transpose()

else:
raise ValueError(
Expand Down

0 comments on commit 18ff81b

Please sign in to comment.