Skip to content

Instantly share code, notes, and snippets.

@maxkrieger
Created Mar 25, 2021
Embed
What would you like to do?
Synapse Act 1.5: a trio from https://penrose.ink
type Synapse
type Channel
type Vesicle
type Glutamate
type Calcium
type NMDAR
type AMPAR
predicate InsideVesicle : Glutamate g * Vesicle v
predicate VesicleClosed : Vesicle v
predicate Initial : Synapse s
predicate IsDepolarized : Synapse s
predicate BindAMPA : Glutamate g * AMPAR a
forall Synapse A {
A.axon = Rectangle {
center: (0, 300)
w: 800
h: 100
strokeWidth: 0
color: hsva(155, 51, 100, 1)
}
A.axon.x = 0
A.axonText = Text {
string: "\text{Axon}"
}
A.dendrite = Rectangle {
center: (0, -100)
w: 800
h: 100
strokeWidth: 0
color: hsva(185, 51, 100, 1)
}
A.dendriteText = Text {
string: "\text{Dendrite}"
}
encourage centerLabel(A.axon, A.axonText)
layer A.axonText above A.axon
encourage centerLabel(A.dendrite, A.dendriteText)
layer A.dendriteText above A.dendrite
}
forall AMPAR A; Synapse S {
A.left = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(291, 75, 100, 1)
}
A.right = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(291, 75, 100, 1)
}
encourage equal(A.left.center[1], -50)
encourage equal(A.right.center[1], -50)
layer A.left above S.dendrite
layer A.right above S.dendrite
encourage nearPt(A.right, A.left.center[0] + 30, A.left.center[1])
A.text = Text {
center: A.left.center
string: A.label
}
layer A.text above A.left
}
forall NMDAR N; Synapse S {
N.left = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(42, 75, 100, 1)
}
N.right = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(42, 75, 100, 1)
}
N.magnesium = Circle {
r: 10
strokeWidth: 0
color: hsva(212, 86, 60, 1)
}
encourage equal(N.left.center[1], -50)
encourage equal(N.right.center[1], -50)
encourage equal(N.magnesium.center[0], N.left.center[0] + 15)
encourage equal(N.magnesium.center[1], -50)
layer N.left above S.dendrite
layer N.right above S.dendrite
encourage nearPt(N.right, N.left.center[0] + 30, N.left.center[1])
N.text = Text {
center: N.left.center
string: N.label
}
layer N.text above N.left
}
forall NMDAR N; Synapse S
where IsDepolarized(S) {
override N.magnesium.color = hsva(0,0,0, 0)
}
forall Channel C; Synapse S {
C.left = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(0, 0, 50, 1)
}
C.right = Rectangle {
w: 10
h: 50
strokeWidth: 0
color: hsva(0, 0, 50, 1)
}
encourage equal(C.left.center[1], 250)
encourage equal(C.right.center[1], 250)
layer C.left above S.axon
layer C.right above S.axon
encourage nearPt(C.right, C.left.center[0] + 30, C.left.center[1])
C.text = Text {
center: C.left.center
string: C.label
}
layer C.text above C.left
}
forall Calcium C; Synapse S {
C.icon = Circle {
r: 10
strokeWidth: 0
color: hsva(0, 0, 50, 1)
}
layer C.icon above S.axon
layer C.icon above S.dendrite
}
forall Glutamate C; Synapse S {
C.icon = Circle {
r: 10
strokeWidth: 0
color: hsva(41, 100, 100, 1)
}
layer C.icon above S.axon
layer C.icon above S.dendrite
}
forall Glutamate G; Glutamate C {
-- encourage repel(G.icon, C.icon, 0.2)
}
forall Vesicle V; Synapse S {
V.icon = Circle {
r: 40
color: hsva(0,0,0,0)
strokeColor: hsva(0,20,0,1)
strokeWidth: 1
}
layer V.icon above S.axon
encourage equal(V.icon.center[1], 250)
V.blocker = Rectangle {
center: (V.icon.center[0], V.icon.center[1] - 35)
w: 50
h: 20
color: hsva(0,0,100,1)
strokeWidth: 0
}
layer V.blocker above V.icon
V.text = Text {
center: V.blocker.center
string: V.label
}
layer V.text above V.blocker
}
forall Vesicle V where VesicleClosed(V) {
encourage equal(V.icon.center[1], 350)
override V.blocker.color = hsva(100,0,0,0)
}
forall Vesicle V; Glutamate G
where InsideVesicle(G, V); VesicleClosed(V) {
ensure contains(V.icon, G.icon)
}
forall Calcium C; Channel Ch; NMDAR N; Synapse S
where Initial(S) {
encourage above(C.icon, Ch.left)
}
forall Calcium C; NMDAR N; Synapse S
where IsDepolarized(S) {
encourage below(C.icon, N.left)
}
forall Synapse S
where IsDepolarized(S) {
S.arrow = Arrow {
start: (0, 200)
end: (0, 0)
thickness: 3.0
color: hsva(0, 0, 80, 1)
}
S.depText = Text {
string: "\text{depolarized}"
center: (70, 100)
}
}
forall Synapse S
where Initial(S) {
S.arrow = Arrow {
end: (0, 200)
start: (0, 0)
thickness: 3.0
color: hsva(0, 0, 80, 1)
}
S.depText = Text {
string: "\text{hyperpolarized}"
center: (70, 100)
}
}
forall AMPAR A; Glutamate G
where BindAMPA(G, A) {
override G.icon.center = (A.right.center[0], A.right.center[1] + 20)
layer G.icon above A.right
}
AutoLabel All
-- ACT 1 --
Synapse S
Initial(S)
Vesicle V1, V2
Glutamate G1, G2, G3
InsideVesicle(G1, V1)
InsideVesicle(G2, V2)
InsideVesicle(G3, V2)
VesicleClosed(V1)
VesicleClosed(V2)
NMDAR N1
AMPAR A1, A2
Channel Ch
{"authorship":{"madeBy":"maxkrieger","name":"Synapse Act 1.5","avatar":"https://avatars.githubusercontent.com/u/2660634?v=4"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment