diff --git a/crisprbact/predict.py b/crisprbact/predict.py index aee0aaa6596ba563b37bb49f98b263be7cd12c5d..bb5c3975da15f2fa6d80ff0606d2c8b30ac92e5b 100644 --- a/crisprbact/predict.py +++ b/crisprbact/predict.py @@ -103,22 +103,23 @@ def on_target_predict(seq, genome=None, seed_sizes=[8, 9, 10, 11, 12]): "off_target_pampos": off_t[2], "off_target_strand": off_t[3], "off_target_recid": off_t[4], + "off_target_good_orientation": None, } - # Filter the off targets if the strand - # is not the opposite of the feature - off_t[5] = list( - filter( - lambda feat: get_strand_value( - off_target_dict["off_target_strand"] - ) - != get_strand_value(feat.location.strand), - off_t[5], - ) - ) # Loop through features associated to an off-target position if len(off_t[5]) > 0: # Loop for each feature for feat in off_t[5]: + if get_strand_value( + off_target_dict["off_target_strand"] + ) != get_strand_value(feat.location.strand): + off_target_dict[ + "off_target_good_orientation" + ] = True + else: + off_target_dict[ + "off_target_good_orientation" + ] = False + feature_dict = { "off_target_feat_strand": feat.location.strand, "off_target_feat_start": feat.location.start, @@ -133,6 +134,8 @@ def on_target_predict(seq, genome=None, seed_sizes=[8, 9, 10, 11, 12]): off_targets_list.append( {**feature_dict, **off_target_dict} ) + # elif not has_feature: + # off_targets_list.append(off_target_dict) else: off_targets_list.append(off_target_dict) off_targets_per_seed.append(