Skip to content

Commit bfe8d7e

Browse files
committed
refactor: pythonic approach to processing
1 parent 9f97001 commit bfe8d7e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

main/como/proteomics_gen.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ def abundance_to_bool_group(
6464
# Logical Calculation
6565
abundance_matrix_nozero = abundance_matrix.replace(0, np.nan)
6666
thresholds = abundance_matrix_nozero.quantile(quantile, axis=0)
67-
testbool = pd.DataFrame(0, columns=list(abundance_matrix), index=abundance_matrix.index)
67+
testbool = pd.DataFrame(0, columns=abundance_matrix.columns, index=abundance_matrix.index)
6868

69-
for col in list(abundance_matrix):
69+
for col in abundance_matrix.columns:
7070
testbool.loc[abundance_matrix[col] > thresholds[col], [col]] = 1
7171

72-
abundance_matrix["pos"] = (abundance_matrix > 0).sum(axis=1) / abundance_matrix.count(axis=1)
7372
abundance_matrix["expressed"] = 0
7473
abundance_matrix["high"] = 0
74+
abundance_matrix["pos"] = abundance_matrix[abundance_matrix > 0].sum(axis=1) / abundance_matrix.count(axis=1)
7575
abundance_matrix.loc[(abundance_matrix["pos"] >= replicate_ratio), ["expressed"]] = 1
7676
abundance_matrix.loc[(abundance_matrix["pos"] >= high_confidence_replicate_ratio), ["high"]] = 1
7777

0 commit comments

Comments
 (0)