Skip to content

Commit

Permalink
Provided Primer fix, better sequencing stats
Browse files Browse the repository at this point in the history
  • Loading branch information
untergasser committed Aug 19, 2021
1 parent 424b17c commit 9660639
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 40 deletions.
37 changes: 25 additions & 12 deletions src/libprimer3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1279,18 +1279,18 @@ choose_primers(const p3_global_settings *pa,
scope, has not yet been initialized. */
if (dpal_arg_to_use == NULL)
dpal_arg_to_use = create_dpal_arg_holder();
if(thal_arg_to_use == NULL) {
thal_arg_to_use = create_thal_arg_holder(&pa->p_args);
} else {
destroy_thal_arg_holder(thal_arg_to_use);
thal_arg_to_use = create_thal_arg_holder(&pa->p_args);
}
if(thal_oligo_arg_to_use == NULL) {
thal_oligo_arg_to_use = create_thal_arg_holder(&pa->o_args);
} else {
destroy_thal_arg_holder(thal_oligo_arg_to_use);
thal_oligo_arg_to_use = create_thal_arg_holder(&pa->o_args);
}
if(thal_arg_to_use == NULL) {
thal_arg_to_use = create_thal_arg_holder(&pa->p_args);
} else {
destroy_thal_arg_holder(thal_arg_to_use);
thal_arg_to_use = create_thal_arg_holder(&pa->p_args);
}
if(thal_oligo_arg_to_use == NULL) {
thal_oligo_arg_to_use = create_thal_arg_holder(&pa->o_args);
} else {
destroy_thal_arg_holder(thal_oligo_arg_to_use);
thal_oligo_arg_to_use = create_thal_arg_holder(&pa->o_args);
}
if (pa->primer_task == pick_primer_list) {
make_complete_primer_lists(retval, pa, sa,
dpal_arg_to_use,thal_arg_to_use,thal_oligo_arg_to_use);
Expand Down Expand Up @@ -2411,6 +2411,7 @@ pick_sequencing_primer_list(p3retval *retval,
length = n - start;
}
/* Pick all good in the given range */
retval->fwd.expl.sequencing_location++;
pick_only_best_primer(start, length, &retval->fwd,
pa, sa, dpal_arg_to_use, thal_arg_to_use, retval);
}
Expand All @@ -2427,13 +2428,16 @@ pick_sequencing_primer_list(p3retval *retval,
length = n - start;
}
/* Pick all good in the given range */
retval->rev.expl.sequencing_location++;
pick_only_best_primer(start, length, &retval->rev,
pa, sa, dpal_arg_to_use, thal_arg_to_use, retval);
}
}

} /* End of Target Loop */

retval->fwd.expl.ok = retval->fwd.num_elem;
retval->rev.expl.ok = retval->rev.num_elem;
/* Print an error if not all primers will be printed */
if (retval->fwd.num_elem > pa->num_return
|| retval->rev.num_elem > pa->num_return) {
Expand Down Expand Up @@ -6055,6 +6059,7 @@ p3_oligo_explain_string(const oligo_stats *stat)
size_t bsize = 10000;
size_t r;

IF_SP_AND_CHECK("sequencing locations %d, ", stat->sequencing_location)
SP_AND_CHECK("considered %d", stat->considered)
IF_SP_AND_CHECK(", would not amplify any of the ORF %d", stat->no_orf)
IF_SP_AND_CHECK(", too many Ns %d", stat->ns)
Expand Down Expand Up @@ -7126,6 +7131,14 @@ _pr_data_control(const p3_global_settings *pa,
else if (!strstr_nocase(sa->trimmed_seq, s1))
pr_append_new_chunk(nonfatal_err,
"Specified right primer not in Included Region");
else if (sa->left_input) {
if (strcmp(sa->left_input, s1) == 0)
pr_append_new_chunk(nonfatal_err,
"Specified left and right primer are reverse complementary");
if (strcmp(sa->left_input, sa->right_input) == 0)
pr_append_new_chunk(nonfatal_err,
"Specified left and right primer are identical");
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/libprimer3.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ const int *
interval_array_t2_get_pair(const interval_array_t2 *array, int i);

typedef struct oligo_stats {
int sequencing_location; /* Number of locations for sequencing primers */
int considered; /* Total number of tested oligos of given type */
int ns; /* Number of oligos rejected because of Ns */
int target; /* Overlapping targets. */
Expand Down
21 changes: 16 additions & 5 deletions src/release_notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,25 @@ based on the 3' portion of the oligo that binds to the template.

Minor fixes:
1. Handling of N in PRIMER_MAX_POLY_X was fixed. Now 'GGGNNN' violates
MAX_POLY_X=5. It is now based on the worst possible case (all 3 Ns could
be Gs).
MAX_POLY_X=5. It is now based on the worst possible case (all 3 Ns
could be Gs).

2. ntthal allows multiple queries using the -i command line option.
ntthal runs in an interactive mode, each line is an oligo, where pairs of
consecutive lines are pairs of oligos to test (only for dimers).
ntthal runs in an interactive mode, each line is an oligo, where pairs
of consecutive lines are pairs of oligos to test (only for dimers).

3. GitHub default branch was renamed to main.
3. GitHub default branch was renamed to main. Please run these commands
on old repos:
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

4. Provided left and right primer may be not identical or the reverse
complement of each other.

5. More informative primer statistics with
PRIMER_TASK=pick_sequencing_primers.


release 2.5.0 2019-08-17 ===============================================
Expand Down
8 changes: 8 additions & 0 deletions test/primer_new_tasks_formatted_output
Original file line number Diff line number Diff line change
Expand Up @@ -2290,3 +2290,11 @@ considered 0, ok 0
libprimer3 release 2.2.3


PRIMER PICKING RESULTS FOR rev_comp_primers

INPUT PROBLEM: Specified left and right primer are reverse complementary

PRIMER PICKING RESULTS FOR identical_primers

INPUT PROBLEM: Specified left and right primer are identical

10 changes: 10 additions & 0 deletions test/primer_new_tasks_input
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,13 @@ PRIMER_FIRST_BASE_INDEX=1
PRIMER_MIN_SIZE=16
SEQUENCE_PRIMER_PAIR_OK_REGION_LIST=1,20,49,17
=
SEQUENCE_ID=rev_comp_primers
PRIMER_TASK=check_primers
SEQUENCE_PRIMER=CACCCCCATCAAACTCTTACTCA
SEQUENCE_PRIMER_REVCOMP=TGAGTAAGAGTTTGATGGGGGTG
=
SEQUENCE_ID=identical_primers
PRIMER_TASK=check_primers
SEQUENCE_PRIMER=CACCCCCATCAAACTCTTACTCA
SEQUENCE_PRIMER_REVCOMP=CACCCCCATCAAACTCTTACTCA
=
12 changes: 12 additions & 0 deletions test/primer_new_tasks_output
Original file line number Diff line number Diff line change
Expand Up @@ -1861,3 +1861,15 @@ PRIMER_LEFT_14_SELF_ANY=11.00
PRIMER_LEFT_14_SELF_END=11.00
PRIMER_LEFT_14_END_STABILITY=6.6000
=
SEQUENCE_ID=rev_comp_primers
PRIMER_TASK=check_primers
SEQUENCE_PRIMER=CACCCCCATCAAACTCTTACTCA
SEQUENCE_PRIMER_REVCOMP=TGAGTAAGAGTTTGATGGGGGTG
PRIMER_ERROR=Specified left and right primer are reverse complementary
=
SEQUENCE_ID=identical_primers
PRIMER_TASK=check_primers
SEQUENCE_PRIMER=CACCCCCATCAAACTCTTACTCA
SEQUENCE_PRIMER_REVCOMP=CACCCCCATCAAACTCTTACTCA
PRIMER_ERROR=Specified left and right primer are identical
=
6 changes: 3 additions & 3 deletions test/primer_sec_struct_thal_output
Original file line number Diff line number Diff line change
Expand Up @@ -5544,7 +5544,7 @@ PRIMER_PICK_LEFT_PRIMER=1
SEQUENCE_ID=pick_sequencing_primers_th_2
SEQUENCE_TEMPLATE=GANAATGCAGTAATGAGTTGGCAAATTATGAATCGCAATCAAATTTTTTCTATGACCTGATAGAAACGCCAACTCACTGTATGAGTCTGTTGTCAAAGTCTAACGTTGTCAAAGTCTATTCCAAAACGCAAAGCACGCTCCCGATC
PRIMER_WARNING=No left primer found in range 1 - 40
PRIMER_LEFT_EXPLAIN=considered 56, too many Ns 5, low tm 51, ok 0
PRIMER_LEFT_EXPLAIN=sequencing locations 1, considered 56, too many Ns 5, low tm 51, ok 0
PRIMER_LEFT_NUM_RETURNED=0
PRIMER_RIGHT_NUM_RETURNED=0
PRIMER_INTERNAL_NUM_RETURNED=0
Expand All @@ -5555,8 +5555,8 @@ PRIMER_PICK_RIGHT_PRIMER=1
SEQUENCE_ID=pick_sequencing_primers_th_3
SEQUENCE_TEMPLATE=GANAATGCAGTAATGAGTTGGCAAATTATGAATCGCAATCAAATTTTTTCTATGACCTGATAGAAACGCCAACTCACTGTATGAGTCTGTTGTCAAAGTCTAACGTTGTCAAAGTCTATTCCAAAACGCAAAGCACGCTCCCGATC
PRIMER_WARNING=No left primer found in range 1 - 40
PRIMER_LEFT_EXPLAIN=considered 56, too many Ns 5, low tm 51, ok 0
PRIMER_RIGHT_EXPLAIN=considered 63, low tm 33, high tm 13, ok 1
PRIMER_LEFT_EXPLAIN=sequencing locations 1, considered 56, too many Ns 5, low tm 51, ok 0
PRIMER_RIGHT_EXPLAIN=sequencing locations 1, considered 63, low tm 33, high tm 13, ok 1
PRIMER_PAIR_EXPLAIN=considered 0, ok 0
PRIMER_LEFT_NUM_RETURNED=0
PRIMER_RIGHT_NUM_RETURNED=1
Expand Down
6 changes: 3 additions & 3 deletions test/test_left_to_right_of_right_input
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
P3_COMMENT=The SEQUENCE_PRIMER and SEQUENCE_PRIMER_REVCOMP are reverse compliments of each other, and each is found at two positions in the template. The causes there to be 4 pairs to be considered, including one in which the left primer it to the right of the right primer.
SEQUENCE_TEMPLATE=AGGCTAGGCGAGCTGAAAAATCCTACNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNAGGCTAGGCGAGCTGAAAAATCCTAC
P3_COMMENT=The SEQUENCE_PRIMER and SEQUENCE_PRIMER_REVCOMP are found at two positions in the template. The causes there to be 2 pairs to be considered, including one in which the left primer it to the right of the right primer.
SEQUENCE_TEMPLATE=AGGCTAGGCGAGCTGAAAAATCCTACNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNAGGCTAGGCGAGCTGTTTTTTCCTACAGGCTAGGCGAGCTGAAAAATCCTAC
PRIMER_MAX_TEMPLATE_MISPRIMING=12
PRIMER_PICK_ANYWAY=1
PRIMER_PRODUCT_SIZE_RANGE=30-100
Expand All @@ -16,7 +16,7 @@ PRIMER_NUM_RETURN=1
PRIMER_MAX_SIZE=27
PRIMER_TM_FORMULA=1
SEQUENCE_PRIMER=AGGCTAGGCGAGCTGAAAAATCCTAC
SEQUENCE_PRIMER_REVCOMP=GTAGGATTTTTCAGCTCGCCTAGCCT
SEQUENCE_PRIMER_REVCOMP=GTAGGAAAAAACAGCTCGCCTAGCCT
PRIMER_THERMODYNAMIC_OLIGO_ALIGNMENT=1
PRIMER_THERMODYNAMIC_TEMPLATE_ALIGNMENT=1
PRIMER_THERMODYNAMIC_PARAMETERS_PATH=./primer3_config/
Expand Down
28 changes: 14 additions & 14 deletions test/test_left_to_right_of_right_output
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
P3_COMMENT=The SEQUENCE_PRIMER and SEQUENCE_PRIMER_REVCOMP are reverse compliments of each other, and each is found at two positions in the template. The causes there to be 4 pairs to be considered, including one in which the left primer it to the right of the right primer.
SEQUENCE_TEMPLATE=AGGCTAGGCGAGCTGAAAAATCCTACNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNAGGCTAGGCGAGCTGAAAAATCCTAC
P3_COMMENT=The SEQUENCE_PRIMER and SEQUENCE_PRIMER_REVCOMP are found at two positions in the template. The causes there to be 2 pairs to be considered, including one in which the left primer it to the right of the right primer.
SEQUENCE_TEMPLATE=AGGCTAGGCGAGCTGAAAAATCCTACNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNAGGCTAGGCGAGCTGTTTTTTCCTACAGGCTAGGCGAGCTGAAAAATCCTAC
PRIMER_MAX_TEMPLATE_MISPRIMING=12
PRIMER_PICK_ANYWAY=1
PRIMER_PRODUCT_SIZE_RANGE=30-100
Expand All @@ -16,7 +16,7 @@ PRIMER_NUM_RETURN=1
PRIMER_MAX_SIZE=27
PRIMER_TM_FORMULA=1
SEQUENCE_PRIMER=AGGCTAGGCGAGCTGAAAAATCCTAC
SEQUENCE_PRIMER_REVCOMP=GTAGGATTTTTCAGCTCGCCTAGCCT
SEQUENCE_PRIMER_REVCOMP=GTAGGAAAAAACAGCTCGCCTAGCCT
PRIMER_THERMODYNAMIC_OLIGO_ALIGNMENT=1
PRIMER_THERMODYNAMIC_TEMPLATE_ALIGNMENT=1
PRIMER_THERMODYNAMIC_PARAMETERS_PATH=./primer3_config/
Expand All @@ -25,23 +25,23 @@ PRIMER_MAX_HAIRPIN_TH=47
PRIMER_MAX_SELF_ANY_TH=47
PRIMER_MAX_SELF_END_TH=47
PRIMER_PAIR_MAX_COMPL_ANY_TH=30
PRIMER_WARNING=More than one position in template for input oligo AGGCTAGGCGAGCTGAAAAATCCTAC; More than one position in template for input oligo GTAGGATTTTTCAGCTCGCCTAGCCT
PRIMER_PAIR_EXPLAIN=considered 4, unacceptable product size 4, high any compl 3, high end compl 3, left primer to right of right primer 1, ok 3
PRIMER_WARNING=More than one position in template for input oligo AGGCTAGGCGAGCTGAAAAATCCTAC
PRIMER_PAIR_EXPLAIN=considered 2, unacceptable product size 2, high any compl 1, high end compl 1, left primer to right of right primer 1, ok 1
PRIMER_LEFT_NUM_RETURNED=1
PRIMER_RIGHT_NUM_RETURNED=1
PRIMER_INTERNAL_NUM_RETURNED=0
PRIMER_PAIR_NUM_RETURNED=1
PRIMER_PAIR_0_PENALTY=14.595379
PRIMER_PAIR_0_PENALTY=14.210545
PRIMER_LEFT_0_PENALTY=7.297689
PRIMER_RIGHT_0_PENALTY=7.297689
PRIMER_RIGHT_0_PENALTY=6.912856
PRIMER_LEFT_0_PROBLEMS= Hairpin stability too high;
PRIMER_RIGHT_0_PROBLEMS= Hairpin stability too high;
PRIMER_RIGHT_0_PROBLEMS= Hairpin stability too high; Contains too-long poly nucleotide tract;
PRIMER_LEFT_0_SEQUENCE=AGGCTAGGCGAGCTGAAAAATCCTAC
PRIMER_RIGHT_0_SEQUENCE=GTAGGATTTTTCAGCTCGCCTAGCCT
PRIMER_LEFT_0=175,26
PRIMER_RIGHT_0_SEQUENCE=GTAGGAAAAAACAGCTCGCCTAGCCT
PRIMER_LEFT_0=1,26
PRIMER_RIGHT_0=200,26
PRIMER_LEFT_0_TM=58.702
PRIMER_RIGHT_0_TM=58.702
PRIMER_RIGHT_0_TM=59.087
PRIMER_LEFT_0_GC_PERCENT=50.000
PRIMER_RIGHT_0_GC_PERCENT=50.000
PRIMER_LEFT_0_SELF_ANY_TH=15.46
Expand All @@ -52,7 +52,7 @@ PRIMER_LEFT_0_HAIRPIN_TH=47.75
PRIMER_RIGHT_0_HAIRPIN_TH=50.05
PRIMER_LEFT_0_END_STABILITY=3.1800
PRIMER_RIGHT_0_END_STABILITY=4.5800
PRIMER_PAIR_0_COMPL_ANY_TH=58.65
PRIMER_PAIR_0_COMPL_END_TH=58.65
PRIMER_PAIR_0_PRODUCT_SIZE=26
PRIMER_PAIR_0_COMPL_ANY_TH=47.59
PRIMER_PAIR_0_COMPL_END_TH=47.59
PRIMER_PAIR_0_PRODUCT_SIZE=200
=
6 changes: 3 additions & 3 deletions test/th-w-other-tasks_output
Original file line number Diff line number Diff line change
Expand Up @@ -10246,7 +10246,7 @@ PRIMER_PICK_LEFT_PRIMER=1
SEQUENCE_ID=pick_sequencing_primers_th_2
SEQUENCE_TEMPLATE=GANAATGCAGTAATGAGTTGGCAAATTATGAATCGCAATCAAATTTTTTCTATGACCTGATAGAAACGCCAACTCACTGTATGAGTCTGTTGTCAAAGTCTAACGTTGTCAAAGTCTATTCCAAAACGCAAAGCACGCTCCCGATC
PRIMER_WARNING=No left primer found in range 1 - 40
PRIMER_LEFT_EXPLAIN=considered 56, too many Ns 5, low tm 51, ok 0
PRIMER_LEFT_EXPLAIN=sequencing locations 1, considered 56, too many Ns 5, low tm 51, ok 0
PRIMER_LEFT_NUM_RETURNED=0
PRIMER_RIGHT_NUM_RETURNED=0
PRIMER_INTERNAL_NUM_RETURNED=0
Expand All @@ -10257,8 +10257,8 @@ PRIMER_PICK_RIGHT_PRIMER=1
SEQUENCE_ID=pick_sequencing_primers_th_3
SEQUENCE_TEMPLATE=GANAATGCAGTAATGAGTTGGCAAATTATGAATCGCAATCAAATTTTTTCTATGACCTGATAGAAACGCCAACTCACTGTATGAGTCTGTTGTCAAAGTCTAACGTTGTCAAAGTCTATTCCAAAACGCAAAGCACGCTCCCGATC
PRIMER_WARNING=No left primer found in range 1 - 40
PRIMER_LEFT_EXPLAIN=considered 56, too many Ns 5, low tm 51, ok 0
PRIMER_RIGHT_EXPLAIN=considered 63, low tm 33, high tm 13, ok 1
PRIMER_LEFT_EXPLAIN=sequencing locations 1, considered 56, too many Ns 5, low tm 51, ok 0
PRIMER_RIGHT_EXPLAIN=sequencing locations 1, considered 63, low tm 33, high tm 13, ok 1
PRIMER_PAIR_EXPLAIN=considered 0, ok 0
PRIMER_LEFT_NUM_RETURNED=0
PRIMER_RIGHT_NUM_RETURNED=1
Expand Down

0 comments on commit 9660639

Please sign in to comment.