Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
@@ -1,276 +1,276 @@
|
|
1 |
-
---
|
2 |
-
tags: [gradio-custom-component, Plot, med, medicine, bio, biology, chem, chemistry, MSA, multiple sequence alignment, seqlogo, annotation, consensus histogram, visualize]
|
3 |
-
title: gradio_msaplot
|
4 |
-
short_description: MSAplot is customizable panels for plotting MSA.
|
5 |
-
colorFrom: blue
|
6 |
-
colorTo: yellow
|
7 |
-
sdk: gradio
|
8 |
-
pinned: false
|
9 |
-
app_file:
|
10 |
-
---
|
11 |
-
|
12 |
-
# `gradio_msaplot`
|
13 |
-
<img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange"> <a href="https://github.com/Josephrp/GradioMSAPlot.git/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a> <a href="https://huggingface.co/spaces/seq-to-pheno/MSAPlot/discussions" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/%F0%9F%A4%97%20Discuss-%23097EFF?style=flat&logoColor=black"></a>
|
14 |
-
|
15 |
-
MSAplot is customizable panels for plotting MSA, seqlogo, annotation, and consensus histograms.
|
16 |
-
|
17 |
-
## Installation
|
18 |
-
|
19 |
-
```bash
|
20 |
-
pip install gradio_msaplot
|
21 |
-
```
|
22 |
-
|
23 |
-
## Usage
|
24 |
-
|
25 |
-
```python
|
26 |
-
|
27 |
-
import gradio as gr
|
28 |
-
from gradio_msaplot import MSAPlot, MSAPlotData
|
29 |
-
import matplotlib
|
30 |
-
matplotlib.use('Agg')
|
31 |
-
|
32 |
-
example = MSAPlot().example_value()
|
33 |
-
|
34 |
-
with gr.Blocks() as demo:
|
35 |
-
with gr.Row():
|
36 |
-
MSAPlot(label="Blank"), # blank component
|
37 |
-
MSAPlot(value=example, label="Populated"), # populated component
|
38 |
-
|
39 |
-
|
40 |
-
if __name__ == "__main__":
|
41 |
-
demo.launch()
|
42 |
-
|
43 |
-
```
|
44 |
-
|
45 |
-
## `MSAPlot`
|
46 |
-
|
47 |
-
### Initialization
|
48 |
-
|
49 |
-
<table>
|
50 |
-
<thead>
|
51 |
-
<tr>
|
52 |
-
<th align="left">name</th>
|
53 |
-
<th align="left" style="width: 25%;">type</th>
|
54 |
-
<th align="left">default</th>
|
55 |
-
<th align="left">description</th>
|
56 |
-
</tr>
|
57 |
-
</thead>
|
58 |
-
<tbody>
|
59 |
-
<tr>
|
60 |
-
<td align="left"><code>value</code></td>
|
61 |
-
<td align="left" style="width: 25%;">
|
62 |
-
|
63 |
-
```python
|
64 |
-
typing.Any | None
|
65 |
-
```
|
66 |
-
|
67 |
-
</td>
|
68 |
-
<td align="left"><code>None</code></td>
|
69 |
-
<td align="left">None</td>
|
70 |
-
</tr>
|
71 |
-
|
72 |
-
<tr>
|
73 |
-
<td align="left"><code>label</code></td>
|
74 |
-
<td align="left" style="width: 25%;">
|
75 |
-
|
76 |
-
```python
|
77 |
-
str | None
|
78 |
-
```
|
79 |
-
|
80 |
-
</td>
|
81 |
-
<td align="left"><code>None</code></td>
|
82 |
-
<td align="left">None</td>
|
83 |
-
</tr>
|
84 |
-
|
85 |
-
<tr>
|
86 |
-
<td align="left"><code>every</code></td>
|
87 |
-
<td align="left" style="width: 25%;">
|
88 |
-
|
89 |
-
```python
|
90 |
-
float | None
|
91 |
-
```
|
92 |
-
|
93 |
-
</td>
|
94 |
-
<td align="left"><code>None</code></td>
|
95 |
-
<td align="left">None</td>
|
96 |
-
</tr>
|
97 |
-
|
98 |
-
<tr>
|
99 |
-
<td align="left"><code>show_label</code></td>
|
100 |
-
<td align="left" style="width: 25%;">
|
101 |
-
|
102 |
-
```python
|
103 |
-
bool | None
|
104 |
-
```
|
105 |
-
|
106 |
-
</td>
|
107 |
-
<td align="left"><code>None</code></td>
|
108 |
-
<td align="left">None</td>
|
109 |
-
</tr>
|
110 |
-
|
111 |
-
<tr>
|
112 |
-
<td align="left"><code>container</code></td>
|
113 |
-
<td align="left" style="width: 25%;">
|
114 |
-
|
115 |
-
```python
|
116 |
-
bool
|
117 |
-
```
|
118 |
-
|
119 |
-
</td>
|
120 |
-
<td align="left"><code>True</code></td>
|
121 |
-
<td align="left">None</td>
|
122 |
-
</tr>
|
123 |
-
|
124 |
-
<tr>
|
125 |
-
<td align="left"><code>scale</code></td>
|
126 |
-
<td align="left" style="width: 25%;">
|
127 |
-
|
128 |
-
```python
|
129 |
-
int | None
|
130 |
-
```
|
131 |
-
|
132 |
-
</td>
|
133 |
-
<td align="left"><code>None</code></td>
|
134 |
-
<td align="left">None</td>
|
135 |
-
</tr>
|
136 |
-
|
137 |
-
<tr>
|
138 |
-
<td align="left"><code>min_width</code></td>
|
139 |
-
<td align="left" style="width: 25%;">
|
140 |
-
|
141 |
-
```python
|
142 |
-
int
|
143 |
-
```
|
144 |
-
|
145 |
-
</td>
|
146 |
-
<td align="left"><code>160</code></td>
|
147 |
-
<td align="left">None</td>
|
148 |
-
</tr>
|
149 |
-
|
150 |
-
<tr>
|
151 |
-
<td align="left"><code>visible</code></td>
|
152 |
-
<td align="left" style="width: 25%;">
|
153 |
-
|
154 |
-
```python
|
155 |
-
bool
|
156 |
-
```
|
157 |
-
|
158 |
-
</td>
|
159 |
-
<td align="left"><code>True</code></td>
|
160 |
-
<td align="left">None</td>
|
161 |
-
</tr>
|
162 |
-
|
163 |
-
<tr>
|
164 |
-
<td align="left"><code>elem_id</code></td>
|
165 |
-
<td align="left" style="width: 25%;">
|
166 |
-
|
167 |
-
```python
|
168 |
-
str | None
|
169 |
-
```
|
170 |
-
|
171 |
-
</td>
|
172 |
-
<td align="left"><code>None</code></td>
|
173 |
-
<td align="left">None</td>
|
174 |
-
</tr>
|
175 |
-
|
176 |
-
<tr>
|
177 |
-
<td align="left"><code>elem_classes</code></td>
|
178 |
-
<td align="left" style="width: 25%;">
|
179 |
-
|
180 |
-
```python
|
181 |
-
list[str] | str | None
|
182 |
-
```
|
183 |
-
|
184 |
-
</td>
|
185 |
-
<td align="left"><code>None</code></td>
|
186 |
-
<td align="left">None</td>
|
187 |
-
</tr>
|
188 |
-
|
189 |
-
<tr>
|
190 |
-
<td align="left"><code>render</code></td>
|
191 |
-
<td align="left" style="width: 25%;">
|
192 |
-
|
193 |
-
```python
|
194 |
-
bool
|
195 |
-
```
|
196 |
-
|
197 |
-
</td>
|
198 |
-
<td align="left"><code>True</code></td>
|
199 |
-
<td align="left">None</td>
|
200 |
-
</tr>
|
201 |
-
|
202 |
-
<tr>
|
203 |
-
<td align="left"><code>key</code></td>
|
204 |
-
<td align="left" style="width: 25%;">
|
205 |
-
|
206 |
-
```python
|
207 |
-
int | str | None
|
208 |
-
```
|
209 |
-
|
210 |
-
</td>
|
211 |
-
<td align="left"><code>None</code></td>
|
212 |
-
<td align="left">None</td>
|
213 |
-
</tr>
|
214 |
-
</tbody></table>
|
215 |
-
|
216 |
-
|
217 |
-
### Events
|
218 |
-
|
219 |
-
| name | description |
|
220 |
-
|:-----|:------------|
|
221 |
-
| `change` | Triggered when the value of the MSAPlot changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
|
222 |
-
| `clear` | Triggered when the plot is cleared. |
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
### User function
|
227 |
-
|
228 |
-
The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
|
229 |
-
|
230 |
-
- When used as an Input, the component only impacts the input signature of the user function.
|
231 |
-
- When used as an output, the component only impacts the return signature of the user function.
|
232 |
-
|
233 |
-
The code snippet below is accurate in cases where the component is used as both an input and an output.
|
234 |
-
|
235 |
-
- **As output:** Is passed, the preprocessed input data sent to the user's function in the backend.
|
236 |
-
- **As input:** Should return, the output data received by the component from the user's function in the backend.
|
237 |
-
|
238 |
-
```python
|
239 |
-
def predict(
|
240 |
-
value: MSAPlotData | None
|
241 |
-
) -> MSAPlotData:
|
242 |
-
return value
|
243 |
-
```
|
244 |
-
|
245 |
-
|
246 |
-
## `MSAPlotData`
|
247 |
-
|
248 |
-
### Initialization
|
249 |
-
|
250 |
-
<table>
|
251 |
-
<thead>
|
252 |
-
<tr>
|
253 |
-
<th align="left">name</th>
|
254 |
-
<th align="left" style="width: 25%;">type</th>
|
255 |
-
<th align="left">default</th>
|
256 |
-
<th align="left">description</th>
|
257 |
-
</tr>
|
258 |
-
</thead>
|
259 |
-
<tbody>
|
260 |
-
<tr>
|
261 |
-
<td align="left"><code>data</code></td>
|
262 |
-
<td align="left" style="width: 25%;">
|
263 |
-
|
264 |
-
```python
|
265 |
-
typing.Any
|
266 |
-
```
|
267 |
-
|
268 |
-
</td>
|
269 |
-
<td align="left"><code>None</code></td>
|
270 |
-
<td align="left">None</td>
|
271 |
-
</tr>
|
272 |
-
</tbody></table>
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
|
|
1 |
+
---
|
2 |
+
tags: [gradio-custom-component, Plot, med, medicine, bio, biology, chem, chemistry, MSA, multiple sequence alignment, seqlogo, annotation, consensus histogram, visualize]
|
3 |
+
title: gradio_msaplot
|
4 |
+
short_description: MSAplot is customizable panels for plotting MSA.
|
5 |
+
colorFrom: blue
|
6 |
+
colorTo: yellow
|
7 |
+
sdk: gradio
|
8 |
+
pinned: false
|
9 |
+
app_file: space.py
|
10 |
+
---
|
11 |
+
|
12 |
+
# `gradio_msaplot`
|
13 |
+
<img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange"> <a href="https://github.com/Josephrp/GradioMSAPlot.git/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a> <a href="https://huggingface.co/spaces/seq-to-pheno/MSAPlot/discussions" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/%F0%9F%A4%97%20Discuss-%23097EFF?style=flat&logoColor=black"></a>
|
14 |
+
|
15 |
+
MSAplot is customizable panels for plotting MSA, seqlogo, annotation, and consensus histograms.
|
16 |
+
|
17 |
+
## Installation
|
18 |
+
|
19 |
+
```bash
|
20 |
+
pip install gradio_msaplot
|
21 |
+
```
|
22 |
+
|
23 |
+
## Usage
|
24 |
+
|
25 |
+
```python
|
26 |
+
|
27 |
+
import gradio as gr
|
28 |
+
from gradio_msaplot import MSAPlot, MSAPlotData
|
29 |
+
import matplotlib
|
30 |
+
matplotlib.use('Agg')
|
31 |
+
|
32 |
+
example = MSAPlot().example_value()
|
33 |
+
|
34 |
+
with gr.Blocks() as demo:
|
35 |
+
with gr.Row():
|
36 |
+
MSAPlot(label="Blank"), # blank component
|
37 |
+
MSAPlot(value=example, label="Populated"), # populated component
|
38 |
+
|
39 |
+
|
40 |
+
if __name__ == "__main__":
|
41 |
+
demo.launch()
|
42 |
+
|
43 |
+
```
|
44 |
+
|
45 |
+
## `MSAPlot`
|
46 |
+
|
47 |
+
### Initialization
|
48 |
+
|
49 |
+
<table>
|
50 |
+
<thead>
|
51 |
+
<tr>
|
52 |
+
<th align="left">name</th>
|
53 |
+
<th align="left" style="width: 25%;">type</th>
|
54 |
+
<th align="left">default</th>
|
55 |
+
<th align="left">description</th>
|
56 |
+
</tr>
|
57 |
+
</thead>
|
58 |
+
<tbody>
|
59 |
+
<tr>
|
60 |
+
<td align="left"><code>value</code></td>
|
61 |
+
<td align="left" style="width: 25%;">
|
62 |
+
|
63 |
+
```python
|
64 |
+
typing.Any | None
|
65 |
+
```
|
66 |
+
|
67 |
+
</td>
|
68 |
+
<td align="left"><code>None</code></td>
|
69 |
+
<td align="left">None</td>
|
70 |
+
</tr>
|
71 |
+
|
72 |
+
<tr>
|
73 |
+
<td align="left"><code>label</code></td>
|
74 |
+
<td align="left" style="width: 25%;">
|
75 |
+
|
76 |
+
```python
|
77 |
+
str | None
|
78 |
+
```
|
79 |
+
|
80 |
+
</td>
|
81 |
+
<td align="left"><code>None</code></td>
|
82 |
+
<td align="left">None</td>
|
83 |
+
</tr>
|
84 |
+
|
85 |
+
<tr>
|
86 |
+
<td align="left"><code>every</code></td>
|
87 |
+
<td align="left" style="width: 25%;">
|
88 |
+
|
89 |
+
```python
|
90 |
+
float | None
|
91 |
+
```
|
92 |
+
|
93 |
+
</td>
|
94 |
+
<td align="left"><code>None</code></td>
|
95 |
+
<td align="left">None</td>
|
96 |
+
</tr>
|
97 |
+
|
98 |
+
<tr>
|
99 |
+
<td align="left"><code>show_label</code></td>
|
100 |
+
<td align="left" style="width: 25%;">
|
101 |
+
|
102 |
+
```python
|
103 |
+
bool | None
|
104 |
+
```
|
105 |
+
|
106 |
+
</td>
|
107 |
+
<td align="left"><code>None</code></td>
|
108 |
+
<td align="left">None</td>
|
109 |
+
</tr>
|
110 |
+
|
111 |
+
<tr>
|
112 |
+
<td align="left"><code>container</code></td>
|
113 |
+
<td align="left" style="width: 25%;">
|
114 |
+
|
115 |
+
```python
|
116 |
+
bool
|
117 |
+
```
|
118 |
+
|
119 |
+
</td>
|
120 |
+
<td align="left"><code>True</code></td>
|
121 |
+
<td align="left">None</td>
|
122 |
+
</tr>
|
123 |
+
|
124 |
+
<tr>
|
125 |
+
<td align="left"><code>scale</code></td>
|
126 |
+
<td align="left" style="width: 25%;">
|
127 |
+
|
128 |
+
```python
|
129 |
+
int | None
|
130 |
+
```
|
131 |
+
|
132 |
+
</td>
|
133 |
+
<td align="left"><code>None</code></td>
|
134 |
+
<td align="left">None</td>
|
135 |
+
</tr>
|
136 |
+
|
137 |
+
<tr>
|
138 |
+
<td align="left"><code>min_width</code></td>
|
139 |
+
<td align="left" style="width: 25%;">
|
140 |
+
|
141 |
+
```python
|
142 |
+
int
|
143 |
+
```
|
144 |
+
|
145 |
+
</td>
|
146 |
+
<td align="left"><code>160</code></td>
|
147 |
+
<td align="left">None</td>
|
148 |
+
</tr>
|
149 |
+
|
150 |
+
<tr>
|
151 |
+
<td align="left"><code>visible</code></td>
|
152 |
+
<td align="left" style="width: 25%;">
|
153 |
+
|
154 |
+
```python
|
155 |
+
bool
|
156 |
+
```
|
157 |
+
|
158 |
+
</td>
|
159 |
+
<td align="left"><code>True</code></td>
|
160 |
+
<td align="left">None</td>
|
161 |
+
</tr>
|
162 |
+
|
163 |
+
<tr>
|
164 |
+
<td align="left"><code>elem_id</code></td>
|
165 |
+
<td align="left" style="width: 25%;">
|
166 |
+
|
167 |
+
```python
|
168 |
+
str | None
|
169 |
+
```
|
170 |
+
|
171 |
+
</td>
|
172 |
+
<td align="left"><code>None</code></td>
|
173 |
+
<td align="left">None</td>
|
174 |
+
</tr>
|
175 |
+
|
176 |
+
<tr>
|
177 |
+
<td align="left"><code>elem_classes</code></td>
|
178 |
+
<td align="left" style="width: 25%;">
|
179 |
+
|
180 |
+
```python
|
181 |
+
list[str] | str | None
|
182 |
+
```
|
183 |
+
|
184 |
+
</td>
|
185 |
+
<td align="left"><code>None</code></td>
|
186 |
+
<td align="left">None</td>
|
187 |
+
</tr>
|
188 |
+
|
189 |
+
<tr>
|
190 |
+
<td align="left"><code>render</code></td>
|
191 |
+
<td align="left" style="width: 25%;">
|
192 |
+
|
193 |
+
```python
|
194 |
+
bool
|
195 |
+
```
|
196 |
+
|
197 |
+
</td>
|
198 |
+
<td align="left"><code>True</code></td>
|
199 |
+
<td align="left">None</td>
|
200 |
+
</tr>
|
201 |
+
|
202 |
+
<tr>
|
203 |
+
<td align="left"><code>key</code></td>
|
204 |
+
<td align="left" style="width: 25%;">
|
205 |
+
|
206 |
+
```python
|
207 |
+
int | str | None
|
208 |
+
```
|
209 |
+
|
210 |
+
</td>
|
211 |
+
<td align="left"><code>None</code></td>
|
212 |
+
<td align="left">None</td>
|
213 |
+
</tr>
|
214 |
+
</tbody></table>
|
215 |
+
|
216 |
+
|
217 |
+
### Events
|
218 |
+
|
219 |
+
| name | description |
|
220 |
+
|:-----|:------------|
|
221 |
+
| `change` | Triggered when the value of the MSAPlot changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
|
222 |
+
| `clear` | Triggered when the plot is cleared. |
|
223 |
+
|
224 |
+
|
225 |
+
|
226 |
+
### User function
|
227 |
+
|
228 |
+
The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
|
229 |
+
|
230 |
+
- When used as an Input, the component only impacts the input signature of the user function.
|
231 |
+
- When used as an output, the component only impacts the return signature of the user function.
|
232 |
+
|
233 |
+
The code snippet below is accurate in cases where the component is used as both an input and an output.
|
234 |
+
|
235 |
+
- **As output:** Is passed, the preprocessed input data sent to the user's function in the backend.
|
236 |
+
- **As input:** Should return, the output data received by the component from the user's function in the backend.
|
237 |
+
|
238 |
+
```python
|
239 |
+
def predict(
|
240 |
+
value: MSAPlotData | None
|
241 |
+
) -> MSAPlotData:
|
242 |
+
return value
|
243 |
+
```
|
244 |
+
|
245 |
+
|
246 |
+
## `MSAPlotData`
|
247 |
+
|
248 |
+
### Initialization
|
249 |
+
|
250 |
+
<table>
|
251 |
+
<thead>
|
252 |
+
<tr>
|
253 |
+
<th align="left">name</th>
|
254 |
+
<th align="left" style="width: 25%;">type</th>
|
255 |
+
<th align="left">default</th>
|
256 |
+
<th align="left">description</th>
|
257 |
+
</tr>
|
258 |
+
</thead>
|
259 |
+
<tbody>
|
260 |
+
<tr>
|
261 |
+
<td align="left"><code>data</code></td>
|
262 |
+
<td align="left" style="width: 25%;">
|
263 |
+
|
264 |
+
```python
|
265 |
+
typing.Any
|
266 |
+
```
|
267 |
+
|
268 |
+
</td>
|
269 |
+
<td align="left"><code>None</code></td>
|
270 |
+
<td align="left">None</td>
|
271 |
+
</tr>
|
272 |
+
</tbody></table>
|
273 |
+
|
274 |
+
|
275 |
+
|
276 |
+
|