diff --git a/README.md b/README.md
index adcc6ab..9fc7106 100755
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@
## Overview
`bean` supports end-to-end analysis of pooled sorting screens, with or without reporter.
-
+
`bean` subcommands include the following:
1. [`count`](https://pinellolab.github.io/crispr-bean/count.html), [`count-samples`](https://pinellolab.github.io/crispr-bean/count_samples.html): Base-editing-aware **mapping** of guide, optionally with reporter from `.fastq` files.
@@ -24,7 +24,7 @@
* Screen data is saved as *ReporterScreen* object in the pipeline.
BEAN stores mapped gRNA and allele counts in `ReporterScreen` object which is compatible with [AnnData](https://anndata.readthedocs.io/en/latest/index.html). See [Data Structure](#data-structure) section for more information.
## Installation
-First install [PyT}orch](https://pytorch.org/get-started/).
+First install [PyTorch](https://pytorch.org/get-started/).
Then download from PyPI:
```
pip install crispr-bean[model]
diff --git a/bean/cli/run.py b/bean/cli/run.py
index 81e4bda..55d8a59 100755
--- a/bean/cli/run.py
+++ b/bean/cli/run.py
@@ -167,7 +167,7 @@ def main(args):
f"Using {len(negctrl_idx)} negative control elements to adjust phenotypic effect sizes..."
)
ndata_negctrl = ndata[negctrl_idx]
- param_history_dict["negctrl"], save_dict["negctrl"] = deepcopy(
+ param_history_dict_negctrl, save_dict["negctrl"] = deepcopy(
run_inference(
negctrl_model, negctrl_guide, ndata_negctrl, num_steps=args.n_iter
)
@@ -188,6 +188,7 @@ def main(args):
write_result_table(
target_info_df,
param_history_dict,
+ negctrl_params=param_history_dict_negctrl,
model_label=model_label,
prefix=f"{prefix}/",
suffix=args.result_suffix,
diff --git a/bean/model/readwrite.py b/bean/model/readwrite.py
index 76287f3..b566790 100755
--- a/bean/model/readwrite.py
+++ b/bean/model/readwrite.py
@@ -52,6 +52,7 @@ def write_result_table(
model_label: str,
prefix: str = "",
suffix: str = "",
+ negctrl_params=None,
write_fitted_eff: bool = True,
adjust_confidence_by_negative_control: bool = True,
adjust_confidence_negatives: np.ndarray = None,
@@ -100,17 +101,11 @@ def write_result_table(
)
fit_df = pd.DataFrame(param_dict)
- if "negctrl" in param_hist_dict.keys():
+ if negctrl_params is not None:
print("Normalizing with common negative control distribution")
- mu0 = param_hist_dict["negctrl"]["params"]["mu_loc"].detach().cpu().numpy()
+ mu0 = negctrl_params["params"]["mu_loc"].detach().cpu().numpy()
if sd_is_fitted:
- sd0 = (
- param_hist_dict["negctrl"]["params"]["sd_loc"]
- .detach()
- .exp()
- .cpu()
- .numpy()
- )
+ sd0 = negctrl_params["params"]["sd_loc"].detach().exp().cpu().numpy()
else:
sd0 = 1.0
print(f"Fitted mu0={mu0}" + (f", sd0={sd0}." if sd_is_fitted else ""))