Skip to content

Commit

Permalink
add sgRNA stats as output
Browse files Browse the repository at this point in the history
  • Loading branch information
jykr committed Jun 25, 2024
1 parent ae22bb7 commit 5ff5050
Show file tree
Hide file tree
Showing 6 changed files with 10,948 additions and 10,940 deletions.
7 changes: 6 additions & 1 deletion bean/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def main(args, return_data=False):
use_bcmatch=(not args.ignore_bcmatch),
)
guide_index = ndata.screen.guides.index.copy()
assert len(guide_index) == bdata.n_obs, (len(guide_index), bdata.n_obs)
if return_data:
return ndata
# Build variant dataframe
Expand Down Expand Up @@ -191,7 +192,11 @@ def main(args, return_data=False):
if args.library_design == "tiling":
# add variant into to guide_info_tbl
guide_info_df = pd.concat(
[guide_info_df, _get_guide_to_variant_df(target_info_df)], axis=1
[
guide_info_df,
_get_guide_to_variant_df(target_info_df).reindex(guide_info_df.index),
],
axis=1,
)

# Add user-defined prior.
Expand Down
5 changes: 4 additions & 1 deletion bean/model/readwrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ def write_result_table(
else:
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.insert(0, "edit_rate", pi)
guide_info_df["edit_rate"] = pi
guide_info_df = guide_info_df[
["edit_rate"] + [col for col in guide_info_df.columns if col != "Mid"]
]
if guide_acc is not None:
guide_info_df.insert(1, "accessibility", guide_acc)
scaled_pi = _scale_pi(
Expand Down
2 changes: 1 addition & 1 deletion docs/example_run_output/tiling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ These are the example output of [`bean run`](https://pinellolab.github.io/crispr
- `edit_rate`: Effective editing rates
- `accessibility`: (Only if you have used `--scale-by-acc`) Accessibility signal that is used for scaling of the editing rate.
- `scaled_edit_rate`: (Only if you have used `--scale-by-acc`) Endogenous editing rate used for modeling, estimated by scaling reporter editing rate by accessibility signal
- `LFC_[condition]`: Raw LFC with pseudocount N.
- `[cond1]_[cond2].median_lfc`: Raw LFC with pseudocount fed in with `--guide-lfc-pseudocount` argument (default 5).
- `variants`: Variants generated by this gRNA
- `variant_edit_rates`: Editing rate of this gRNA for each variant it creates.
Loading

0 comments on commit 5ff5050

Please sign in to comment.