Skip to content

Commit

Permalink
Qpcr blast fix (#34)
Browse files Browse the repository at this point in the history
* changed primer type qpcr

* further harmonized primer naming in the script
  • Loading branch information
jonas-fuchs committed Jan 26, 2024
1 parent 547246b commit aba45b0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion varvamp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Tool to design amplicons for highly variable virusgenomes"""
_program = "varvamp"
__version__ = "1.1"
__version__ = "1.1.1"
4 changes: 2 additions & 2 deletions varvamp/scripts/blast.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def create_BLAST_query_qpcr(qpcr_scheme_candidates, data_dir):
query_path = os.path.join(data_dir, "BLAST_query.fasta")
with open(query_path, "w") as query:
for amp in qpcr_scheme_candidates:
for primer_type in ["probe", "left", "right"]:
for primer_type in ["PROBE", "LEFT", "RIGHT"]:
name = f"{primer_type}_{qpcr_scheme_candidates[amp][primer_type][1]}_{qpcr_scheme_candidates[amp][primer_type][2]}"
if name in already_written:
continue
Expand Down Expand Up @@ -174,7 +174,7 @@ def predict_non_specific_amplicons_worker(amp, blast_df, max_length, mode):
primers = [data[2], data[3]]
elif mode == "qpcr":
primers = []
for primer_type in ["probe", "left", "right"]:
for primer_type in ["PROBE", "LEFT", "RIGHT"]:
primers.append(f"{primer_type}_{data[primer_type][1]}_{data[primer_type][2]}")
# subset df for primers
df_amp_primers = blast_df[blast_df["query"].isin(primers)]
Expand Down
4 changes: 2 additions & 2 deletions varvamp/scripts/primers.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ def create_primer_dictionary(primer_candidates, direction):

for primer in primer_candidates:
if direction == "+":
direction_name = "FW"
direction_name = "LEFT"
elif direction == "-":
direction_name = "RV"
direction_name = "RIGHT"
primer_name = f"{direction_name}_{primer_idx}"
primer_dict[primer_name] = primer
primer_idx += 1
Expand Down
8 changes: 4 additions & 4 deletions varvamp/scripts/qpcr.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ def get_qpcr_probes(kmers, ambiguous_consensus, alignment_cleaned):
# create probe dictionary
if "+" in direction:
if filter_probe_direction_dependent(kmer[0]):
probe_name = f"PROBE_{probe_idx}_FW"
probe_name = f"PROBE_{probe_idx}_LEFT"
three_prime_penalty = primers.calc_3_prime_penalty("+", per_base_mismatches)
probe_candidates[probe_name] = [kmer[0], kmer[1], kmer[2],
base_penalty + permutation_penalty + three_prime_penalty,
per_base_mismatches, direction]
probe_idx += 1
if "-" in direction:
if filter_probe_direction_dependent(primers.rev_complement(kmer[0])):
probe_name = f"PROBE_{probe_idx}_RV"
probe_name = f"PROBE_{probe_idx}_RIGHT"
three_prime_penalty = primers.calc_3_prime_penalty("-", per_base_mismatches)
probe_candidates[probe_name] = [primers.rev_complement(kmer[0]), kmer[1], kmer[2],
base_penalty + permutation_penalty + three_prime_penalty,
Expand Down Expand Up @@ -208,13 +208,13 @@ def assess_amplicons(left_subset, right_subset, qpcr_probes, probe, majority_con
if not hardfilter_amplicon(majority_consensus, left_primer, right_primer):
continue
# ... the probe is close enough to the primer on the same strand
if "FW" in probe:
if "LEFT" in probe:
if not qpcr_probes[probe][1] in range(
left_primer[2] + config.QPROBE_DISTANCE[0],
left_primer[2] + config.QPROBE_DISTANCE[1] + 1
):
continue
elif "RV" in probe:
elif "RIGHT" in probe:
if not right_primer[1] in range(
qpcr_probes[probe][2] + config.QPROBE_DISTANCE[0],
qpcr_probes[probe][2] + config.QPROBE_DISTANCE[1] + 1
Expand Down

0 comments on commit aba45b0

Please sign in to comment.