示例#1
0
    def __init__(self, *args, **kargs):
        """
        Initialization:
        
        Keyword Arguments:
        sequence [type=str]          -- Flat sequence to use for this complex.
        structure [type=str]         -- Flat structure to use for this complex.
        name [type=str]              -- Name of the complex. If None (the default),
                                        it is automatically generated with the
                                        form 'automatic' + a unique integer.
        boltzmann_sample [type=bool] -- Whether we should boltzmann sample this
                                        complex.
        
        You must include both of the required keyword arguments to create a Complex with the new style init, or pass it the old style arguments used in `old_init`.
        """

        if len(args) == 4 or len(args) == 5:
            self.old_init(*args, **kargs)
            return
        elif 'sequence' in kargs and 'structure' in kargs:
            self.strand_list = [
                Strand(sequence=i) for i in kargs['sequence'].split("+")
            ]
            self._fixed_structure = str(kargs['structure'])
        elif 'strands' in kargs and 'structure' in kargs:
            self.strand_list = kargs['strands']
            self._init_parse_structure(str(kargs['structure']))

        self.id = Complex.unique_id
        self.name = kargs.get('name') or "automatic" + str(Complex.unique_id)
        # note: Boltzmann sampling is somewhat confusing if you pass a
        # structure that is anything other than all "."'s. So maybe we
        # should check for that.
        self.boltzmann_sample = kargs.get('boltzmann_sample', False)
        self._last_boltzmann_structure = False
        self._boltzmann_sizehint = 1
        self._boltzmann_queue = []

        # Adjust here for default Boltzmann Parameters. 'None' in this case means to not pass that parameter and let the sample binary use its default. Substrate defaults to DNA.
        self._dangles = None
        self._substrate_type = None
        self._temperature = None
        # Taken to be 1, unless it is EXPLICITLY stated otherwise!
        self.boltzmann_supersample = 1
        Complex.unique_id += 1
示例#2
0
 def __init__(self):
     self.led_on = False
     self.connected = False
     self.pattern = None
     self.color_spectrum = None
     self.error = False
     self.errormsg = None
     self.aws_access_key_id = None
     self.aws_secret_access_key = None
     self.aws_default_region = None
     self.aws_kinesis_stream_name = None
     self.device_state = {}
     if config.device_type == 'strand':
         self.strand = Strand()
     elif config.device_type == 'cam':
         self.cam = Cam()
     elif config.device_type == 'flame':
         self.flame = Flame()
 def __add__(self, other):
     if isinstance(other, Domain):
         return Strand(domains=[self, other])
     else:
         return NotImplemented
示例#4
0
 def __init__(self, seq: str = None):
     self.seq: str = seq
     strand: Strand = None
     if seq is not None:
         strand = Strand(seq, self)
     self.strand5p: Strand = strand