Skip to content

Commit

Permalink
Ensure editing rate is calculated by finding bulk samples from the us…
Browse files Browse the repository at this point in the history
…er-specified condition column
  • Loading branch information
jykr committed Apr 11, 2024
1 parent 7e36d63 commit 1114679
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bean/framework/ReporterScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ def get_guide_edit_rate(
return_result=False,
count_layer="X_bcmatch",
edit_layer="edits",
condition_col = "condition",
unsorted_condition_label=None,
):
"""
Expand All @@ -506,10 +507,12 @@ def get_guide_edit_rate(
)
if unsorted_condition_label is not None:
bulk_idx = np.where(
self.samples.index.astype(str).map(
self.samples[condition_col].astype(str).map(
lambda s: unsorted_condition_label in s
)
)[0]
if len(bulk_idx) == 0:
raise ValueError(f"{unsorted_condition_label} is not found in ReporterScreen.samples['{condition_col}]. Check your input.")
else:
bulk_idx = np.arange(0, len(self.samples)).astype(int)

Expand Down
1 change: 1 addition & 0 deletions bean/notebooks/sample_quality_report.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
" bdata.get_guide_edit_rate(\n",
" editable_base_start=edit_quantification_start_pos,\n",
" editable_base_end=edit_quantification_end_pos,\n",
" condition_col=condition_label,\n",
" unsorted_condition_label=ctrl_cond,\n",
" )\n",
" be.qc.plot_guide_edit_rates(bdata)"
Expand Down

0 comments on commit 1114679

Please sign in to comment.