From aba45b044b575bea7acb03d5e382375054860ff1 Mon Sep 17 00:00:00 2001 From: Jonas Fuchs <78491186+jonas-fuchs@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:57:33 +0100 Subject: [PATCH] Qpcr blast fix (#34) * changed primer type qpcr * further harmonized primer naming in the script --- varvamp/__init__.py | 2 +- varvamp/scripts/blast.py | 4 ++-- varvamp/scripts/primers.py | 4 ++-- varvamp/scripts/qpcr.py | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/varvamp/__init__.py b/varvamp/__init__.py index 37889ed..b3c0265 100644 --- a/varvamp/__init__.py +++ b/varvamp/__init__.py @@ -1,3 +1,3 @@ """Tool to design amplicons for highly variable virusgenomes""" _program = "varvamp" -__version__ = "1.1" +__version__ = "1.1.1" diff --git a/varvamp/scripts/blast.py b/varvamp/scripts/blast.py index f1dd188..5b2b109 100644 --- a/varvamp/scripts/blast.py +++ b/varvamp/scripts/blast.py @@ -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 @@ -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)] diff --git a/varvamp/scripts/primers.py b/varvamp/scripts/primers.py index b2d5bba..c541a99 100644 --- a/varvamp/scripts/primers.py +++ b/varvamp/scripts/primers.py @@ -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 diff --git a/varvamp/scripts/qpcr.py b/varvamp/scripts/qpcr.py index 14ec0de..424136c 100644 --- a/varvamp/scripts/qpcr.py +++ b/varvamp/scripts/qpcr.py @@ -82,7 +82,7 @@ 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, @@ -90,7 +90,7 @@ def get_qpcr_probes(kmers, ambiguous_consensus, alignment_cleaned): 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, @@ -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