Skip to content

Replacement for primer3.primerdesign.setGlobals unclear #133

@peterjc

Description

@peterjc

I have some code last used in June 2022 which used primer3-py v0.6.1, specifically the following imports:

from primer3.bindings import designPrimers
from primer3.primerdesign import setGlobals

# I only used the first positional argument, but all 3 are required:
#  -  global_args: dictionary of Primer3 args
#  -  misprime_lib: mispriming library dictionary
#  -  mishyb_lib: mishybridization library dictionary
setGlobals({...}, {}, {})

sequence = "..."
seq_args = {"SEQUENCE_ID": "XXX", "SEQUENCE_TEMPLATE": sequence}
results = designPrimers(seq_args)

The first line is easy enough, v1.0.0 deprecated the camelCase names and replaced them, and then the camelCase names were dropped in v2.0.0 (see #132 about making this more explicit):

from primer3.bindings import design_primers as designPrimers  # minimal change

The second import is more tricky. Moving from v0.6.1 to v1.0.0, even import primer3.primerdesign no longer works. I can see setGlobals was removed as part of #69, the only other clue is the CHANGE entry:

  • Call signature update and pattern update: designPrimers now design_primers integrates setting of sequence arguments and global arguments as they are coupled in primer3_boulder_main.c

I believe the expectation is to use something like this:

from primer3.bindings import design_primers

GLOBALS = {...}

sequence = "..."
seq_args = {"SEQUENCE_ID": "XXX", "SEQUENCE_TEMPLATE": sequence}
results = design_primers(seq_args, global_args=GLOBALS)

And similarly if using misprime_lib and/or mishyb_lib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions