SynBioWeaver Package Reference

exception synbioweaver.core.AspectValueError[source]

Bases: exceptions.ValueError

An Aspect class was expected, but something else given

args
message
exception synbioweaver.core.CircuitValueError[source]

Bases: exceptions.ValueError

A Circuit class was expected, but something else given

args
message
exception synbioweaver.core.InvalidAdviceMethodError[source]

Bases: exceptions.ValueError

method with 2 parameters expected, but something else given

args
message
exception synbioweaver.core.InvalidPointCutError[source]

Bases: exceptions.ValueError

object of type PointCut expected, but something else given

args
message
exception synbioweaver.core.InvalidPointCutExpressionError[source]

Bases: exceptions.ValueError

There is an error in a Point Cut expression

args
message
exception synbioweaver.core.InvalidPointCutOperatorError[source]

Bases: exceptions.ValueError

An unknown or illegal operator was used for the point cut

args
message
exception synbioweaver.core.InvalidSignatureError[source]

Bases: exceptions.ValueError

A signature (PointCut / Part / Molecule) is incorrectly formatted or typed

args
message
exception synbioweaver.core.InvalidSymbolNameError[source]

Bases: exceptions.ValueError

A symbol name (string) was not correctly formatted

args
message
exception synbioweaver.core.InvalidWeaverOutputMethodError[source]

Bases: exceptions.ValueError

with 2 parameters expected, but something else given

args
message
exception synbioweaver.core.MoleculeValueError[source]

Bases: exceptions.ValueError

Molecule was expected, but something else was given

args
message
exception synbioweaver.core.PartInitializationError[source]

Bases: exceptions.Exception

Part was expected, but something else was given

args
message
exception synbioweaver.core.PartValueError[source]

Bases: exceptions.ValueError

Part was expected, but something else was given

args
message
exception synbioweaver.core.PrecedenceOutOfRangeError[source]

Bases: exceptions.ValueError

An unknown or illegal operator was used for the point cut

args
message
exception synbioweaver.core.SymbolExistsWarning[source]

Bases: exceptions.UserWarning

A Part or Molecule declaration uses an existing name

args
message
class synbioweaver.core.Advice(pointcut, adviceMethod, precedence=0)[source]

Bases: object

Container for Advice

Attributes:
precedence : int - High precedence advice have execution priority over low precedence
- MINPRECEDENCE <= precedence <= MAXPRECEDENCE is the valid range
pointcut : PointCut
adviceMethod : method - The method to be executed at the advice
- must have 2 parameters: self and PointCutContext
MAXPRECEDENCE = 100
MINPRECEDENCE = 0
class synbioweaver.core.Aspect[source]

Bases: object

Abstract class for an Aspect | Will generally be used to represent a design’s cross-cutting concerns

Notes:
Any child must implement mainAspect method
Attributes
weaver: Weaver
The weaver which compiles the aspect
adviceList - A list of all advice this aspect declares
typeAdviceList - A list of all type advice this aspect declares
weaverOutputList - A list of all type advice for the WeaverOutput
addAdvice(pointcut, adviceMethod, precedence=0)[source]

Declare a new advice in the aspect

Args:
pointcut - The pointcut for the advice
adviceMethod - The method to be executed at the pointcut
should be a method bound to this aspect, with second parameter
expecting a PointCutContext object
precedence : integer (optional) - set precedence of advice,
see notes on Advice.precedence
Notes:
addAdvice constructs an Advice object. Further information thus
can be found there.
addCircuit(circuit)[source]

Add a circuit as a sub-compartment in the current compartment

Args:
circuit: Circuit to be added as a sub-compartment
addPart(part)[source]

Used to add parts to the design by passing them on to the AOSB Weaver

Args:
part: The part to be added to the circuit
addTypeAdvice(signature, typeaddition, name)[source]

Declare a type advice in the aspect

Args:
signature - The signature for the type advice
typeaddition - The attribute / method to be added to the type
name: str - The name for the typeaddition in the new type
Notes:
addTypeAdvice constructs an TypeAdvice object.
Further information thus can be found there.
addWeaverOutput(outputmethod)[source]

Declare a new weaver output target

Args:
outputMethod - The method to be added to the WeaverOutput
Raises:
InvalidWeaverOutputMethodError -
If outputmethod is not a method or has wrong number of parameters
(needs to accept self and a WeaverOutput reference)
createMolecule(molecule)[source]

Declare that a particular molecule exists in the current scope

Args:
molecule
exportMolecule(molecule)[source]

Export a particular molecule from this compartment to the outer compartment

Args:
molecule
getAdviceList()[source]

Returns adviceList

getTypeAdviceList()[source]

Returns typeAdviceList

getWeaverOutputList()[source]

Returns weaverOutputList

importMolecule(molecule)[source]

Import a particular molecule from the outer compartment to this compartment

Args:
molecule
mainAspect()[source]

Entry point for an aspect, analogous to “main” in a program | Needs to be implemented by any sub class. | mainAspect will be called by the AOSB Weaver.

reactionFrom(*molecules)[source]

Used to add a reaction to the aspect by passing the reactions left side on to the AOSB Weaver

Args:
*molecules: a list of one or more molecules on the lhs of the reaction
reactionTo(*molecules)[source]

Used to add a reaction to the aspect by passing the reactions right side on to the AOSB Weaver

Args:
*molecules: a list of one or more molecules on the rhs of the reaction
setWeaver(weaver)[source]

Internal - Should not be used outside of the framework. Sets the Weaver Object of this Circuit

Args:
weaver: A weaver object that will be used
class synbioweaver.core.Circuit[source]

Bases: synbioweaver.core.Part

Abstract class for a genetic part circuit.

Will generally be used to represent a design’s core concerns
Additionally, a circuit can be used to represent composite parts
Attributes:
weaver: Weaver
The weaver which compiles the circuit
addCircuit(circuit)[source]

Add a circuit as a sub-compartment in the current compartment

Args:
circuit: Circuit to be added as a sub-compartment
addPart(part)[source]

Used to add parts to the circuit by passing them on to the AOSB Weaver

Args:
part: The part to be added to the circuit
createMolecule(molecule)[source]

Declare that a particular molecule exists in the current scope

Args:
molecule
exportMolecule(molecule)[source]

Export a particular molecule from this compartment to the outer compartment

Args:
molecule
getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()

Returns the part just before this part in the execution flow

importMolecule(molecule)[source]

Import a particular molecule from the outer compartment to this compartment

Args:
molecule
mainCircuit()[source]

Entry point for a circuit, analogous to “main” in a program

Needs to be implemented by any sub class.
mainCircuit will be called by the AOSB Weaver.
reactionFrom(*molecules)[source]

Used to add a reaction to the circuit by passing the reactions left side on to the AOSB Weaver

Args:
*molecules: a list of one or more molecules on the lhs of the reaction
reactionTo(*molecules)[source]

Used to add a reaction to the circuit by passing the reactions right side on to the AOSB Weaver

Args:
*molecules: a list of one or more molecules on the rhs of the reaction
setAfterPart(part)

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setWeaver(weaver)[source]

Internal - Should not be used outside of the framework.

Sets the Weaver Object of this Circuit

Args:
weaver: A weaver object that will be used
weave(weaver)

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.CodingRegion(codesFor)[source]

Bases: synbioweaver.core.Part

Class for parts that are Coding Regions

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()

Returns the part just before this part in the execution flow

getCodingFor()[source]
setAfterPart(part)

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
weave(weaver)

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.ConstitutivePromoter[source]

Bases: synbioweaver.core.Promoter

Class for Promoters that are Constitutive Promoters

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()

Returns the part just before this part in the execution flow

setAfterPart(part)

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
weave(weaver)

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.ExecutionNode[source]

Bases: object

Abstract Superclass for all nodes in an execution flow, e.g. parts, molecules

Parts are the atomistic instructions in the genetic circuit execution flow

Attributes:
before : [ExecutionNode]
A list of ExecutionNode objects that precede this node
after : [ExeuctionNode]
A list of ExecutionNode objects that follow this node
scope : class(WeaverOutput)
What woven system is this node part of
additionStack : [Circuit or Aspect]
stack of Aspects and Circuits which are executing to add
this node
getAfterNodes(filterType)[source]

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforeNodes(filterType=<type 'object'>)[source]

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
class synbioweaver.core.HybridPromoter(regulatedBy, regulatorInfo)[source]

Bases: synbioweaver.core.Promoter

Class for Promoters that are Hybrid Promoters, i.e. with several repressing / inducing operator sites

like other regulated Promoters (NegativePromoter, PostiivePromoter), its regulators are accessible by getRegulatedBy(). Additionally, getInducers(), getRepressors(), and isInducer(molecule), isRepressor(molecule) give information about the functionality of the Promoter.

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()

Returns the part just before this part in the execution flow

getInducers()[source]

Returns a list of positively regulating Molecules

getRegulatedBy()[source]

Returns a list of Molecules regulating this Promoter

getRepressors()[source]

Returns a list of negatively regulating Molecules

isInducer(molecule)[source]
isRepressor(molecule)[source]
setAfterPart(part)

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
weave(weaver)

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.Molecule[source]

Bases: synbioweaver.core.ExecutionNode

Abstract Superclass for all Molecules

Molecules are the nodes in the execution flow, for example: reactions: (MoleculeA+MoleculeB -> MoleculeC), translation: CodingRegion->MoleculeA, inducing: MoleculeA -> RegulatdPromoter, membrane transfer: MoleculeA (Compartment) -> MoleculeA (Outside Compartment)

These nodes in the execution flow don’t mean an existence of an element, but rather describe the information flow within the system.

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
class synbioweaver.core.MoleculeSignature(signature)[source]

A MoleculeSignature, used for Type Advice of Molecules

Attributes:
namespace : [PartSignatureElement] - List of signature parts of the signature
molecule : MoleculeSignatureElement - The “part” part of the signature
match(molecule)[source]

see PointCutExpressionNode definition

matchNamespaces(namespace, scope)[source]
class synbioweaver.core.MoleculeSignatureElement(signature)[source]

Bases: synbioweaver.core.PartSignatureElement

A PartSignatureElement that is a Molecule Signature | Overloads some methods, since MoleculeSignature is used by the user for | Molecule Type Advice - unlike PartSignatureElement, which is internal

match(obj)[source]

see PointCutExpressionNode definition

ANY = 1
CLASSONLY = 3
SUBCLASS = 2
class synbioweaver.core.NegativePromoter(regulatedBy)[source]

Bases: synbioweaver.core.Promoter

Class for Promoters that are Negative Promoters

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()

Returns the part just before this part in the execution flow

getRegulatedBy()[source]

Returns a list of Molecules regulating this Promoter

setAfterPart(part)

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
weave(weaver)

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.NotOnStack(signature)[source]

Bases: synbioweaver.core.PointCutExpressionNode

match(part)[source]

see PointCutExpressionNode definition

numberOfMatchingParts(part)

returns the number of parts the expression matches | If an expression uses concatenation, then it might match the current part and a number of preceding parts.

Args:
part - The part at which matching starts
Returns:
integer - how many parts were matched
class synbioweaver.core.OnStack(signature)[source]

Bases: synbioweaver.core.PointCutExpressionNode

match(part)[source]

see PointCutExpressionNode definition

numberOfMatchingParts(part)

returns the number of parts the expression matches | If an expression uses concatenation, then it might match the current part and a number of preceding parts.

Args:
part - The part at which matching starts
Returns:
integer - how many parts were matched
class synbioweaver.core.Part[source]

Bases: synbioweaver.core.ExecutionNode

Abstract Superclass for all Parts

Parts are the atomistic instructions in the genetic circuit execution flow, e.g. Promoters, RBSs, Terminators, Coding Regions They inherit their functionality as nodes in the execution flow from their superclass ExecutionNode

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()[source]

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()[source]

Returns the part just before this part in the execution flow

setAfterPart(part)[source]

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)[source]

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
weave(weaver)[source]

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.PartSignature(signature)[source]

Bases: synbioweaver.core.PointCutExpressionNode

A PartSignature, used in PointCut expressions or directly for Type Advice

Attributes:
namespace : [PartSignatureElement] - List of signature parts of the signature
part : PartSignatureElement - The “part” part of the signature
molcule : PartSignatureElement - The molecule part of the signature
nomolecule : Boolean -
If the PartSignature explicitly should not match parts with molecules
match(part)[source]

see PointCutExpressionNode definition

matchNamespaces(namespace, scope)[source]
numberOfMatchingParts(part)

returns the number of parts the expression matches | If an expression uses concatenation, then it might match the current part and a number of preceding parts.

Args:
part - The part at which matching starts
Returns:
integer - how many parts were matched
class synbioweaver.core.PartSignatureElement(signature)[source]

Bases: object

A building block of a Part Signature

Attributes:
qualifier : ANY / SUBCLASS / CLASSONLY
Whether the element should match precisely, all subclasses or uses a wildcard
element : str - The string of the element (without a qualifier)
inverse : boolean - Whether the element has been negated
match(obj)[source]

see PointCutExpressionNode definition

ANY = 1
CLASSONLY = 3
SUBCLASS = 2
class synbioweaver.core.PointCut(signature, operator)[source]

Bases: object

A PointCut to select Join Points in the genetic parts execution flow

Attributes:
operator : BEFORE / AFTER / REPLACE
- The operator for this PointCut
signature : PartSignature
checkAndSetOperator(operator)[source]

Set the internal operator attribute, if the parameter is a valid operator

Args:
operator - The operator to be confirmed
Raises:
InvalidPointCutOperatorError - if the operator is invalid
(can be dependent on the signature)
match(part)[source]

see PointCutExpressionNode definition

AFTER = 22
BEFORE = 11
REPLACE = 33
class synbioweaver.core.PointCutContext(within, part)[source]

Bases: object

Container for context at a PointCut

Attributes:
within - A stack of the circuits / aspects that within which the PointCut was matched
part - The part matched by the PointCut
isWithin(obj)[source]

Checks if the parameter (a circuit or aspect) is on the within stack | Args: | obj : Circuit / Aspect - The object that is to be found on the stack

Returns:
Boolean - true if obj is on the within stack
class synbioweaver.core.PointCutExpressionAnd(left, right)[source]

Bases: synbioweaver.core.PointCutExpressionOperator

A PointCutExpressionOperator which is an And

expressionUses(nodeType)

Confirms if a certain type of node is used in the expression

Args:
nodeType: The type of the node whose existence is to be confirmed
Returns:
boolean - Whether or not the node exists in the formula
match(part)[source]

see PointCutExpressionNode definition

numberOfMatchingParts(part)

returns the number of parts the expression matches | If an expression uses concatenation, then it might match the current part and a number of preceding parts.

Args:
part - The part at which matching starts
Returns:
integer - how many parts were matched
left = None
right = None
class synbioweaver.core.PointCutExpressionConcatenate(left, right)[source]

Bases: synbioweaver.core.PointCutExpressionOperator

A PointCutExpressionOperator which is an Concatenation

expressionUses(nodeType)

Confirms if a certain type of node is used in the expression

Args:
nodeType: The type of the node whose existence is to be confirmed
Returns:
boolean - Whether or not the node exists in the formula
match(part)[source]

see PointCutExpressionNode definition

numberOfMatchingParts(part)[source]

see PointCutExpressionNode definition

This child overrides it, since a concatenation operator is a node in the expression at which more than one part can be matched.

left = None
right = None
class synbioweaver.core.PointCutExpressionNode[source]

Bases: object

Abstract superclass for all Nodes in a Point Cut Expression Tree

A complex expression for a Point Cut, using operators such as & (and),
| (or) or % (concatenation) is represented as a tree of nodes
match(part)[source]

Does a part match this (sub)-expression? An abstract method, must be implemented by each child

Args:
part - The part to be matched
Returns:
boolean - Whether or not the part was matched
numberOfMatchingParts(part)[source]

returns the number of parts the expression matches | If an expression uses concatenation, then it might match the current part and a number of preceding parts.

Args:
part - The part at which matching starts
Returns:
integer - how many parts were matched
class synbioweaver.core.PointCutExpressionNot(pointcutexpression)[source]

Bases: synbioweaver.core.PointCutExpressionOperator

A PointCutExpressionOperator which is a Not

A special case, only uses one child, acts as the inverse operator

expressionUses(nodeType)

Confirms if a certain type of node is used in the expression

Args:
nodeType: The type of the node whose existence is to be confirmed
Returns:
boolean - Whether or not the node exists in the formula
match(part, within=None)[source]

see PointCutExpressionNode definition

numberOfMatchingParts(part)

returns the number of parts the expression matches | If an expression uses concatenation, then it might match the current part and a number of preceding parts.

Args:
part - The part at which matching starts
Returns:
integer - how many parts were matched
left = None
right = None
class synbioweaver.core.PointCutExpressionOperator(left, right)[source]

Bases: synbioweaver.core.PointCutExpressionNode

Abstract superclass of an PointCutExpression Node which is an operator

Attributes:
left - The first child of the operator
right - The second child of the operator
expressionUses(nodeType)[source]

Confirms if a certain type of node is used in the expression

Args:
nodeType: The type of the node whose existence is to be confirmed
Returns:
boolean - Whether or not the node exists in the formula
match(part)

Does a part match this (sub)-expression? An abstract method, must be implemented by each child

Args:
part - The part to be matched
Returns:
boolean - Whether or not the part was matched
numberOfMatchingParts(part)

returns the number of parts the expression matches | If an expression uses concatenation, then it might match the current part and a number of preceding parts.

Args:
part - The part at which matching starts
Returns:
integer - how many parts were matched
left = None
right = None
class synbioweaver.core.PointCutExpressionOr(left, right)[source]

Bases: synbioweaver.core.PointCutExpressionOperator

A PointCutExpressionOperator which is an Or

expressionUses(nodeType)

Confirms if a certain type of node is used in the expression

Args:
nodeType: The type of the node whose existence is to be confirmed
Returns:
boolean - Whether or not the node exists in the formula
match(part, within=None)[source]

see PointCutExpressionNode definition

numberOfMatchingParts(part)

returns the number of parts the expression matches | If an expression uses concatenation, then it might match the current part and a number of preceding parts.

Args:
part - The part at which matching starts
Returns:
integer - how many parts were matched
left = None
right = None
class synbioweaver.core.PositivePromoter(regulatedBy)[source]

Bases: synbioweaver.core.Promoter

Class for Promoters that are Positive Promoters

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()

Returns the part just before this part in the execution flow

getRegulatedBy()[source]

Returns a list of Molecules regulating this Promoter

setAfterPart(part)

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
weave(weaver)

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.Promoter[source]

Bases: synbioweaver.core.Part

Class for Parts that are Promoters

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()

Returns the part just before this part in the execution flow

setAfterPart(part)

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
weave(weaver)

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.Protein[source]

Bases: synbioweaver.core.Molecule

Class for Molecules that are Proteins

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
class synbioweaver.core.RBS[source]

Bases: synbioweaver.core.Part

Class for parts that are Ribosome BindingSites

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()

Returns the part just before this part in the execution flow

setAfterPart(part)

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
weave(weaver)

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.RNACodingRegion(codesFor)[source]

Bases: synbioweaver.core.Part

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()

Returns the part just before this part in the execution flow

getCodingFor()[source]
setAfterPart(part)

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
weave(weaver)

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.Terminator[source]

Bases: synbioweaver.core.Part

Class for parts that are Terminators

getAfterNodes(filterType)

Returns all nodes immediately after this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getAfterPart()

Returns the part just after this part in the execution flow

getBeforeNodes(filterType=<type 'object'>)

Returns all nodes immediately before this node in the execution flow, with the option to filter by node type

Args:
filterType: Filters the list to only include nodes of a given (super)type
getBeforePart()

Returns the part just before this part in the execution flow

setAfterPart(part)

Inserts a part after this part in the execution flow. If there’s already a part behind this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
setBeforePart(part)

Inserts a part before this part in the execution flow. If there’s already a part in front of this part, the part to be inserted will be inserted between the two parts presently connected

Args:
part: the Part to be inserted
weave(weaver)

Internal method used during the weaving process: Facilitates molecule scope checking

class synbioweaver.core.TypeAdvice(signature, typeaddition, name, aspect)[source]

Bases: object

Container for TypeAdvice

Attributes:
signature : PartSignature or MoleculeSignature
typeaddition : method or attribute to be added to the type
name : The name the new typeaddition should have in the new type
aspect : Aspect which declares this TypeAdvice
isMoleculeAdvice()[source]

Returns True if TypeAdvice is for Molecule, False otherwise

isPartAdvice()[source]

Returns True if TypeAdvice is for Part, False otherwise

class synbioweaver.core.Weaver(circuit, *aspects)[source]

Bases: object

The “compiler” that weaves core concerns (circuits) and cross-cutting concerns (aspects) and creates a woven execution flow of parts

Attributes:
partList - The current list of parts
moleculeList - The current list of molecules
beforeAndReplaceAdviceList - List of all before and replace advice to be woven
afterAdviceList - List of all after advice to be woven
partTypeAdviceList - List of all part type advice
moleculeTypeAdviceList - List of all molecule type advice
circuit - The main circuit
aspects - The list of all aspects to be woven
weaverOutput : WeaverOutput - The “compiled” result
class MoleculeReactionFrom(weaver, callingObject, molecules)[source]

Class to represent the left hand side of a molecule reaction and enable convenient syntax by overloading the >> (rshift) operator

Attributes:
before : [ExecutionNode]
A list of ExecutionNode objects that precede this node
after : [ExeuctionNode]
A list of ExecutionNode objects that follow this node
scope : class(WeaverOutput)
What woven system is this node part of
additionStack : [Circuit or Aspect]
stack of Aspects and Circuits which are executing to add
this node
class MoleculeReactionTo(molecules)[source]

Class to represent the right hand side of a molecule reaction

class WeaverOutput(circuitName, parentCircuit=None)[source]

Bases: object

Container for the woven result of the Weaver

Attributes:
circuitName - the name of the circuit that was woven
partList - finished ordered list of parts in the design
moleculeList - list of all molecules in the design
subcircuitList - list of all subcircuits (itself weaver outputs) (??)

moleculeGraph()[source]
molecules()[source]
addCircuit(callingObject, circuit)[source]

Called by circuit or aspect to add a circuit as a sub-compartment in the current compartment

Args:
callingObject - the circuit or aspect calling this
circuit - The circuit to be added as a sub-compartment
addElemTypeAdvice(elem)[source]

Internal - adds type advice to a part

addPart(callingObject, part)[source]

Called by circuit or aspect to add a part in the execution flow

Args:
callingObject - the circuit or aspect calling this
part - The part supposed to be added
addReaction(callingObject, fromMoleculeList, toMoleculeList)[source]
constructMoleculeListAndAddTypeAdvice()[source]
createMolecule(callingObject, molecule)[source]

Indicates that a molecule is potentially present in the current compartment, i.e. it does not necessarily need to be created by a Coding Region, by an import, etc.

Args:
callingObject - the circuit or aspect calling this
molecule - the molecule to be present
exportMolecule(callingObject, molecule)[source]
Indicates that a molecule should be “exported” by the current compartment to
the outer compartment
Args:
callingObject - the circuit or aspect calling this
molecule - the molecule to be exported
getMoleculeObject(scope, moleculeClass, createIt=False)[source]
importMolecule(callingObject, molecule)[source]
Indicates that a molecule should be “imported” by the current compartment from
the outer compartment
Args:
callingObject - the circuit or aspect calling this
molecule - the molecule to be imported
output()[source]

Returns the weaverOutput Element

reactionFrom(callingObject, molecules)[source]

Used to add the left hand side of a molecule reaction to the design, called by either a circuit or aspect

Args:
callingObject - the circuit or aspect calling this
molecules - the list of molecules on the lhs of the reaction
reactionTo(callingObject, molecules)[source]

Used to add the right hand side of a molecule reaction to the design, called by either a circuit or aspect

Args:
callingObject - the circuit or aspect calling this
molecules - the list of molecules on the rhs of the reaction
readAspectsConstructAdviceLists()[source]

Internal - initializes aspects and constructs all advice lists

runAfterAdvice(callingObject, part, precedence=0)[source]

Internal - runs After Advice of a part

Args:
part - The part for which the advice matches
callingObject - the circuit or advice which added the part
precedence - Only run advice with a precedence greater or equal this
Used if replacement advice has been executed
runBeforeAndReplaceAdvice(callingObject, part)[source]

Internal - runs Before and Replace Advice of a part

Args:
part - The part for which the advice matches
callingObject - the circuit or advice which added the part
Returns:
“continue”
True - If part should still be added
False - If part has been replaced and remaining after advice executed
sortAdviceList()[source]

Internal - sorts the advice lists by precedence

synbioweaver.core.checkAndSetMolecule(molecule)[source]

checks if parameter is a class of type Molecule and returns it

Args:
molecule - A potential Molecule
Raises:
MoleculeValue - If molecule is not a class of type Molecule
Returns:
A class of type Molecule
synbioweaver.core.checkBaseClassesMatch(bases, typename)[source]

Recursively check if the name of the types in bases (or parents) are equal to typename

Args:
bases - A tuple of types
typename : str - A name of a type
Returns:
True if any of the names of types in bases or any of their parent bases equals typename,
False otherwise
synbioweaver.core.checkIfTypeReturnInstance(possibleType)[source]

if the parameter is a type, try to return an instance

Args:
possibleType - a parameter which may be an instance or a type
Raises:
PartInitializationError - if the parameter is a type which can not be constructed
Returns:
An instance of the type of possibleType
synbioweaver.core.declareNewMolecule(classname, *parents)[source]

Returns a new Molecule type and exports it to the caller’s namespace

Args:
classname: The name for the new type
*parents: 0 or more Molecule super classes
Returns:
The new Part type
Raises:
MoleculeValueError: If any parent is not a Molecule
InvalidSymbolNameError: If classname is not a valid name for a symbol
Warnings:
SymbolExistsWarning: If classname already exists in the namespace
synbioweaver.core.declareNewPart(classname, parent=<class 'synbioweaver.core.Part'>, moleculesBefore=[], moleculesAfter=[], regulatorInfoMap={})[source]

Returns a new Part type and exports it to the caller’s namespace

Args
classname : string
The name for the new type
parent : Part
super class for the new type
moleculesBefore : [Molecule]
optional, if the new Part type should have Molecule node(s) before it, e.g. regulators of a Promoter
moleculesAfter : [Molecule]
optional, if the new Part type should have Molecule node(s) after it, e.g. Proteins created by CodingRegions
regulatorInfoMap : Dictionary
optional, if a parent part needs additional regulator information.
Necessary for HybridPromoters, who need a map in the form of {Molecule: Boolean}
Returns
The new Part type
Raises
PartValueError -If the parent is not a Part
InvalidSymbolNameError - If classname is not a valid name for a symbol
Warnings
SymbolExistsWarning - If classname already exists in the namespace