Package: dsdobjects
dsdobjects: an object library for DSD programmingA library of base classes for domain-level strand displacement (DSD)
programming.  If you are starting a new project that requires domains,
complexes, secondary structures, nucleotide sequences, reactions, etc.  then
you might find this module useful. Note that this is the in-house library of
thenuskellcompiler framework; it handels the parsing of supported input file
formats (mainly *.PIL) and their translation into the respective DSD objects.All objects provided here aresingletons. In other words, once you
intialize a Domaind1 = DomainS(name = 'a', length = 15), you will not be
allowed to initialize a new domain with the same name but different length,
unless you delete (all references to) the variabled1first. If you try to
initialize the same domain a second time, then the new objectisd1.
Generally, each (DomainS, ComplexS, MacrostateS, ReactionS) must be initialized
with parameters that define theircanonical formand (optionally) a name. If
both are given, the library checks that there are no conflicts with existing
objects, if the name is not provided, the library tries to initialize a new
object with an automatic name, but raises aSingletonErrorwhich holds a
reference to the existing object. If only the name is given, the existing
object is returned.This library is expected to evolve further, potentially breaking backward
compatibility as new challenges are waiting in thenuskellcompiler
framework.  Don't hesitate to contact the authors with questions about future
plans. Inheritance from the provided objects is fully supported and encouraged.InstallationTo install this library use pip:$ pip install dsdobjectsor the following command in the root directory:$ python ./setup.py installQuick StartfromdsdobjectsimportDomainS,ComplexS# Define a few toy domains:a=DomainS('a',length=15)b=DomainS('b',length=9)c=DomainS('c',length=6)# DomainS objects have exactly one complement, it can be initialized# and/or accessed using the __invert__ operator. The singleton type# ensures that there is only one object for each domain.assert(ais~(~a))# Use the Domains to define a Complex ...foo=ComplexS([a,b,c,~b,'+',~a],list('((.)+)'),name='foo')# ... and test some of the built-in complex properties:foo.kernel_stringfoo.canonical_formfoo.sizefoo.pair_tablefor(se,ss)infoo.rotate():print(se,ss)# If you initialize a disconnected complex ...bar=ComplexS([a,b,c,~b,'+',~a],list('.(.)+.'),name='bar')assertbar.is_connectedisFalse# ... use split to get all indiviudal complexes:cx1,cx2=bar.split()Quick Start from PIL filesInitialize prototype objects by loading a system (or a single line) of *.PIL
file format:fromdsdobjectsimportDomainSfromdsdobjects.objectioimportset_io_objects,clear_io_objects,read_pil,read_pil_line# Use the builtin singleton obects form the dsdobjects library.set_io_objects()# The following dictionary contains references to all objects.outdict=read_pil('filename',is_file=True)# The following let's you quickly initialize single objects.d5=read_pil_line("length d5 = 7")assertisinstance(d5,DomainS)d6=read_pil_line("sequence d6 = NNNNN")assertisinstance(d6,DomainS)assertd6.sequence=='NNNNN'Version0.8 -- requires Python<=3.7complete rewrite of the library to use singleton objects with weakrefAuthorStefan BadeltContributorsThis library contains adapted code from various related Python packages coded
in theDNA and Natural Algorithms Group, Caltech:"DNAObjects" coded by Joseph Berleant and Joseph Schaefferpeppercornenumeratorcoded by Kathrik Sarma, Casey Grun and Erik Winfreenuskellcoded by Seung Woo ShinProjects depending on dsdobjectspeppercornenumeratornuskellLicenseMIT