Skip to content

Commit

Permalink
save reporter structure during counting
Browse files Browse the repository at this point in the history
  • Loading branch information
jykr committed May 7, 2024
1 parent 204fb66 commit c9c1194
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bean/annotate/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,13 @@ def parse_args(parser=None):
parser.add_argument(
"--reporter-length",
type=int,
default=32,
default=None,
help="Length of reporter sequence in the construct.",
)
parser.add_argument(
"--reporter-right-flank-length",
type=int,
default=6,
default=None,
help="Length of the right-flanking nucleotides of protospacer in the reporter.",
)
parser.add_argument(
Expand Down
12 changes: 12 additions & 0 deletions bean/cli/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ def main(args):
args = check_args(args)
if not args.load_tmp:
bdata = be.read_h5ad(args.bdata_path)
if args.reporter_length is None:
if "reporter_length" in bdata.uns:
args.reporter_length = bdata.uns["reporter_length"]
else:
args.reporter_length = 32
if args.reporter_right_flank_length is None:
if "reporter_right_flank_length" in bdata.uns:
args.reporter_right_flank_length = bdata.uns[
"reporter_right_flank_length"
]
else:
args.reporter_right_flank_length = 6
allele_df_keys = ["allele_counts"]
info(
f"Starting from .uns['allele_counts'] with {len(bdata.uns['allele_counts'])} alleles."
Expand Down
2 changes: 2 additions & 0 deletions bean/mapping/GuideEditCounter.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def __init__(self, **kwargs):
tiling=kwargs["tiling"],
)
self.screen.guides["guide_len"] = self.screen.guides.sequence.map(len)
self.screen.uns["reporter_length"] = kwargs["reporter_length"]
self.screen.uns["reporter_right_flank_length"] = kwargs["reporter_length"] - kwargs["gstart_reporter"] - self.screen.guides["guide_len"].max()
self.count_guide_edits = kwargs["count_guide_edits"]
if self.count_guide_edits:
self.screen.uns["guide_edit_counts"] = {}
Expand Down
4 changes: 2 additions & 2 deletions bean/qc/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ def parse_args(parser=None):
parser.add_argument(
"--reporter-length",
type=int,
default=32,
default=None,
help="Length of reporter sequence in the construct.",
)
parser.add_argument(
"--reporter-right-flank-length",
type=int,
default=6,
default=None,
help="Length of the right-flanking nucleotides of protospacer in the reporter.",
)
return parser
10 changes: 10 additions & 0 deletions bean/qc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ def check_args(args):
args.base_edit_data = False
else:
args.base_edit_data = True
if args.reporter_length is None:
if "reporter_length" in bdata.uns:
args.reporter_length = bdata.uns["reporter_length"]
else:
args.reporter_length = 32
if args.reporter_right_flank_length is None:
if "reporter_right_flank_length" in bdata.uns:
args.reporter_right_flank_length = bdata.uns["reporter_right_flank_length"]
else:
args.reporter_right_flank_length = 6
return args


Expand Down

0 comments on commit c9c1194

Please sign in to comment.