Пример #1
0
del ctx.minimizations
del ctx.edit.minimizations
del ctx.gen_sphere
del ctx.params.gen_sphere
del ctx.links.params_gen_sphere
del ctx.links.code_gen_sphere


ctx.texture_coords = cell("array").set_store("GL")
ctx.triangle_texture_coords = cell("array").set_store("GL")


#for now, load-ply must be a reactor, because it has multiple outputs
#TODO: make it a transformer in a future version of seamless
c = ctx.params.load_ply = cell(("cson", "seamless", "reactor_params"))
ctx.links.params_load_ply = link(c, ".", "params-load-ply.cson")
rc = ctx.load_ply = reactor(c)
c = ctx.code.load_ply = cell(("text", "code", "python"))
ctx.links.code_load_ply = link(c, ".", "cell-load-ply2.py")
rc.code_start.cell().set("")
c.connect(rc.code_update)
rc.code_stop.cell().set("")

ctx.load_ply.coordinates.connect(ctx.coordinates_prescale)
ctx.load_ply.normals.connect(ctx.normals)
ctx.load_ply.edges.connect(ctx.edges)
ctx.load_ply.triangle_indices.connect(ctx.triangle_indices)
ctx.load_ply.triangle_coordinates.connect(ctx.triangle_coordinates_prescale)
ctx.load_ply.triangle_normals.connect(ctx.triangle_normals)
ctx.load_ply.texture_coords.connect(ctx.texture_coords)
ctx.load_ply.triangle_texture_coords.connect(ctx.triangle_texture_coords)
Пример #2
0
del ctx.subdivisions
del ctx.edit.subdivisions
del ctx.minimizations
del ctx.edit.minimizations
del ctx.gen_sphere
del ctx.params.gen_sphere
del ctx.links.params_gen_sphere
del ctx.links.code_gen_sphere

ctx.texture_coords = cell("array").set_store("GL")
ctx.triangle_texture_coords = cell("array").set_store("GL")

#for now, load-ply must be a reactor, because it has multiple outputs
#TODO: make it a transformer in a future version of seamless
c = ctx.params.load_ply = cell(("cson", "seamless", "reactor_params"))
ctx.links.params_load_ply = link(c, ".", "params-load-ply.cson")
rc = ctx.load_ply = reactor(c)
c = ctx.code.load_ply = cell(("text", "code", "python"))
ctx.links.code_load_ply = link(c, ".", "cell-load-ply2.py")
rc.code_start.cell().set("")
c.connect(rc.code_update)
rc.code_stop.cell().set("")

ctx.load_ply.coordinates.connect(ctx.coordinates_prescale)
ctx.load_ply.normals.connect(ctx.normals)
ctx.load_ply.edges.connect(ctx.edges)
ctx.load_ply.triangle_indices.connect(ctx.triangle_indices)
ctx.load_ply.triangle_coordinates.connect(ctx.triangle_coordinates_prescale)
ctx.load_ply.triangle_normals.connect(ctx.triangle_normals)
ctx.load_ply.texture_coords.connect(ctx.texture_coords)
ctx.load_ply.triangle_texture_coords.connect(ctx.triangle_texture_coords)
Пример #3
0
from seamless import cell, pythoncell, context, reactor, transformer
from seamless.silk import Silk
import seamless.lib
from seamless.lib.gui.basic_editor import edit
from seamless.lib.gui.basic_display import display
from seamless.lib import link
from seamless.lib.gui.gl import glprogram

ctx = context()
file_dominant = False

# Vertexdata Silk model
ctx.silk_vertexdata = cell(("text", "code", "silk"))
ctx.link_silk_vertexdata = link(
    ctx.silk_vertexdata,
    ".", "vertexdata.silk",
    file_dominant=file_dominant
)
ctx.registrar.silk.register(ctx.silk_vertexdata)

# Shaders
ctx.vert_shader = cell(("text", "code", "vertexshader"))
ctx.frag_shader = cell(("text", "code", "fragmentshader"))
ctx.link_vert_shader = link(ctx.vert_shader, ".", "vert_shader.glsl",
    file_dominant=file_dominant)
ctx.link_frag_shader = link(ctx.frag_shader, ".", "frag_shader.glsl",
    file_dominant=file_dominant)

# Program template
ctx.program_template = cell("cson")
ctx.link_program_template = link(ctx.program_template,
Пример #4
0
del ctx.minimizations
del ctx.edit.minimizations
del ctx.gen_sphere
del ctx.params.gen_sphere
del ctx.links.params_gen_sphere
del ctx.links.code_gen_sphere


ctx.texture_coords = cell("array").set_store("GL")
ctx.triangle_texture_coords = cell("array").set_store("GL")


#for now, load-ply must be a reactor, because it has multiple outputs
#TODO: make it a transformer in a future version of seamless
c = ctx.params.load_ply = cell(("cson", "seamless", "reactor_params"))
ctx.links.params_load_ply = link(c, ".", "params-load-ply.cson")
rc = ctx.load_ply = reactor(c)
c = ctx.code.load_ply = cell(("text", "code", "python"))
ctx.links.code_load_ply = link(c, ".", "cell-load-ply2.py")
rc.code_start.cell().set("")
c.connect(rc.code_update)
rc.code_stop.cell().set("")

ctx.load_ply.coordinates.connect(ctx.coordinates_prescale)
ctx.load_ply.normals.connect(ctx.normals)
ctx.load_ply.edges.connect(ctx.edges)
ctx.load_ply.triangle_indices.connect(ctx.triangle_indices)
ctx.load_ply.triangle_coordinates.connect(ctx.triangle_coordinates_prescale)
ctx.load_ply.triangle_normals.connect(ctx.triangle_normals)
ctx.load_ply.texture_coords.connect(ctx.texture_coords)
ctx.load_ply.triangle_texture_coords.connect(ctx.triangle_texture_coords)
Пример #5
0
from seamless.lib.gui.gl import glprogram, glwindow

import numpy as np
from scipy.spatial.distance import cdist

ctx = context()
ctx.params = context()
ctx.links = context()
ctx.code = context()

file_dominant = True

#for now, gen_sphere must be a reactor, because it has multiple outputs
#TODO: make it a transformer in a future version of seamless
c = ctx.params.gen_sphere = cell(("cson", "seamless", "reactor_params"))
ctx.links.params_gen_sphere = link(c, ".", "params-gen-sphere.cson", file_dominant=file_dominant)
rc = ctx.gen_sphere = reactor(c)
c = ctx.code.gen_sphere = cell(("text", "code", "python"))
ctx.links.code_gen_sphere = link(c, ".", "cell-gen-sphere.py", file_dominant=file_dominant)
rc.code_start.cell().set("")
c.connect(rc.code_update)
rc.code_stop.cell().set("")

do_scale_params = {
    "input":{"pin": "input", "dtype": "array"},
    "scale":{"pin": "input", "dtype": "float"},
    "output":{"pin": "output", "dtype": "array"}
}
ctx.subdivisions = cell("int").set(3)
ctx.minimizations = cell("int").set(20)
ctx.scale = cell("float").set(3.5)
Пример #6
0
from seamless import context, cell, transformer, reactor
from seamless.lib import edit, display, link
from seamless.lib.gui.gl import glprogram, glwindow

import numpy as np

ctx = context()
ctx.params = context()
ctx.links = context()
ctx.code = context()

#for now, gen_sphere must be a reactor, because it has multiple outputs
#TODO: make it a transformer in a future version of seamless
c = ctx.params.gen_sphere = cell(("cson", "seamless", "reactor_params"))
ctx.links.params_gen_sphere = link(c, ".", "params-gen-sphere.cson")
rc = ctx.gen_sphere = reactor(c)
c = ctx.code.gen_sphere = cell(("text", "code", "python"))
ctx.links.code_gen_sphere = link(c, ".", "cell-gen-sphere.py")
rc.code_start.cell().set("")
c.connect(rc.code_update)
rc.code_stop.cell().set("")

ctx.subdivisions = cell("int").set(3)
ctx.minimizations = cell("int").set(20)
ctx.coordinates = cell("array").set_store("GL")
ctx.normals = cell("array").set_store("GL")
ctx.edges = cell("array").set_store("GL")
ctx.triangle_indices = cell("array").set_store("GL")
ctx.triangle_normals = cell("array").set_store("GL")
ctx.triangle_coordinates = cell("array").set_store("GL")
Пример #7
0
import seamless
from seamless import context, cell
from seamless.lib import link, browse
from seamless.lib.plotly import plotly

ctx = context()
ctx.plotly = plotly(dynamic_html=True, mode="nxy")

ctx.data = cell("text")
ctx.link_data = link(ctx.data, ".", "data.csv")
ctx.layout = cell("cson")
ctx.link_layout = link(ctx.layout, ".", "layout.cson")
ctx.attrib = cell("cson")
ctx.link_attrib = link(ctx.attrib, ".", "attrib.cson")

ctx.data.connect(ctx.plotly.data)
ctx.attrib.connect(ctx.plotly.attrib)
ctx.layout.connect(ctx.plotly.layout)

ctx.html = cell(("text", "html"))
ctx.plotly.html.connect(ctx.html)
ctx.browser_static = browse(ctx.html, "Static HTML")

ctx.dynamic_html = cell(("text", "html"))
ctx.plotly.dynamic_html.connect(ctx.dynamic_html)
ctx.browser_dynamic = browse(ctx.dynamic_html, "Dynamic HTML")
Пример #8
0
from seamless import context, cell, export, transformer
from seamless.lib import edit, display, link, browse
from seamless.slash import slash0
import sys

#Stage 1
# Concatenate PDBs

ctx = context()
ctx.attract = cell(("text", "code", "slash-0"))
# !touch "attract.slash"
ctx.attract.fromfile("attract.slash")
link(ctx.attract)
ctx.attract.set("""
@input_doc pdbA
@input_doc pdbB
@intern pdb
@intern result

cat !pdbA !pdbB > pdb
cat !pdb > result

@export pdb
@export result
""")
ctx.slash = slash0(ctx.attract)
export(ctx.slash.pdbA)
export(ctx.slash.pdbB)
ctx.pdbA.fromfile("unbound/1AVXA.pdb")
ctx.pdbB.fromfile("unbound/1AVXB.pdb")
export(ctx.slash.pdb)
Пример #9
0
from seamless import context, cell, export, transformer
from seamless.lib import edit, display, link, browse
from seamless.slash import slash0
import sys

#Stage 1
# Concatenate PDBs

ctx = context()
ctx.attract = cell(("text", "code", "slash-0"))
# !touch "attract.slash"
ctx.attract.fromfile("attract.slash")
link(ctx.attract)
ctx.attract.set("""
@input_doc pdbA
@input_doc pdbB
@intern pdb
@intern result

cat !pdbA !pdbB > pdb
cat !pdb > result

@export pdb
@export result
""")
ctx.slash = slash0(ctx.attract)
export(ctx.slash.pdbA)
export(ctx.slash.pdbB)
ctx.pdbA.fromfile("unbound/1AVXA.pdb")
ctx.pdbB.fromfile("unbound/1AVXB.pdb")
export(ctx.slash.pdb)
Пример #10
0
from seamless import context, cell, transformer, reactor
from seamless.lib import edit, display, link
from seamless.lib.gui.gl import glprogram, glwindow

import numpy as np

ctx = context()
ctx.params = context()
ctx.links = context()
ctx.code = context()

#for now, gen_sphere must be a reactor, because it has multiple outputs
#TODO: make it a transformer in a future version of seamless
c = ctx.params.gen_sphere = cell(("cson", "seamless", "reactor_params"))
ctx.links.params_gen_sphere = link(c, ".", "params-gen-sphere.cson")
rc = ctx.gen_sphere = reactor(c)
c = ctx.code.gen_sphere = cell(("text", "code", "python"))
ctx.links.code_gen_sphere = link(c, ".", "cell-gen-sphere.py")
rc.code_start.cell().set("")
c.connect(rc.code_update)
rc.code_stop.cell().set("")

ctx.subdivisions = cell("int").set(3)
ctx.minimizations = cell("int").set(20)
ctx.coordinates = cell("array").set_store("GL")
ctx.normals = cell("array").set_store("GL")
ctx.edges = cell("array").set_store("GL")
ctx.triangle_indices = cell("array").set_store("GL")
ctx.triangle_normals = cell("array").set_store("GL")
ctx.triangle_coordinates = cell("array").set_store("GL")
Пример #11
0
""")
ctx.pre_code.connect(gen_code.in_code)
ctx.code = gen_code.out_code.cell()

ctx.printer = transformer({"value": {"pin": "input", "dtype": "int"}})
ctx.printer.code.set("print('VALUE', value); return")

ctx.equilibrate()
p = ctx.slash0 = slash0(ctx.code)
ctx.value = cell("int")
p.value.connect(ctx.value)
ctx.value.connect(ctx.printer.value)
ctx.pulse_py = cell(("text", "code", "python"))
ctx.pulse_py.connect(p.pulse_py)
ctx.pulses = cell("int").set(3)
ctx.pulses.connect(p.pulses)
ctx.delay = cell("float").set(0.1)
ctx.delay.connect(p.delay)
link(ctx.pulse_py, ".", "pulse.py")
ctx.equilibrate()
print("... DONE", ctx.value.value)
gen_code.monitor.set(True)
ctx.equilibrate()
print("... DONE", ctx.value.value)

ctx.delay.set(0.5)
ctx.pulses.set(10)
edit(ctx.pulses, "Pulses")
edit(ctx.delay, "Delay")
display(ctx.value, "Value")
Пример #12
0
ctx = seamless.fromfile("test-sphere.seamless")

del ctx.subdivisions
del ctx.edit.subdivisions
del ctx.minimizations
del ctx.edit.minimizations
del ctx.gen_sphere
del ctx.params.gen_sphere
del ctx.links.params_gen_sphere
del ctx.links.code_gen_sphere

#for now, load-ply must be a reactor, because it has multiple outputs
#TODO: make it a transformer in a future version of seamless
c = ctx.params.load_ply = cell(("cson", "seamless", "reactor_params"))
ctx.links.params_load_ply = link(c, ".", "params-load-ply.cson")
rc = ctx.load_ply = reactor(c)
c = ctx.code.load_ply = cell(("text", "code", "python"))
ctx.links.code_load_ply = link(c, ".", "cell-load-ply.py")
rc.code_start.cell().set("")
c.connect(rc.code_update)
rc.code_stop.cell().set("")

ctx.load_ply.coordinates.connect(ctx.coordinates_prescale)
ctx.load_ply.normals.connect(ctx.normals)
ctx.load_ply.edges.connect(ctx.edges)
ctx.load_ply.triangle_indices.connect(ctx.triangle_indices)
ctx.load_ply.triangle_coordinates.connect(ctx.triangle_coordinates_prescale)
ctx.load_ply.triangle_normals.connect(ctx.triangle_normals)
ctx.filename = cell("str")
ctx.filename.connect(ctx.load_ply.filename)
Пример #13
0
import os, sys
get_ipython().system('./load-test.sh')

#Stage 1: display test dataset
from seamless import context, cell, reactor, transformer, export
from seamless.lib import link, browse
from seamless.lib.plotly import plotly
ctx = context()
ctx.plotly = plotly(dynamic_html=True)
ctx.plotly.values.width.set(800)
ctx.plotly.values.height.set(600)
c = export(ctx.plotly.data, "cson").fromfile("data.cson")
link(c)
c = export(ctx.plotly.attrib, "cson").fromfile("attrib.cson")
link(c)
c = export(ctx.plotly.layout, "cson").fromfile("layout.cson")
link(c)
c = export(ctx.plotly.html)
link(c, ".", "plotly.html")
browse(c, "Docking clusters")
c = export(ctx.plotly.dynamic_html)
link(c, ".", "plotly-dynamic.html")
browse(c, "Docking clusters (dynamic)")

#Stage 2: load real dataset
get_ipython().system('./load-real.sh')

#Stage 2a: perform (bound) docking,
# (re)generating real dataset in cells data2, attrib2
import numpy as np
ctx.attract = cell(("text", "code", "slash-0"))
Пример #14
0
import os, sys
get_ipython().system('./load-test.sh')

#Stage 1: display test dataset
from seamless import context, cell, reactor, transformer, export
from seamless.lib import link, browse
from seamless.lib.plotly import plotly
ctx = context()
ctx.plotly = plotly(dynamic_html=True)
ctx.plotly.values.width.set(800)
ctx.plotly.values.height.set(600)
c = export(ctx.plotly.data, "cson").fromfile("data.cson")
link(c)
c = export(ctx.plotly.attrib, "cson").fromfile("attrib.cson")
link(c)
c = export(ctx.plotly.layout, "cson").fromfile("layout.cson")
link(c)
c = export(ctx.plotly.html)
link(c, ".", "plotly.html")
browse(c, "Docking clusters")
c = export(ctx.plotly.dynamic_html)
link(c, ".", "plotly-dynamic.html")
browse(c, "Docking clusters (dynamic)")

#Stage 2: load real dataset
get_ipython().system('./load-real.sh')

#Stage 2a: perform (bound) docking,
# (re)generating real dataset in cells data2, attrib2
import numpy as np
ctx.attract = cell(("text", "code", "slash-0"))
Пример #15
0
ctx.pre_code.connect(gen_code.in_code)
ctx.code = gen_code.out_code.cell()

ctx.printer = transformer({"value": {"pin":"input", "dtype": "int"}})
ctx.printer.code.set("print('VALUE', value); return")

ctx.equilibrate()
p = ctx.slash0 = slash0(ctx.code)
ctx.value = cell("int")
p.value.connect(ctx.value)
ctx.value.connect(ctx.printer.value)
ctx.pulse_py = cell(("text", "code", "python"))
ctx.pulse_py.connect(p.pulse_py)
ctx.pulses = cell("int").set(3)
ctx.pulses.connect(p.pulses)
ctx.delay = cell("float").set(0.1)
ctx.delay.connect(p.delay)
link(ctx.pulse_py, ".", "pulse.py")
ctx.equilibrate()
print("... DONE", ctx.value.value)
gen_code.monitor.set(True)
ctx.equilibrate()
print("... DONE", ctx.value.value)


ctx.delay.set(0.5)
ctx.pulses.set(10)
edit(ctx.pulses, "Pulses")
edit(ctx.delay, "Delay")
display(ctx.value, "Value")
Пример #16
0
del ctx.subdivisions
del ctx.edit.subdivisions
del ctx.minimizations
del ctx.edit.minimizations
del ctx.gen_sphere
del ctx.params.gen_sphere
del ctx.links.params_gen_sphere
del ctx.links.code_gen_sphere

ctx.texture_coords = cell("array").set_store("GL")
ctx.triangle_texture_coords = cell("array").set_store("GL")

#for now, load-ply must be a reactor, because it has multiple outputs
#TODO: make it a transformer in a future version of seamless
c = ctx.params.load_ply = cell(("cson", "seamless", "reactor_params"))
ctx.links.params_load_ply = link(c, ".", "params-load-ply.cson")
rc = ctx.load_ply = reactor(c)
c = ctx.code.load_ply = cell(("text", "code", "python"))
ctx.links.code_load_ply = link(c, ".", "cell-load-ply2.py")
rc.code_start.cell().set("")
c.connect(rc.code_update)
rc.code_stop.cell().set("")

ctx.load_ply.coordinates.connect(ctx.coordinates_prescale)
ctx.load_ply.normals.connect(ctx.normals)
ctx.load_ply.edges.connect(ctx.edges)
ctx.load_ply.triangle_indices.connect(ctx.triangle_indices)
ctx.load_ply.triangle_coordinates.connect(ctx.triangle_coordinates_prescale)
ctx.load_ply.triangle_normals.connect(ctx.triangle_normals)
ctx.load_ply.texture_coords.connect(ctx.texture_coords)
ctx.load_ply.triangle_texture_coords.connect(ctx.triangle_texture_coords)
Пример #17
0
from seamless import cell, pythoncell, context, reactor, transformer
from seamless.silk import Silk
import seamless.lib
from seamless.lib.gui.basic_editor import edit
from seamless.lib.gui.basic_display import display
from seamless.lib import link
from seamless.lib.gui.gl import glprogram

ctx = context()
file_dominant = False

# Vertexdata Silk model
ctx.silk_vertexdata = cell(("text", "code", "silk"))
ctx.link_silk_vertexdata = link(ctx.silk_vertexdata,
                                ".",
                                "vertexdata.silk",
                                file_dominant=file_dominant)
ctx.registrar.silk.register(ctx.silk_vertexdata)

# Shaders
ctx.vert_shader = cell(("text", "code", "vertexshader"))
ctx.frag_shader = cell(("text", "code", "fragmentshader"))
ctx.link_vert_shader = link(ctx.vert_shader,
                            ".",
                            "vert_shader.glsl",
                            file_dominant=file_dominant)
ctx.link_frag_shader = link(ctx.frag_shader,
                            ".",
                            "frag_shader.glsl",
                            file_dominant=file_dominant)