Skip to content

Commit

Permalink
fixed BLAST reporting error due to not defined variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-fuchs committed Sep 6, 2024
1 parent 2dff08d commit 8a6b185
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions varvamp/scripts/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def write_scheme_to_files(path, amplicon_scheme, ambiguous_consensus, scheme_nam
for counter, amp in enumerate(amplicon_scheme[pool::len(pools)]):
# give a new amplicon name
amplicon_index = counter*len(pools) + pool
amp_name = f"{scheme_name}_{amplicon_index}"
# get left and right primers and their names
amp_length = amp["RIGHT"][2] - amp["LEFT"][1]
if "off_targets" in amp:
Expand All @@ -274,33 +275,33 @@ def write_scheme_to_files(path, amplicon_scheme, ambiguous_consensus, scheme_nam
(
amp["LEFT"][1],
amp["RIGHT"][2],
f"{scheme_name}_{amplicon_index}",
amp_name,
bed_score
)
)
primer_assignment_records.append(
(
# will need amplicon_index for sorting
amplicon_index,
(f"{scheme_name}_{amplicon_index}_LEFT", f"{scheme_name}_{amplicon_index}_RIGHT")
(f"{amp_name}_LEFT", f"{amp_name}_RIGHT")
)
)
# write primer tsv and primer bed
for direction, primer in [("+", amp["LEFT"]), ("-", amp["RIGHT"])]:
seq = ambiguous_consensus[primer[1]:primer[2]]
if direction == "-":
seq = primers.rev_complement(seq)
primer_name = f"{scheme_name}_{amplicon_index}_RIGHT"
primer_name = f"{amp_name}_RIGHT"
else:
primer_name = f"{scheme_name}_{amplicon_index}_LEFT"
primer_name = f"{amp_name}_LEFT"
# write primers to fasta pool file
print(f">{primer_name}\n{seq.upper()}", file=primer_fasta)
# calc primer parameters for all permutations
permutations = get_permutations(seq)
gc, temp = calc_mean_stats(permutations)
# write tsv file
print(
f"{scheme_name}_{amplicon_index}",
amp_name,
amp_length,
primer_name,
primer[-1],
Expand Down

0 comments on commit 8a6b185

Please sign in to comment.