Skip to content

Commit

Permalink
FIX: pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Lebedev committed May 22, 2024
1 parent 387867e commit 4eab905
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions alphastats/DataSet_Preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,20 @@ def _imputation(self, method: str):
)
self.preprocessing_info.update({"Imputation": method})

def _linear_normalization(self, array):
def _linear_normalization(self, dataframe: pd.DataFrame):
"""Normalize data using l2 norm without breaking when encoutering nones
l2 = sqrt(sum(x**2))
Args:
array (pd.Series): array to normalize (1D array)
dataframe (pd.DataFrame): dataframe to normalize
Returns:
np.array: normalized array
np.array: normalized np.array
"""
square_sum_per_row = array.pow(2).sum(axis=1, skipna=True)
square_sum_per_row = dataframe.pow(2).sum(axis=1, skipna=True)

l2_norms = np.sqrt(square_sum_per_row)
normalized_vals = array.div(l2_norms.replace(0, 1), axis=0)
normalized_vals = dataframe.div(l2_norms.replace(0, 1), axis=0)
return normalized_vals.values

@ignore_warning(UserWarning)
Expand Down
2 changes: 1 addition & 1 deletion alphastats/gui/pages/02_Import Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
st.session_state["gene_to_prot_id"] = {}

if "organism" not in st.session_state:
st.session_state["organism"] = 9606
st.session_state["organism"] = 9606 # human


def load_options():
Expand Down

0 comments on commit 4eab905

Please sign in to comment.