Skip to content

Commit

Permalink
Fix bug when writing target stats without predict activity model
Browse files Browse the repository at this point in the history
When running in complete-targets mode without an activity model set
(e.g., for the minimize-guides objective), target_search.py would try to
compute expected activities for each guide. Doing so would raise an
error. This commit fixes that by using nan for the expected activity of
each guide in this case, as is the case for other activity prediction
stats.
  • Loading branch information
haydenm committed Sep 7, 2020
1 parent d4e4bed commit 518aafa
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions adapt/target_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,18 @@ def find_and_write_targets(self, out_fn, best_n=10):
# Find expected activity for each guide
window_start = p1.start + p1.primer_length
window_end = p2.start
expected_activities_per_guide = \
[self.gs.guide_activities_expected_value(
window_start, window_end, gd_seq)
for gd_seq in guides_seqs_sorted]
if self.gs.predictor is not None:
expected_activities_per_guide = \
[self.gs.guide_activities_expected_value(
window_start, window_end, gd_seq)
for gd_seq in guides_seqs_sorted]
else:
# There is no predictor to predict activities
# This should only be the case if self.obj_type is 'min',
# and may not necessarily be the case if self.obj_type is
# 'min'
expected_activities_per_guide = \
[math.nan for gd_seq in guides_seqs_sorted]
expected_activities_per_guide_str = ' '.join(
str(a) for a in expected_activities_per_guide)

Expand Down

0 comments on commit 518aafa

Please sign in to comment.