Endy:Notebook/BioBrick Open Language Specification/Lesia and Adam Approach

Proposed Syntax
// This is a line comment.

/* This is a block comment.*/

// Properties must be defined before parts. The user can define custom properties: Property CustomProperty1(txt);  // CustomProperty1 is a text value Property CustomProperty2(txt[]); // CustomProperty2 is a list of text values Property CustomProperty3(num);  // CustomProperty3 is an number value Property CustomProperty4(num[]); // CustomProperty4 is a list of number values Property RelativeStrength(num);

// These properties are defined by default and do not need to be defined by the user in the program: Property Sequence(txt); Property ID(txt);

// The user can define custom parts by specifying a name and a list of property names: Component CustomPart1(CustomProperty1, CustomProperty2, CustomProperty3, CustomProperty4); Component CustomPart2(CustomProperty1);

/* Part definitions DO NOT construct parts, but rather specify which parts can be constructed. These parts are defined by default and do not need to be defined by user in the program: Component Promoter(ID, Sequence);  // Promoter Component RBS(ID, Sequence);       // Ribosome Binding Site Component FwdORF(ID, Sequence);    // Forward Open Reading Frame Component RvsORF(ID, Sequence);    // Reverse Open Reading Frame Component TranslTerm(ID, Sequence); // Translation Terminator Component RestrSite(ID, Sequence); // Restriction Site Component FwdPS(ID, Sequence);     // Forward Primer Site Component RvsPS(ID, Sequence);     // Reverse Primer Site

/* Once all parts and properties are defined, you can add properties to a part with the addProperties function. Promoter.addProperties(RelativeStrength); RBS.addProperties(RelativeStrength); CustomPart2.addProperties(CustomProperty2, CustomProperty3);

// Once a part is defined, an image binding must be made to associate the part with a particular file. Image CustomPart1(C:\images\CustomPart1.jpg); Image CustomPart2(C:\images\CustomPart2.gif);

// The following image bindings are made by default: Image Promoter(build/classes/pictopartsPlugin/partsImages/BOGL.Promoter.png); Image RBS(build/classes/pictopartsPlugin/partsImages/BOGL.Ribosome_Binding_Site.png); Image FwdORF(build/classes/pictopartsPlugin/partsImages/BOGL.Forward_Open_Reading_Frame.png); Image RvsORF(build/classes/pictopartsPlugin/partsImages/BOGL.Reverse_Open_Reading_Frame.png); Image TranslTerm(build/classes/pictopartsPlugin/partsImages/BOGL.Translation_Terminator.png); Image RestrSite(build/classes/pictopartsPlugin/partsImages/BOGL.Restriction_Site.png); Image FwdPS(build/classes/pictopartsPlugin/partsImages/BOGL.Forward_Primer_Site.png); Image RvsPS(build/classes/pictopartsPlugin/partsImages/BOGL.Reverse_Primer_Site.png);

/* Dot notation allows a part to be constructed without assigning a value to all properties. If dot notation is not used, all properties are assumed to be present and in the correct order in the constructor. Promoter p(.BioBrickID(BBa_123456), .Sequence(ATCG)); RBS rbs(BBa_654321, GCTA, 100);

// An empty part can be constructed, and values can be individually assigned later. FwdORF forf; forf.Sequence = CGAT;

// All constructed parts have inherent txt properties Name and Type. txt pName = p.Name; // pName contains p txt pType = p.Type; // pType contains Promoter

/* Composites are containers for groups of parts and/or other composites in a particular order. The same part or composite can be used multiple times in the same and different composites. All composites have inherent txt properties Name and Type, and a txt[] property Components. Composite c = {p, rbs, p}; txt cName = c.Name; // cName contains c txt cType = c.Type; // cType contains Composite txt[] cComponents = c.Components; // cComponents contains [p, rbs, p]

/* Composites have a set of all its components' properties. If the user asks for a txt property, the returned value is a concatenation of the property of all its components. If the user asks for an num property, the returned value is a sum of the property of all its components. If the the property is a list, the returned value is a single list with no sublists. If a component does not have the property or a value assigned to the property, it is simply skipped. txt cSequence = c.Sequence; // cSquence contains ATCGGCTAATCG

/* Some properties like BioBrickID do not make sense under these circumstances. After constructing a composite, setting a property overrides the above behavior. c.BioBrickID = myBioBrickID; txt cBBID = c.BioBrickID; // cBBID contains myBioBrickID and not BBa_123456BBa_654321BBa_123456

/* An empty composite can be constructed having the set of all properties defined. Values can then be individually assigned later. Composite c2 = {}; c2.Sequence = ATCGATCG;

/* Rules are defined in the format Rule ruleName(operand1, operator, operand2); Operands must specify: 1. A composite name if the rule is not applied to all composites. 2. A part types or part instance if the operator is a list operator or a value operator. 3. A non-list property if the operator is a value operator (one or both operands may be arbitrary values). List operators constrain the ordering and combining of parts and composites. The following are list operators: 1. BEFORE : operand1 appears before operand2 on composite(s) 2. AFTER  : operand1 appears after operand2 on composite(s) 3. WITH   : operand1 appears with operand2 on composite(s) 4. NOTWITH : operand1 does not appear with operand2 on composite(s) 5. NEXTTO : operand1 is adjacent to operand2 on composite(s) Value operators behave differently whether values are of type txt or num. Operating on txt compares dictionary position. If one or both of the operands do not have the property or a value for the property, the rule is still considered to be satisfied when asserted. The following are value operators: 1. == : equal to   2. >= : greater than or equal to     3. <= : less than or equal to    4. >  : greater than 5. < : less than 6. != : not equal to Rule r1(Promoter BEFORE RBS); // All promoters are before all ribosome binding sites on all composites Rule r2(p BEFORE rbs); // All instances of p are before all instances of rbs on all composites Rule r3(c.Promoter BEFORE c.RBS); // All promoters are before all ribosome binding sites on c Rule r4(c.p BEFORE c.rbs); // All instances of p are before all instances of rbs on c Rule r5(Promoter WITH RBS); // All composites that contain a promoter also contain a ribosome binding site Rule r6(p WITH rbs); // All composites that contain p also contain rbs Rule r7(c.Promoter WITH c.RBS); // c contains a promoter and a ribosome binding site Rule r8(c.p WITH c.rbs); // c contains p and rbs Rule r9(p.RelativeStrength > rbs.RelativeStrength); // The relative strength of p is greater than rbs Rule r10(Promoter.RelativeStrength > RBS.RelativeStrength); // The relative strength of all promoters is greater than all ribosome binding sites Rule r11(p.RelativeStrength > Promoter.RelativeStrength); // The relative strength of p is greater than all other promoters

/* Defining rules DO NOT enforce them. Asserting a combination of rules enforces the validity of the combination and triggers an error if there is an offense. Noting a combination of rules detects any offenses, but does not trigger an error. Optional messages can be added. The following operators can be used: 1. AND : logical and 2. OR : logical or   3. NOT : logical not Assert ((r1 AND r2) OR r3); Assert (NOT(r4)); Note (r5);

/* Notes: 1. All names, whether it be property, part, composite, or rule, must be unique. 2. The following operations are supported for values and lists: 1. = : assignment operator 2. + : addition for num, concatenation for txt, append for txt[] and num[] 3. - : subtraction for num 4. * : multiplication for num 5. / : division for num 3. All variables are global in scope. 4. Code is read sequentially.

Scope of variables All variables are global, that is each variable needs to be unique when defined. This has the advantage for non CS users not to worry about scope.

Sample Code
/*-- BBa_K137114 - AHL induced production of RcsA --*/ FwdPS fps1; RestrSite rs1; RestrSite rs2; Promoter p1; RBS rbs1(.RelativeStrength(100)); FwdORF forf1; TranslTerm tt1; TranslTerm tt2; Promoter p2; RBS rbs2(.RelativeStrength(100)); FwdORF forf2; TranslTerm tt3; TranslTerm tt4; RestrSite rs3; RestrSite rs4; RvsPS rps1; Composite BBa_K137114 = {fps1, rs1, rs2, p1, rbs1, forf1, tt1, tt2, p2, rbs2, forf2, tt3, tt4, rs1, rs2, rps1}; BBa_K137114.BioBrickID = BBa_K137114;

/*-- BBa_K106019 - LexA-Sir2 under a strong constitutive promoter --*/ FwdPS fps2; Promoter p3; FwdORF forf3; FwdORF forf4; TranslTerm tt5; TranslTerm tt6; RvsPS rps2; Composite BBa_K106019 = {fps2, p3, forf3, forf4, tt5, tt6, rps2}; BBa_K106019.BioBrickID = BBa_K106019;

/*- BBa_K098988 - temperature sensitive cI inducible system with GFP reporter and high promoter -*/ FwdPS fps3; RestrSite rs5; RestrSite rs6; Promoter p4(.RelativeStrength(10)); RBS rbs3(.RelativeStrength(100)); FwdORF forf5; TranslTerm tt7; TranslTerm tt8; Promoter p5; RBS rbs4(.RelativeStrength(30)); FwdORF forf6; TranslTerm tt9; TranslTerm tt10; RestrSite rs7; RestrSite rs8; RvsPS rps3; Composite BBa_K098988 = {fps3, rs5, rs6, p4, rbs3, forf5, tt7, tt8, p5, rbs4, forf6, tt9, tt10, rs7, rs8, rps3}; BBa_K098988.BioBrickID = BBa_K098988;