Skip to content

Commit 50a0906

Browse files
committed
print --adj-prop info in CLI
1 parent 072da67 commit 50a0906

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

bin/scdrs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,21 @@ def compute_score(
167167
)
168168
print("First 3 cells: %s" % (str(list(adata.obs_names[:3]))))
169169
print("First 5 genes: %s" % (str(list(adata.var_names[:5]))))
170+
if ADJ_PROP is not None:
171+
err_msg = "'adj_prop'=%s not in 'adata.obs.columns'" % ADJ_PROP
172+
assert ADJ_PROP in adata.obs, err_msg
173+
temp_df = adata.obs[[ADJ_PROP]].groupby(ADJ_PROP).agg({ADJ_PROP: len})
174+
temp_df.columns = ["n"]
175+
temp_df.sort_values(by="n", ascending=False, inplace=True)
176+
print("--adj-prop: %d categories" % temp_df.shape[0])
177+
msg = ", ".join(
178+
["%s (%d)" % (x, temp_df.loc[x, "n"]) for x in temp_df.index[:3]]
179+
)
180+
print("Top 3: %s" % msg)
181+
msg = ", ".join(
182+
["%s (%d)" % (x, temp_df.loc[x, "n"]) for x in temp_df.index[-3:]]
183+
)
184+
print("Bottom 3: %s" % msg)
170185

171186
# Load .cov file
172187
if COV_FILE is not None:

0 commit comments

Comments
 (0)