libnano / primer3-py

Simple oligo analysis and primer design
https://libnano.github.io/primer3-py
GNU General Public License v2.0
157 stars 43 forks source link

Removed output dictionary keys? #116

Closed DnaAnalyticsOld closed 1 year ago

DnaAnalyticsOld commented 1 year ago

Hi,

I believe the following dictionary keys are output by 1.2.2 but not 2.0.0:

PRIMER_PAIR_0_PRODUCT_TM_OLIGO_TM_DIFF PRIMER_PAIR_0_T_OPT_A PRIMER_LEFT_0_POSITION_PENALTY PRIMER_RIGHT_0_POSITION_PENALTY

Is this correct? If so, was this on purpose?

Raymond

benpruitt commented 1 year ago

As far as I know these should still be included in 2.0.0 and later, but @grinner is the SME. Do you have an example script / input that can reproduce the v1.2.2 -> v2.0.0 discrepancy?

DnaAnalyticsOld commented 1 year ago

Hi Ben,

Thank you for your quick response!

DNA Analytics has primer3-py embedded in a pipeline. I'm not sure what level of effort it will take to make a standalone script that I can send.

What was easy enough was to print out the relevant portion of the dictionary that primer3-py returns using first 1.2.2 and then 2.0.0.

The attached Excel workbook shows the two outputs. I've aligned the keys for comparison. The 2.0.0 dictionary is 4 entries shorter than the 1.2.2 dictionary.

The code that calls primer3-py is:

invoke Primer3

result_dict = primer3.bindings.design_primers(
    seq_args={
        'SEQUENCE_ID': 'example',
        'SEQUENCE_TEMPLATE': sequence,
        'SEQUENCE_TARGET': f'{flank_len+1},1'
    },
    global_args=settings_workflow.get('primer3')
)

The changes to the default parameter values are:

PRIMER_MIN_SIZE: 13 PRIMER_OPT_SIZE: 20 PRIMER_MAX_SIZE: 30 MAX_DIFF_TM: 3 PRIMER_MIN_TM: 59.0 PRIMER_OPT_TM: 62.0 PRIMER_MAX_TM: 64.0 MAX_MISPRIMING: 8 PRIMER_PRODUCT_SIZE_RANGE: '60-60'

I will guess that @grinner can replicate the output using any input target sequence, parameter values, and request for primer pairs.

Best,

Raymond

On Thu, Jun 29, 2023 at 2:20 PM Ben Pruitt @.***> wrote:

As far as I know these should still be included in 2.0.0 and later, but @grinner https://github.com/grinner is the SME. Do you have an example script / input that can reproduce the v1.2.2 -> v2.0.0 discrepancy?

— Reply to this email directly, view it on GitHub https://github.com/libnano/primer3-py/issues/116#issuecomment-1613593566, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI35GIPML3LEVJBQT62MMLXNXATVANCNFSM6AAAAAAZYSOK3U . You are receiving this because you authored the thread.Message ID: @.***>

-- Raymond J. Peterson, PhD CEO DNA Analytics http://dnaanalytics.com/ (301) 318.5121 www.linkedin.com/in/raymondjpeterson

DnaAnalyticsOld commented 1 year ago

Hi Ben,

Any news on this? I don't have @grinner's email, otherwise I'd ask Nick.

Best,

Raymond

---------- Forwarded message --------- From: Raymond Peterson @.***> Date: Thu, Jun 29, 2023 at 3:00 PM Subject: Re: [libnano/primer3-py] Removed output dictionary keys? (Issue

116)

To: libnano/primer3-py < @.> Cc: Bert Gold @.>, Christy Gault < @.***>

Hi Ben,

Thank you for your quick response!

DNA Analytics has primer3-py embedded in a pipeline. I'm not sure what level of effort it will take to make a standalone script that I can send.

What was easy enough was to print out the relevant portion of the dictionary that primer3-py returns using first 1.2.2 and then 2.0.0.

The attached Excel workbook shows the two outputs. I've aligned the keys for comparison. The 2.0.0 dictionary is 4 entries shorter than the 1.2.2 dictionary.

The code that calls primer3-py is:

invoke Primer3

result_dict = primer3.bindings.design_primers(
    seq_args={
        'SEQUENCE_ID': 'example',
        'SEQUENCE_TEMPLATE': sequence,
        'SEQUENCE_TARGET': f'{flank_len+1},1'
    },
    global_args=settings_workflow.get('primer3')
)

The changes to the default parameter values are:

PRIMER_MIN_SIZE: 13 PRIMER_OPT_SIZE: 20 PRIMER_MAX_SIZE: 30 MAX_DIFF_TM: 3 PRIMER_MIN_TM: 59.0 PRIMER_OPT_TM: 62.0 PRIMER_MAX_TM: 64.0 MAX_MISPRIMING: 8 PRIMER_PRODUCT_SIZE_RANGE: '60-60'

I will guess that @grinner can replicate the output using any input target sequence, parameter values, and request for primer pairs.

Best,

Raymond

On Thu, Jun 29, 2023 at 2:20 PM Ben Pruitt @.***> wrote:

As far as I know these should still be included in 2.0.0 and later, but @grinner https://github.com/grinner is the SME. Do you have an example script / input that can reproduce the v1.2.2 -> v2.0.0 discrepancy?

— Reply to this email directly, view it on GitHub https://github.com/libnano/primer3-py/issues/116#issuecomment-1613593566, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI35GIPML3LEVJBQT62MMLXNXATVANCNFSM6AAAAAAZYSOK3U . You are receiving this because you authored the thread.Message ID: @.***>

-- Raymond J. Peterson, PhD CEO DNA Analytics http://dnaanalytics.com/ (301) 318.5121 www.linkedin.com/in/raymondjpeterson

-- Raymond J. Peterson, PhD CEO DNA Analytics http://dnaanalytics.com/ (301) 318.5121 www.linkedin.com/in/raymondjpeterson

grinner commented 1 year ago

I will look at this this weekend.

DnaAnalyticsOld commented 1 year ago

Thank you Nick. Raymond

On Fri, Jul 7, 2023 at 7:53 PM Nick Conway @.***> wrote:

I will look at this this weekend.

— Reply to this email directly, view it on GitHub https://github.com/libnano/primer3-py/issues/116#issuecomment-1626370252, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI35GPY5DVRB2AJDXEJ56DXPCOQDANCNFSM6AAAAAAZYSOK3U . You are receiving this because you authored the thread.Message ID: @.***>

-- Raymond Peterson, PhD (301) 318.5121 www.linkedin.com/in/raymondjpeterson

grinner commented 1 year ago

@DNAanalytics The issue you are seeing is that you are not specifying PRIMER_PRODUCT_MAX_TM or PRIMER_PRODUCT_MIN_TM in your global arguments. If these parameters are not set. These values will not be included in the results

import primer3.bindings

SEQUENCE_TEMPLATE = (
    'GCTTGCATGCCTGCAGGTCGACTCTAGAGGATCCCCCTACATTTT'
    'AGCATCAGTGAGTACAGCATGCTTACTGGAAGAGAGGGTCATGCA'
    'ACAGATTAGGAGGTAAGTTTGCAAAGGCAGGCTAAGGAGGAGACG'
)

flank_len = 40

global_args = {
    'PRIMER_MIN_SIZE': 13,
    'PRIMER_OPT_SIZE': 20,
    'PRIMER_MAX_SIZE': 30,
    'MAX_DIFF_TM': 3,
    'PRIMER_MIN_TM': 59.0,
    'PRIMER_OPT_TM': 62.0,
    'PRIMER_MAX_TM': 64.0,
    'MAX_MISPRIMING': 8,
    'PRIMER_PRODUCT_SIZE_RANGE': '60-60',
}

result_dict1 = primer3.bindings.design_primers(
    seq_args={
        'SEQUENCE_TEMPLATE': SEQUENCE_TEMPLATE,
        'SEQUENCE_TARGET': f'{flank_len+1},1'
    },
    global_args=global_args,
)

print('PRIMER_PAIR_0_PRODUCT_TM_OLIGO_TM_DIFF' in result_dict1)
# prints False

global_args['PRIMER_PRODUCT_MAX_TM'] = 100

result_dict2 = primer3.bindings.design_primers(
    seq_args={
        'SEQUENCE_TEMPLATE': SEQUENCE_TEMPLATE,
        'SEQUENCE_TARGET': f'{flank_len+1},1'
    },
    global_args=global_args,
)

print('PRIMER_PAIR_0_PRODUCT_TM_OLIGO_TM_DIFF' in result_dict1)
# prints True

This is controlled by line 2080 in thermoanalysis.pyx in v1.2.2 and also line 2238 in master

The above test was run in master

Add one of PRIMER_PRODUCT_MAX_TM or PRIMER_PRODUCT_MIN_TM keys and your should be gtg.

DnaAnalyticsOld commented 1 year ago

Hi Nick,

Thank you for investigating this and for providing the solution. We will try it in our pipeline.

It's odd, though. The up-versioning to 2.0.0 broke our code. I'm not aware of any changes to our code or our parameter specifications.

My inference was that primer3-py uses a complete set of internal parameter values (like Primer3 itself) and that one can override these on a parameter by parameter basis using global args. Is that not correct?

If it is not correct, then setting global args uses only the parameter values in global args and leaves all other parameter values blank?

Is there any way to use the comprehensive list of preset global defaults and to override individual parameter values?

Best,

Raymond

On Sun, Jul 9, 2023 at 3:21 PM Nick Conway @.***> wrote:

@DNAanalytics https://github.com/DNAanalytics The issue you are seeing is that you are not specifying PRIMER_PRODUCT_MAX_TM or PRIMER_PRODUCT_MIN_TM in your global arguments. If these parameters are not set. These values will not be included in the results

import primer3.bindings SEQUENCE_TEMPLATE = ( 'GCTTGCATGCCTGCAGGTCGACTCTAGAGGATCCCCCTACATTTT' 'AGCATCAGTGAGTACAGCATGCTTACTGGAAGAGAGGGTCATGCA' 'ACAGATTAGGAGGTAAGTTTGCAAAGGCAGGCTAAGGAGGAGACG' ) flank_len = 40 global_args = { 'PRIMER_MIN_SIZE': 13, 'PRIMER_OPT_SIZE': 20, 'PRIMER_MAX_SIZE': 30, 'MAX_DIFF_TM': 3, 'PRIMER_MIN_TM': 59.0, 'PRIMER_OPT_TM': 62.0, 'PRIMER_MAX_TM': 64.0, 'MAX_MISPRIMING': 8, 'PRIMER_PRODUCT_SIZE_RANGE': '60-60', } result_dict1 = primer3.bindings.design_primers( seq_args={ 'SEQUENCE_TEMPLATE': SEQUENCE_TEMPLATE, 'SEQUENCE_TARGET': f'{flank_len+1},1' }, global_args=global_args, ) print('PRIMER_PAIR_0_PRODUCT_TM_OLIGO_TM_DIFF' in result_dict1)# prints False global_args['PRIMER_PRODUCT_MAX_TM'] = 100 result_dict2 = primer3.bindings.design_primers( seq_args={ 'SEQUENCE_TEMPLATE': SEQUENCE_TEMPLATE, 'SEQUENCE_TARGET': f'{flank_len+1},1' }, global_args=global_args, ) print('PRIMER_PAIR_0_PRODUCT_TM_OLIGO_TM_DIFF' in result_dict1)# prints True

This is controlled by line 2080 https://github.com/libnano/primer3-py/blob/v1.2.2/primer3/thermoanalysis.pyx#L2080 in thermoanalysis.pyx in v1.2.2 and also line 2238 https://github.com/libnano/primer3-py/blob/master/primer3/thermoanalysis.pyx#L2238 in master

The above test was run in master

Add one of PRIMER_PRODUCT_MAX_TM or PRIMER_PRODUCT_MIN_TM keys and your should be gtg.

— Reply to this email directly, view it on GitHub https://github.com/libnano/primer3-py/issues/116#issuecomment-1627802633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI35GJRBVQK5RKNBUOGUTDXPMAB5ANCNFSM6AAAAAAZYSOK3U . You are receiving this because you were mentioned.Message ID: @.***>

-- Raymond Peterson, PhD (301) 318.5121 www.linkedin.com/in/raymondjpeterson