Skip to content
Snippets Groups Projects
Commit b9ee273f authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Fix bug no off-target feature. Fix #6

parent aeac9e45
No related branches found
No related tags found
No related merge requests found
Pipeline #23472 passed with stage
in 45 seconds
# 0.3.2
- Fix bugg when no off-target feature
- Handle genome in fasta file
# 0.3.1
- Fix bug when no feature
- Add off-target strand to output
......
......@@ -72,31 +72,38 @@ def on_target_predict(seq, genome=None, seed_size=7):
target["guide"], seed_size, records, genome_features
)
off_targets_list = []
off_targets = off_target_df.loc[
0:, ["start", "end", "pampos", "strand", "features"]
]
for index, off_t in enumerate(off_targets.values.tolist()):
off_target_dict = {
"off_target_start": off_t[0],
"off_target_end": off_t[1],
"pampos": off_t[2],
"strand": off_t[3],
}
if len(off_t[4]) > 0:
for feat in off_t[4]:
feature_dict = {
"feat_strand": feat.location.strand,
"feat_start": feat.location.start,
"feat_end": feat.location.end,
"feat_type": feat.type,
}
for k, feat in feat.qualifiers.items():
if k != "translation":
feature_dict[k] = " :: ".join(feat)
if not off_target_df.empty:
off_targets = off_target_df.loc[
0:, ["start", "end", "pampos", "strand", "recid", "features"]
]
for index, off_t in enumerate(off_targets.values.tolist()):
off_target_dict = {
"off_target_start": off_t[0],
"off_target_end": off_t[1],
"pampos": off_t[2],
"strand": off_t[3],
"recid": off_t[4],
}
if len(off_t[5]) > 0:
# Loop for each feature
for feat in off_t[5]:
feature_dict = {
"feat_strand": feat.location.strand,
"feat_start": feat.location.start,
"feat_end": feat.location.end,
"feat_type": feat.type,
}
for k, feat in feat.qualifiers.items():
if k != "translation":
feature_dict[k] = "::".join(feat)
off_targets_list.append(
{**feature_dict, **off_target_dict}
)
else:
off_targets_list.append(off_target_dict)
else:
off_targets_list.append({**feature_dict, **off_target_dict})
target.update({"off_targets": off_targets_list})
target.update({"off_targets": off_targets_list})
else:
target.update({"off_targets": off_targets_list})
else:
target.update({"off_targets": []})
return alltargets
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment