Skip to content

Commit

Permalink
remove reordering of columns to troubleshoot dataset without editing …
Browse files Browse the repository at this point in the history
…rate
  • Loading branch information
jykr committed Aug 14, 2024
1 parent cd294b6 commit 86572bc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
13 changes: 7 additions & 6 deletions bean/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ def main(args, return_data=False):
# Build variant dataframe
adj_negctrl_idx = None
if args.library_design == "variant":
if "edit_rate" not in ndata.screen.guides.columns:
ndata.screen.get_edit_from_allele()
ndata.screen.get_edit_mat_from_uns(rel_pos_is_reporter=True)
ndata.screen.get_guide_edit_rate(
unsorted_condition_label=args.control_condition
)
if not args.uniform_edit:
if "edit_rate" not in ndata.screen.guides.columns:
ndata.screen.get_edit_from_allele()
ndata.screen.get_edit_mat_from_uns(rel_pos_is_reporter=True)
ndata.screen.get_guide_edit_rate(
unsorted_condition_label=args.control_condition
)
target_info_df = _get_guide_target_info(
ndata.screen, args, cols_include=[args.negctrl_col]
)
Expand Down
4 changes: 0 additions & 4 deletions bean/model/readwrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ def write_result_table(
a_fitted = param_hist_dict["alpha_pi"].detach().cpu().numpy()
pi = a_fitted[..., 1:].sum(axis=1) / a_fitted.sum(axis=1)
# guide_info_df["edit_rate_fitted"] = pi
guide_info_df = guide_info_df[
["edit_rate"]
+ [col for col in guide_info_df.columns if col != "Mid" and col != "edit_rate"]
]
if guide_acc is not None:
guide_info_df.insert(1, "accessibility", guide_acc)
scaled_pi = _scale_pi(
Expand Down
5 changes: 4 additions & 1 deletion bean/model/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ def _get_guide_info(bdata, args, guide_lfc_pseudocount: int = 5):
[bdata.guides[["edit_rate", "edit_rate_norm"]], guide_lfc], axis=1
)
else:
guide_info = pd.concat([bdata.guides[["edit_rate"]], guide_lfc], axis=1)
if "edit_rate" in bdata.guides.columns.tolist():
guide_info = pd.concat([bdata.guides[["edit_rate"]], guide_lfc], axis=1)
else:
guide_info = guide_lfc
return guide_info


Expand Down

0 comments on commit 86572bc

Please sign in to comment.