Monday, March 7, 2011

Sample Python Code for Creating a Little Network


cds4 = tc_insert("cds4","Coding")
p3 = tc_insert("p3","Inducible Promoter")
cds3 = tc_insert("cds3","Coding")
t3 = tc_insert("t3","Terminator")
p2 = tc_insert("p2","Inducible Promoter")
cds2 = tc_insert("cds2","Coding")
t2 = tc_insert("t2","Terminator")

listOfParts = [cds4, p3, cds3, t3, p2, cds2, t2]
tcArray = toTC(listOfParts) #convert Python data structure to

tc_alignParts(tcArray)

#production of P4
P4 = tc_insert("P4", "Transcription Factor")
x = tc_getX(cds4)
y = tc_getY(cds4)
tc_setPos(P4, x, y - 200)

listToConnect = [cds4, P4]
tcArray = toTC(listToConnect)
R1 = tc_insertConnection(tcArray, "R1", "Protein Production")

#P4 regulates p3

listToConnect = [P4, p3]
tcArray = toTC(listToConnect)
R2 = tc_insertConnection(tcArray, "R2", "Transcription Activation")

#production of P3
P3 = tc_insert("P3", "Transcription Factor")
x = tc_getX(cds3)
y = tc_getY(cds3)
tc_setPos(P3, x, y - 200)

listToConnect = [cds3, P3]
tcArray = toTC(listToConnect)
R3 = tc_insertConnection(tcArray, "R3", "Protein Production")

#P3 regulates p2

listToConnect = [P3, p2]
tcArray = toTC(listToConnect)
R4 = tc_insertConnection(tcArray, "R4", "Transcription Activation")

#production of GFP
GFP = tc_insert("GFP", "Reporter")
x = tc_getX(cds2)
y = tc_getY(cds2)
tc_setPos(GFP, x, y - 200)

listToConnect = [cds2, GFP]
tcArray = toTC(listToConnect)
R5 = tc_insertConnection(tcArray, "R5", "Protein Production")

No comments: