simonduerr commited on
Commit
e965642
1 Parent(s): 1ac55cd

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -31,20 +31,42 @@ def predict(input):
31
  return input
32
 
33
  with gr.Blocks() as demo:
 
34
  inp=CofoldingInput(label="Input")
35
 
36
- # preinput = {"chains": [
37
- # {
38
- # "class": "DNA",
39
- # "sequence": "ATGCGT",
40
- # "chain": "A"
41
- # }
42
- # ], "covMods":[]
43
- # }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  # inp2=CofoldingInput(preinput, label="Input prefilled")
45
  btn = gr.Button("Submit")
46
  out = gr.HTML()
47
 
 
 
48
  btn.click(predict, inputs=[inp], outputs=[out])
49
 
50
  if __name__ == "__main__":
@@ -292,4 +314,5 @@ The code snippet below is accurate in cases where the component is used as both
292
  value: Unknown
293
  ) -> dict | None:
294
  return value
295
- ```
 
 
31
  return input
32
 
33
  with gr.Blocks() as demo:
34
+ jobname = gr.Textbox(label="Job Name")
35
  inp=CofoldingInput(label="Input")
36
 
37
+ preinput = {"chains": [
38
+ {
39
+ "class": "DNA",
40
+ "sequence": "ATGCGT",
41
+ "chain": "A"
42
+ },
43
+ {
44
+ "class": "protein",
45
+ "sequence": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
46
+ "chain": "B"
47
+ },
48
+ {
49
+ "class": "ligand",
50
+ "name": "ZN",
51
+ "smiles": "",
52
+ "sdf": "",
53
+ "chain": "C"
54
+ },
55
+ {
56
+ "class": "ligand",
57
+ "smiles": "CCCCCCCCCCCCCCCCCCCC",
58
+ "name": "",
59
+ "sdf": "",
60
+ "chain": "D"
61
+ }
62
+ ], "covMods":[]
63
+ }
64
  # inp2=CofoldingInput(preinput, label="Input prefilled")
65
  btn = gr.Button("Submit")
66
  out = gr.HTML()
67
 
68
+ gr.Examples([["test",preinput]], inputs=[jobname,inp])
69
+
70
  btn.click(predict, inputs=[inp], outputs=[out])
71
 
72
  if __name__ == "__main__":
 
314
  value: Unknown
315
  ) -> dict | None:
316
  return value
317
+ ```
318
+
app.py CHANGED
@@ -10,21 +10,43 @@ def predict(input):
10
  return input
11
 
12
  with gr.Blocks() as demo:
 
13
  inp=CofoldingInput(label="Input")
14
 
15
- # preinput = {"chains": [
16
- # {
17
- # "class": "DNA",
18
- # "sequence": "ATGCGT",
19
- # "chain": "A"
20
- # }
21
- # ], "covMods":[]
22
- # }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  # inp2=CofoldingInput(preinput, label="Input prefilled")
24
  btn = gr.Button("Submit")
25
  out = gr.HTML()
26
 
 
 
27
  btn.click(predict, inputs=[inp], outputs=[out])
28
 
29
  if __name__ == "__main__":
30
- demo.launch(ssr_mode=False)
 
10
  return input
11
 
12
  with gr.Blocks() as demo:
13
+ jobname = gr.Textbox(label="Job Name")
14
  inp=CofoldingInput(label="Input")
15
 
16
+ preinput = {"chains": [
17
+ {
18
+ "class": "DNA",
19
+ "sequence": "ATGCGT",
20
+ "chain": "A"
21
+ },
22
+ {
23
+ "class": "protein",
24
+ "sequence": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
25
+ "chain": "B"
26
+ },
27
+ {
28
+ "class": "ligand",
29
+ "name": "ZN",
30
+ "smiles": "",
31
+ "sdf": "",
32
+ "chain": "C"
33
+ },
34
+ {
35
+ "class": "ligand",
36
+ "smiles": "CCCCCCCCCCCCCCCCCCCC",
37
+ "name": "",
38
+ "sdf": "",
39
+ "chain": "D"
40
+ }
41
+ ], "covMods":[]
42
+ }
43
  # inp2=CofoldingInput(preinput, label="Input prefilled")
44
  btn = gr.Button("Submit")
45
  out = gr.HTML()
46
 
47
+ gr.Examples([["test",preinput]], inputs=[jobname,inp])
48
+
49
  btn.click(predict, inputs=[inp], outputs=[out])
50
 
51
  if __name__ == "__main__":
52
+ demo.launch()
space.py CHANGED
@@ -50,20 +50,42 @@ def predict(input):
50
  return input
51
 
52
  with gr.Blocks() as demo:
 
53
  inp=CofoldingInput(label="Input")
54
 
55
- # preinput = {"chains": [
56
- # {
57
- # "class": "DNA",
58
- # "sequence": "ATGCGT",
59
- # "chain": "A"
60
- # }
61
- # ], "covMods":[]
62
- # }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  # inp2=CofoldingInput(preinput, label="Input prefilled")
64
  btn = gr.Button("Submit")
65
  out = gr.HTML()
66
 
 
 
67
  btn.click(predict, inputs=[inp], outputs=[out])
68
 
69
  if __name__ == "__main__":
@@ -148,4 +170,4 @@ def predict(
148
 
149
  """)
150
 
151
- demo.launch(ssr_mode=False)
 
50
  return input
51
 
52
  with gr.Blocks() as demo:
53
+ jobname = gr.Textbox(label="Job Name")
54
  inp=CofoldingInput(label="Input")
55
 
56
+ preinput = {"chains": [
57
+ {
58
+ "class": "DNA",
59
+ "sequence": "ATGCGT",
60
+ "chain": "A"
61
+ },
62
+ {
63
+ "class": "protein",
64
+ "sequence": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
65
+ "chain": "B"
66
+ },
67
+ {
68
+ "class": "ligand",
69
+ "name": "ZN",
70
+ "smiles": "",
71
+ "sdf": "",
72
+ "chain": "C"
73
+ },
74
+ {
75
+ "class": "ligand",
76
+ "smiles": "CCCCCCCCCCCCCCCCCCCC",
77
+ "name": "",
78
+ "sdf": "",
79
+ "chain": "D"
80
+ }
81
+ ], "covMods":[]
82
+ }
83
  # inp2=CofoldingInput(preinput, label="Input prefilled")
84
  btn = gr.Button("Submit")
85
  out = gr.HTML()
86
 
87
+ gr.Examples([["test",preinput]], inputs=[jobname,inp])
88
+
89
  btn.click(predict, inputs=[inp], outputs=[out])
90
 
91
  if __name__ == "__main__":
 
170
 
171
  """)
172
 
173
+ demo.launch()
src/README.md CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
 
2
  # `gradio_cofoldinginput`
3
  <a href="https://pypi.org/project/gradio_cofoldinginput/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_cofoldinginput"></a>
@@ -25,20 +31,42 @@ def predict(input):
25
  return input
26
 
27
  with gr.Blocks() as demo:
 
28
  inp=CofoldingInput(label="Input")
29
 
30
- # preinput = {"chains": [
31
- # {
32
- # "class": "DNA",
33
- # "sequence": "ATGCGT",
34
- # "chain": "A"
35
- # }
36
- # ], "covMods":[]
37
- # }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  # inp2=CofoldingInput(preinput, label="Input prefilled")
39
  btn = gr.Button("Submit")
40
  out = gr.HTML()
41
 
 
 
42
  btn.click(predict, inputs=[inp], outputs=[out])
43
 
44
  if __name__ == "__main__":
 
1
+ ---
2
+ license: mit
3
+ title: Cofolding Input
4
+ sdk: gradio
5
+ colorFrom: red
6
+ ---
7
 
8
  # `gradio_cofoldinginput`
9
  <a href="https://pypi.org/project/gradio_cofoldinginput/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_cofoldinginput"></a>
 
31
  return input
32
 
33
  with gr.Blocks() as demo:
34
+ jobname = gr.Textbox(label="Job Name")
35
  inp=CofoldingInput(label="Input")
36
 
37
+ preinput = {"chains": [
38
+ {
39
+ "class": "DNA",
40
+ "sequence": "ATGCGT",
41
+ "chain": "A"
42
+ },
43
+ {
44
+ "class": "protein",
45
+ "sequence": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
46
+ "chain": "B"
47
+ },
48
+ {
49
+ "class": "ligand",
50
+ "name": "ZN",
51
+ "smiles": "",
52
+ "sdf": "",
53
+ "chain": "C"
54
+ },
55
+ {
56
+ "class": "ligand",
57
+ "smiles": "CCCCCCCCCCCCCCCCCCCC",
58
+ "name": "",
59
+ "sdf": "",
60
+ "chain": "D"
61
+ }
62
+ ], "covMods":[]
63
+ }
64
  # inp2=CofoldingInput(preinput, label="Input prefilled")
65
  btn = gr.Button("Submit")
66
  out = gr.HTML()
67
 
68
+ gr.Examples([["test",preinput]], inputs=[jobname,inp])
69
+
70
  btn.click(predict, inputs=[inp], outputs=[out])
71
 
72
  if __name__ == "__main__":
src/backend/gradio_cofoldinginput/templates/component/index.js CHANGED
The diff for this file is too large to render. See raw diff
 
src/backend/gradio_cofoldinginput/templates/component/style.css CHANGED
The diff for this file is too large to render. See raw diff
 
src/backend/gradio_cofoldinginput/templates/example/index.js CHANGED
@@ -1,126 +1,429 @@
1
  const {
2
- SvelteComponent: y,
3
- add_iframe_resize_listener: b,
4
- add_render_callback: m,
5
- append_hydration: v,
6
- attr: w,
7
- binding_callbacks: z,
8
- children: k,
9
- claim_element: p,
10
- claim_text: E,
11
- detach: o,
12
- element: S,
13
- init: q,
14
- insert_hydration: C,
15
- noop: u,
16
- safe_not_equal: D,
17
- set_data: I,
18
- text: M,
19
- toggle_class: r
20
- } = window.__gradio__svelte__internal, { onMount: P } = window.__gradio__svelte__internal;
21
- function V(n) {
22
- let e, i = (
 
 
 
 
 
 
 
 
 
 
23
  /*value*/
24
- (n[0] ? (
 
 
 
25
  /*value*/
26
- n[0]
27
- ) : "") + ""
28
- ), a, d;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  return {
30
  c() {
31
- e = S("div"), a = M(i), this.h();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  },
33
  l(t) {
34
- e = p(t, "DIV", { class: !0 });
35
- var l = k(e);
36
- a = E(l, i), l.forEach(o), this.h();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  },
38
  h() {
39
- w(e, "class", "svelte-84cxb8"), m(() => (
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  /*div_elementresize_handler*/
41
- n[5].call(e)
42
- )), r(
43
  e,
44
  "table",
45
  /*type*/
46
- n[1] === "table"
47
- ), r(
48
  e,
49
  "gallery",
50
  /*type*/
51
- n[1] === "gallery"
52
- ), r(
53
  e,
54
  "selected",
55
  /*selected*/
56
- n[2]
57
  );
58
  },
59
- m(t, l) {
60
- C(t, e, l), v(e, a), d = b(
61
  e,
62
  /*div_elementresize_handler*/
63
- n[5].bind(e)
64
- ), n[6](e);
65
  },
66
- p(t, [l]) {
67
- l & /*value*/
68
- 1 && i !== (i = /*value*/
69
- (t[0] ? (
70
- /*value*/
71
- t[0]
72
- ) : "") + "") && I(a, i), l & /*type*/
73
- 2 && r(
74
  e,
75
  "table",
76
  /*type*/
77
- t[1] === "table"
78
- ), l & /*type*/
79
- 2 && r(
80
  e,
81
  "gallery",
82
  /*type*/
83
- t[1] === "gallery"
84
- ), l & /*selected*/
85
- 4 && r(
86
  e,
87
  "selected",
88
  /*selected*/
89
- t[2]
90
  );
91
  },
92
- i: u,
93
- o: u,
94
- d(t) {
95
- t && o(e), d(), n[6](null);
96
  }
97
  };
98
  }
99
- function W(n, e, i) {
100
- let { value: a } = e, { type: d } = e, { selected: t = !1 } = e, l, _;
101
- function f(s, c) {
102
- !s || !c || (_.style.setProperty("--local-text-width", `${c < 150 ? c : 200}px`), i(4, _.style.whiteSpace = "unset", _));
103
  }
104
- P(() => {
105
- f(_, l);
106
  });
107
- function h() {
108
- l = this.clientWidth, i(3, l);
109
  }
110
- function g(s) {
111
- z[s ? "unshift" : "push"](() => {
112
- _ = s, i(4, _);
113
  });
114
  }
115
- return n.$$set = (s) => {
116
- "value" in s && i(0, a = s.value), "type" in s && i(1, d = s.type), "selected" in s && i(2, t = s.selected);
117
- }, [a, d, t, l, _, h, g];
118
  }
119
- class j extends y {
120
  constructor(e) {
121
- super(), q(this, e, W, V, D, { value: 0, type: 1, selected: 2 });
122
  }
123
  }
124
  export {
125
- j as default
126
  };
 
1
  const {
2
+ SvelteComponent: P,
3
+ add_iframe_resize_listener: W,
4
+ add_render_callback: j,
5
+ append_hydration: d,
6
+ attr: A,
7
+ binding_callbacks: F,
8
+ children: E,
9
+ claim_element: g,
10
+ claim_space: D,
11
+ claim_text: b,
12
+ destroy_each: G,
13
+ detach: u,
14
+ element: k,
15
+ empty: z,
16
+ ensure_array_like: V,
17
+ get_svelte_dataset: J,
18
+ init: K,
19
+ insert_hydration: m,
20
+ noop: R,
21
+ safe_not_equal: O,
22
+ set_data: w,
23
+ space: S,
24
+ text: p,
25
+ toggle_class: M
26
+ } = window.__gradio__svelte__internal, { onMount: Q } = window.__gradio__svelte__internal;
27
+ function q(a, e, n) {
28
+ const i = a.slice();
29
+ return i[8] = e[n], i;
30
+ }
31
+ function C(a) {
32
+ let e, n, i, l, t, s = (
33
  /*value*/
34
+ a[0].covMods.length + ""
35
+ ), f, c;
36
+ function _(r, L) {
37
+ return (
38
  /*value*/
39
+ r[0].chains.length > 1 ? Y : X
40
+ );
41
+ }
42
+ let y = _(a), o = y(a), I = V(
43
+ /*value*/
44
+ a[0].chains
45
+ ), v = [];
46
+ for (let r = 0; r < I.length; r += 1)
47
+ v[r] = U(q(a, I, r));
48
+ return {
49
+ c() {
50
+ o.c(), e = S(), n = k("ul");
51
+ for (let r = 0; r < v.length; r += 1)
52
+ v[r].c();
53
+ i = S(), l = k("ul"), t = k("li"), f = p(s), c = p(" covalent modifications");
54
+ },
55
+ l(r) {
56
+ o.l(r), e = D(r), n = g(r, "UL", {});
57
+ var L = E(n);
58
+ for (let B = 0; B < v.length; B += 1)
59
+ v[B].l(L);
60
+ L.forEach(u), i = D(r), l = g(r, "UL", {});
61
+ var h = E(l);
62
+ t = g(h, "LI", {});
63
+ var N = E(t);
64
+ f = b(N, s), c = b(N, " covalent modifications"), N.forEach(u), h.forEach(u);
65
+ },
66
+ m(r, L) {
67
+ o.m(r, L), m(r, e, L), m(r, n, L);
68
+ for (let h = 0; h < v.length; h += 1)
69
+ v[h] && v[h].m(n, null);
70
+ m(r, i, L), m(r, l, L), d(l, t), d(t, f), d(t, c);
71
+ },
72
+ p(r, L) {
73
+ if (y === (y = _(r)) && o ? o.p(r, L) : (o.d(1), o = y(r), o && (o.c(), o.m(e.parentNode, e))), L & /*value, undefined*/
74
+ 1) {
75
+ I = V(
76
+ /*value*/
77
+ r[0].chains
78
+ );
79
+ let h;
80
+ for (h = 0; h < I.length; h += 1) {
81
+ const N = q(r, I, h);
82
+ v[h] ? v[h].p(N, L) : (v[h] = U(N), v[h].c(), v[h].m(n, null));
83
+ }
84
+ for (; h < v.length; h += 1)
85
+ v[h].d(1);
86
+ v.length = I.length;
87
+ }
88
+ L & /*value*/
89
+ 1 && s !== (s = /*value*/
90
+ r[0].covMods.length + "") && w(f, s);
91
+ },
92
+ d(r) {
93
+ r && (u(e), u(n), u(i), u(l)), o.d(r), G(v, r);
94
+ }
95
+ };
96
+ }
97
+ function X(a) {
98
+ let e, n, i = (
99
+ /*value*/
100
+ a[0].chains.length + ""
101
+ ), l, t, s;
102
+ return {
103
+ c() {
104
+ e = k("b"), n = p("Input composed of "), l = p(i), t = p(" chain "), s = k("br");
105
+ },
106
+ l(f) {
107
+ e = g(f, "B", {});
108
+ var c = E(e);
109
+ n = b(c, "Input composed of "), l = b(c, i), t = b(c, " chain "), c.forEach(u), s = g(f, "BR", {});
110
+ },
111
+ m(f, c) {
112
+ m(f, e, c), d(e, n), d(e, l), d(e, t), m(f, s, c);
113
+ },
114
+ p(f, c) {
115
+ c & /*value*/
116
+ 1 && i !== (i = /*value*/
117
+ f[0].chains.length + "") && w(l, i);
118
+ },
119
+ d(f) {
120
+ f && (u(e), u(s));
121
+ }
122
+ };
123
+ }
124
+ function Y(a) {
125
+ let e, n, i = (
126
+ /*value*/
127
+ a[0].chains.length + ""
128
+ ), l, t, s, f;
129
+ return {
130
+ c() {
131
+ e = k("b"), n = p("Input composed of "), l = p(i), t = p(" chains"), s = S(), f = k("br");
132
+ },
133
+ l(c) {
134
+ e = g(c, "B", {});
135
+ var _ = E(e);
136
+ n = b(_, "Input composed of "), l = b(_, i), t = b(_, " chains"), _.forEach(u), s = D(c), f = g(c, "BR", {});
137
+ },
138
+ m(c, _) {
139
+ m(c, e, _), d(e, n), d(e, l), d(e, t), m(c, s, _), m(c, f, _);
140
+ },
141
+ p(c, _) {
142
+ _ & /*value*/
143
+ 1 && i !== (i = /*value*/
144
+ c[0].chains.length + "") && w(l, i);
145
+ },
146
+ d(c) {
147
+ c && (u(e), u(s), u(f));
148
+ }
149
+ };
150
+ }
151
+ function H(a) {
152
+ let e, n, i = (
153
+ /*val*/
154
+ a[8].class + ""
155
+ ), l, t, s = (
156
+ /*val*/
157
+ a[8].sequence.length + ""
158
+ ), f, c;
159
  return {
160
  c() {
161
+ e = k("li"), n = k("div"), l = p(i), t = S(), f = p(s), c = p(" residues"), this.h();
162
+ },
163
+ l(_) {
164
+ e = g(_, "LI", {});
165
+ var y = E(e);
166
+ n = g(y, "DIV", { class: !0 });
167
+ var o = E(n);
168
+ l = b(o, i), t = D(o), f = b(o, s), c = b(o, " residues"), o.forEach(u), y.forEach(u), this.h();
169
+ },
170
+ h() {
171
+ A(n, "class", "svelte-1r1gryw");
172
+ },
173
+ m(_, y) {
174
+ m(_, e, y), d(e, n), d(n, l), d(n, t), d(n, f), d(n, c);
175
+ },
176
+ p(_, y) {
177
+ y & /*value*/
178
+ 1 && i !== (i = /*val*/
179
+ _[8].class + "") && w(l, i), y & /*value*/
180
+ 1 && s !== (s = /*val*/
181
+ _[8].sequence.length + "") && w(f, s);
182
+ },
183
+ d(_) {
184
+ _ && u(e);
185
+ }
186
+ };
187
+ }
188
+ function T(a) {
189
+ let e;
190
+ function n(t, s) {
191
+ return (
192
+ /*val*/
193
+ t[8].name != null ? $ : (
194
+ /*val*/
195
+ t[8].smiles != null ? x : Z
196
+ )
197
+ );
198
+ }
199
+ let i = n(a), l = i(a);
200
+ return {
201
+ c() {
202
+ l.c(), e = z();
203
  },
204
  l(t) {
205
+ l.l(t), e = z();
206
+ },
207
+ m(t, s) {
208
+ l.m(t, s), m(t, e, s);
209
+ },
210
+ p(t, s) {
211
+ i === (i = n(t)) && l ? l.p(t, s) : (l.d(1), l = i(t), l && (l.c(), l.m(e.parentNode, e)));
212
+ },
213
+ d(t) {
214
+ t && u(e), l.d(t);
215
+ }
216
+ };
217
+ }
218
+ function Z(a) {
219
+ let e, n = '<div class="svelte-1r1gryw">Ligand</div>';
220
+ return {
221
+ c() {
222
+ e = k("li"), e.innerHTML = n;
223
+ },
224
+ l(i) {
225
+ e = g(i, "LI", { "data-svelte-h": !0 }), J(e) !== "svelte-z73xb2" && (e.innerHTML = n);
226
+ },
227
+ m(i, l) {
228
+ m(i, e, l);
229
+ },
230
+ p: R,
231
+ d(i) {
232
+ i && u(e);
233
+ }
234
+ };
235
+ }
236
+ function x(a) {
237
+ let e, n, i, l = (
238
+ /*val*/
239
+ a[8].smiles.length + ""
240
+ ), t, s;
241
+ return {
242
+ c() {
243
+ e = k("li"), n = k("div"), i = p("Ligand SMILES with "), t = p(l), s = p(" atoms"), this.h();
244
+ },
245
+ l(f) {
246
+ e = g(f, "LI", {});
247
+ var c = E(e);
248
+ n = g(c, "DIV", { class: !0 });
249
+ var _ = E(n);
250
+ i = b(_, "Ligand SMILES with "), t = b(_, l), s = b(_, " atoms"), _.forEach(u), c.forEach(u), this.h();
251
+ },
252
+ h() {
253
+ A(n, "class", "svelte-1r1gryw");
254
+ },
255
+ m(f, c) {
256
+ m(f, e, c), d(e, n), d(n, i), d(n, t), d(n, s);
257
+ },
258
+ p(f, c) {
259
+ c & /*value*/
260
+ 1 && l !== (l = /*val*/
261
+ f[8].smiles.length + "") && w(t, l);
262
+ },
263
+ d(f) {
264
+ f && u(e);
265
+ }
266
+ };
267
+ }
268
+ function $(a) {
269
+ let e, n, i, l = (
270
+ /*val*/
271
+ a[8].name + ""
272
+ ), t;
273
+ return {
274
+ c() {
275
+ e = k("li"), n = k("div"), i = p("Ligand "), t = p(l), this.h();
276
+ },
277
+ l(s) {
278
+ e = g(s, "LI", {});
279
+ var f = E(e);
280
+ n = g(f, "DIV", { class: !0 });
281
+ var c = E(n);
282
+ i = b(c, "Ligand "), t = b(c, l), c.forEach(u), f.forEach(u), this.h();
283
  },
284
  h() {
285
+ A(n, "class", "svelte-1r1gryw");
286
+ },
287
+ m(s, f) {
288
+ m(s, e, f), d(e, n), d(n, i), d(n, t);
289
+ },
290
+ p(s, f) {
291
+ f & /*value*/
292
+ 1 && l !== (l = /*val*/
293
+ s[8].name + "") && w(t, l);
294
+ },
295
+ d(s) {
296
+ s && u(e);
297
+ }
298
+ };
299
+ }
300
+ function U(a) {
301
+ let e = ["protein", "DNA", "RNA"].includes(
302
+ /*val*/
303
+ a[8].class
304
+ ), n, i, l = e && H(a), t = (
305
+ /*val*/
306
+ a[8].class == "ligand" && T(a)
307
+ );
308
+ return {
309
+ c() {
310
+ l && l.c(), n = S(), t && t.c(), i = z();
311
+ },
312
+ l(s) {
313
+ l && l.l(s), n = D(s), t && t.l(s), i = z();
314
+ },
315
+ m(s, f) {
316
+ l && l.m(s, f), m(s, n, f), t && t.m(s, f), m(s, i, f);
317
+ },
318
+ p(s, f) {
319
+ f & /*value*/
320
+ 1 && (e = ["protein", "DNA", "RNA"].includes(
321
+ /*val*/
322
+ s[8].class
323
+ )), e ? l ? l.p(s, f) : (l = H(s), l.c(), l.m(n.parentNode, n)) : l && (l.d(1), l = null), /*val*/
324
+ s[8].class == "ligand" ? t ? t.p(s, f) : (t = T(s), t.c(), t.m(i.parentNode, i)) : t && (t.d(1), t = null);
325
+ },
326
+ d(s) {
327
+ s && (u(n), u(i)), l && l.d(s), t && t.d(s);
328
+ }
329
+ };
330
+ }
331
+ function ee(a) {
332
+ let e, n, i = (
333
+ /*value*/
334
+ a[0] && C(a)
335
+ );
336
+ return {
337
+ c() {
338
+ e = k("div"), i && i.c(), this.h();
339
+ },
340
+ l(l) {
341
+ e = g(l, "DIV", { class: !0 });
342
+ var t = E(e);
343
+ i && i.l(t), t.forEach(u), this.h();
344
+ },
345
+ h() {
346
+ A(e, "class", "svelte-1r1gryw"), j(() => (
347
  /*div_elementresize_handler*/
348
+ a[5].call(e)
349
+ )), M(
350
  e,
351
  "table",
352
  /*type*/
353
+ a[1] === "table"
354
+ ), M(
355
  e,
356
  "gallery",
357
  /*type*/
358
+ a[1] === "gallery"
359
+ ), M(
360
  e,
361
  "selected",
362
  /*selected*/
363
+ a[2]
364
  );
365
  },
366
+ m(l, t) {
367
+ m(l, e, t), i && i.m(e, null), n = W(
368
  e,
369
  /*div_elementresize_handler*/
370
+ a[5].bind(e)
371
+ ), a[6](e);
372
  },
373
+ p(l, [t]) {
374
+ /*value*/
375
+ l[0] ? i ? i.p(l, t) : (i = C(l), i.c(), i.m(e, null)) : i && (i.d(1), i = null), t & /*type*/
376
+ 2 && M(
 
 
 
 
377
  e,
378
  "table",
379
  /*type*/
380
+ l[1] === "table"
381
+ ), t & /*type*/
382
+ 2 && M(
383
  e,
384
  "gallery",
385
  /*type*/
386
+ l[1] === "gallery"
387
+ ), t & /*selected*/
388
+ 4 && M(
389
  e,
390
  "selected",
391
  /*selected*/
392
+ l[2]
393
  );
394
  },
395
+ i: R,
396
+ o: R,
397
+ d(l) {
398
+ l && u(e), i && i.d(), n(), a[6](null);
399
  }
400
  };
401
  }
402
+ function le(a, e, n) {
403
+ let { value: i } = e, { type: l } = e, { selected: t = !1 } = e, s, f;
404
+ function c(o, I) {
405
+ !o || !I || (f.style.setProperty("--local-text-width", `${I < 150 ? I : 200}px`), n(4, f.style.whiteSpace = "unset", f));
406
  }
407
+ Q(() => {
408
+ c(f, s);
409
  });
410
+ function _() {
411
+ s = this.clientWidth, n(3, s);
412
  }
413
+ function y(o) {
414
+ F[o ? "unshift" : "push"](() => {
415
+ f = o, n(4, f);
416
  });
417
  }
418
+ return a.$$set = (o) => {
419
+ "value" in o && n(0, i = o.value), "type" in o && n(1, l = o.type), "selected" in o && n(2, t = o.selected);
420
+ }, [i, l, t, s, f, _, y];
421
  }
422
+ class te extends P {
423
  constructor(e) {
424
+ super(), K(this, e, le, ee, O, { value: 0, type: 1, selected: 2 });
425
  }
426
  }
427
  export {
428
+ te as default
429
  };
src/backend/gradio_cofoldinginput/templates/example/style.css CHANGED
@@ -1 +1 @@
1
- .gallery.svelte-84cxb8{padding:var(--size-1) var(--size-2)}div.svelte-84cxb8{overflow:hidden;min-width:var(--local-text-width);white-space:nowrap}
 
1
+ .gallery.svelte-1r1gryw{padding:var(--size-1) var(--size-2)}div.svelte-1r1gryw{overflow:hidden;min-width:var(--local-text-width);white-space:nowrap}
src/demo/app.py CHANGED
@@ -10,20 +10,42 @@ def predict(input):
10
  return input
11
 
12
  with gr.Blocks() as demo:
 
13
  inp=CofoldingInput(label="Input")
14
 
15
- # preinput = {"chains": [
16
- # {
17
- # "class": "DNA",
18
- # "sequence": "ATGCGT",
19
- # "chain": "A"
20
- # }
21
- # ], "covMods":[]
22
- # }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  # inp2=CofoldingInput(preinput, label="Input prefilled")
24
  btn = gr.Button("Submit")
25
  out = gr.HTML()
26
 
 
 
27
  btn.click(predict, inputs=[inp], outputs=[out])
28
 
29
  if __name__ == "__main__":
 
10
  return input
11
 
12
  with gr.Blocks() as demo:
13
+ jobname = gr.Textbox(label="Job Name")
14
  inp=CofoldingInput(label="Input")
15
 
16
+ preinput = {"chains": [
17
+ {
18
+ "class": "DNA",
19
+ "sequence": "ATGCGT",
20
+ "chain": "A"
21
+ },
22
+ {
23
+ "class": "protein",
24
+ "sequence": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
25
+ "chain": "B"
26
+ },
27
+ {
28
+ "class": "ligand",
29
+ "name": "ZN",
30
+ "smiles": "",
31
+ "sdf": "",
32
+ "chain": "C"
33
+ },
34
+ {
35
+ "class": "ligand",
36
+ "smiles": "CCCCCCCCCCCCCCCCCCCC",
37
+ "name": "",
38
+ "sdf": "",
39
+ "chain": "D"
40
+ }
41
+ ], "covMods":[]
42
+ }
43
  # inp2=CofoldingInput(preinput, label="Input prefilled")
44
  btn = gr.Button("Submit")
45
  out = gr.HTML()
46
 
47
+ gr.Examples([["test",preinput]], inputs=[jobname,inp])
48
+
49
  btn.click(predict, inputs=[inp], outputs=[out])
50
 
51
  if __name__ == "__main__":
src/demo/space.py CHANGED
@@ -50,20 +50,42 @@ def predict(input):
50
  return input
51
 
52
  with gr.Blocks() as demo:
 
53
  inp=CofoldingInput(label="Input")
54
 
55
- # preinput = {"chains": [
56
- # {
57
- # "class": "DNA",
58
- # "sequence": "ATGCGT",
59
- # "chain": "A"
60
- # }
61
- # ], "covMods":[]
62
- # }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  # inp2=CofoldingInput(preinput, label="Input prefilled")
64
  btn = gr.Button("Submit")
65
  out = gr.HTML()
66
 
 
 
67
  btn.click(predict, inputs=[inp], outputs=[out])
68
 
69
  if __name__ == "__main__":
 
50
  return input
51
 
52
  with gr.Blocks() as demo:
53
+ jobname = gr.Textbox(label="Job Name")
54
  inp=CofoldingInput(label="Input")
55
 
56
+ preinput = {"chains": [
57
+ {
58
+ "class": "DNA",
59
+ "sequence": "ATGCGT",
60
+ "chain": "A"
61
+ },
62
+ {
63
+ "class": "protein",
64
+ "sequence": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
65
+ "chain": "B"
66
+ },
67
+ {
68
+ "class": "ligand",
69
+ "name": "ZN",
70
+ "smiles": "",
71
+ "sdf": "",
72
+ "chain": "C"
73
+ },
74
+ {
75
+ "class": "ligand",
76
+ "smiles": "CCCCCCCCCCCCCCCCCCCC",
77
+ "name": "",
78
+ "sdf": "",
79
+ "chain": "D"
80
+ }
81
+ ], "covMods":[]
82
+ }
83
  # inp2=CofoldingInput(preinput, label="Input prefilled")
84
  btn = gr.Button("Submit")
85
  out = gr.HTML()
86
 
87
+ gr.Examples([["test",preinput]], inputs=[jobname,inp])
88
+
89
  btn.click(predict, inputs=[inp], outputs=[out])
90
 
91
  if __name__ == "__main__":
src/frontend/Example.svelte CHANGED
@@ -1,46 +1,74 @@
1
  <script lang="ts">
2
- import { onMount } from "svelte";
3
-
4
- export let value: string | null;
5
- export let type: "gallery" | "table";
6
- export let selected = false;
7
-
8
- let size: number;
9
- let el: HTMLDivElement;
10
-
11
- function set_styles(element: HTMLElement, el_width: number): void {
12
- if (!element || !el_width) return;
13
- el.style.setProperty(
14
- "--local-text-width",
15
- `${el_width < 150 ? el_width : 200}px`
16
- );
17
- el.style.whiteSpace = "unset";
18
- }
19
-
20
- onMount(() => {
21
- set_styles(el, size);
22
- });
23
  </script>
24
 
25
  <div
26
- bind:clientWidth={size}
27
- bind:this={el}
28
- class:table={type === "table"}
29
- class:gallery={type === "gallery"}
30
- class:selected
31
  >
32
- {value ? value : ""}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  </div>
34
 
35
  <style>
36
- .gallery {
37
- padding: var(--size-1) var(--size-2);
38
- }
39
 
40
- div {
41
- overflow: hidden;
42
- min-width: var(--local-text-width);
43
 
44
- white-space: nowrap;
45
- }
46
  </style>
 
1
  <script lang="ts">
2
+ import { onMount } from "svelte";
3
+
4
+ export let value: string | null;
5
+ export let type: "gallery" | "table";
6
+ export let selected = false;
7
+
8
+ let size: number;
9
+ let el: HTMLDivElement;
10
+
11
+ function set_styles(element: HTMLElement, el_width: number): void {
12
+ if (!element || !el_width) return;
13
+ el.style.setProperty(
14
+ "--local-text-width",
15
+ `${el_width < 150 ? el_width : 200}px`
16
+ );
17
+ el.style.whiteSpace = "unset";
18
+ }
19
+
20
+ onMount(() => {
21
+ set_styles(el, size);
22
+ });
23
  </script>
24
 
25
  <div
26
+ bind:clientWidth={size}
27
+ bind:this={el}
28
+ class:table={type === "table"}
29
+ class:gallery={type === "gallery"}
30
+ class:selected
31
  >
32
+ <!-- {value ? value : ""} -->
33
+ <!-- {JSON.stringify(value)} -->
34
+ {#if value}
35
+ {#if value["chains"].length > 1}
36
+ <b>Input composed of {value["chains"].length} chains </b> <br />
37
+ {:else}
38
+ <b>Input composed of {value["chains"].length} chain </b><br />
39
+ {/if}
40
+ <ul>
41
+ {#each value["chains"] as val}
42
+ {#if ["protein", "DNA", "RNA"].includes(val["class"])}
43
+ <li><div>{val["class"]} {val["sequence"].length} residues</div></li>
44
+ {/if}
45
+ {#if val["class"] == "ligand"}
46
+ {#if val["name"] != undefined}
47
+ <li><div>Ligand {val["name"]}</div></li>
48
+ {:else if val["smiles"] != undefined}
49
+ <li><div>Ligand SMILES with {val["smiles"].length} atoms</div></li>
50
+ {:else}
51
+ <li><div>Ligand</div></li>
52
+ {/if}
53
+ {/if}
54
+ {/each}
55
+ </ul>
56
+
57
+ <ul>
58
+ <li>{value["covMods"].length} covalent modifications</li>
59
+ </ul>
60
+ {/if}
61
  </div>
62
 
63
  <style>
64
+ .gallery {
65
+ padding: var(--size-1) var(--size-2);
66
+ }
67
 
68
+ div {
69
+ overflow: hidden;
70
+ min-width: var(--local-text-width);
71
 
72
+ white-space: nowrap;
73
+ }
74
  </style>
src/frontend/Index.svelte CHANGED
@@ -52,6 +52,18 @@
52
  }
53
 
54
  onMount(() => {});
 
 
 
 
 
 
 
 
 
 
 
 
55
  </script>
56
 
57
  <Block
 
52
  }
53
 
54
  onMount(() => {});
55
+
56
+ $: console.log(value);
57
+
58
+ // let id = 0;
59
+ // trigger reload of values
60
+ // when the value is changed
61
+ // // let old_value = value;
62
+ // $: if (JSON.stringify(old_value) !== JSON.stringify(value)) {
63
+ // // gradio.dispatch("change");
64
+ // old_value = value;
65
+ // // id += 1;
66
+ // }
67
  </script>
68
 
69
  <Block
src/frontend/shared/Molecule.svelte CHANGED
@@ -2,7 +2,10 @@
2
  import { createEventDispatcher, afterUpdate } from "svelte";
3
 
4
  const dispatch = createEventDispatcher();
5
- import Dmol from "3dmol";
 
 
 
6
 
7
  // export let whichCovMod = 0;
8
 
@@ -711,7 +714,7 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
711
  --tw-contain-size: ;
712
  --tw-contain-layout: ;
713
  --tw-contain-paint: ;
714
- --tw-contain-style:
715
  ;
716
  }
717
 
@@ -766,7 +769,7 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
766
  --tw-contain-size: ;
767
  --tw-contain-layout: ;
768
  --tw-contain-paint: ;
769
- --tw-contain-style:
770
  ;
771
  }
772
 
 
2
  import { createEventDispatcher, afterUpdate } from "svelte";
3
 
4
  const dispatch = createEventDispatcher();
5
+ import * as mol from "3dmol/build/3Dmol.js";
6
+ let Dmol = mol;
7
+
8
+ console.log(Dmol);
9
 
10
  // export let whichCovMod = 0;
11
 
 
714
  --tw-contain-size: ;
715
  --tw-contain-layout: ;
716
  --tw-contain-paint: ;
717
+ --tw-contain-style:
718
  ;
719
  }
720
 
 
769
  --tw-contain-size: ;
770
  --tw-contain-layout: ;
771
  --tw-contain-paint: ;
772
+ --tw-contain-style:
773
  ;
774
  }
775
 
src/frontend/shared/SequenceInput.svelte CHANGED
@@ -358,6 +358,14 @@
358
  covMods = value["covMods"];
359
  // vals = value["chains"];
360
  });
 
 
 
 
 
 
 
 
361
  </script>
362
 
363
  {#if vals != undefined}
 
358
  covMods = value["covMods"];
359
  // vals = value["chains"];
360
  });
361
+
362
+ // for each change of value, update vals and covMods
363
+ let old_value = value;
364
+ $: if (JSON.stringify(old_value) !== JSON.stringify(value)) {
365
+ vals = value["chains"];
366
+ covMods = value["covMods"];
367
+ old_value = value;
368
+ }
369
  </script>
370
 
371
  {#if vals != undefined}
src/pyproject.toml CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
8
 
9
  [project]
10
  name = "gradio_cofoldinginput"
11
- version = "0.0.6"
12
  description = "Component to enter protein and DNA sequences + small molecules for cofolding"
13
  readme = "README.md"
14
  license = "MIT"
 
8
 
9
  [project]
10
  name = "gradio_cofoldinginput"
11
+ version = "0.0.7"
12
  description = "Component to enter protein and DNA sequences + small molecules for cofolding"
13
  readme = "README.md"
14
  license = "MIT"