Spaces:
Running
Running
Erva Ulusoy
commited on
Commit
·
31935f9
1
Parent(s):
f465b10
updated legend layout
Browse files- visualize_kg.py +20 -10
visualize_kg.py
CHANGED
@@ -274,9 +274,14 @@ def visualize_protein_subgraph(data, protein_id, prediction_df, limit=10):
|
|
274 |
border: 1px solid #ddd;
|
275 |
border-radius: 5px;
|
276 |
font-family: Arial, sans-serif;
|
|
|
|
|
|
|
|
|
|
|
277 |
}
|
278 |
-
.legend-section {
|
279 |
-
|
280 |
}
|
281 |
.legend-title {
|
282 |
margin-bottom: 15px;
|
@@ -284,9 +289,14 @@ def visualize_protein_subgraph(data, protein_id, prediction_df, limit=10):
|
|
284 |
font-size: 16px;
|
285 |
font-weight: bold;
|
286 |
}
|
287 |
-
.
|
|
|
|
|
|
|
|
|
|
|
288 |
display: grid;
|
289 |
-
grid-template-columns:
|
290 |
gap: 12px;
|
291 |
}
|
292 |
.legend-item {
|
@@ -312,11 +322,11 @@ def visualize_protein_subgraph(data, protein_id, prediction_df, limit=10):
|
|
312 |
}
|
313 |
</style>
|
314 |
<div class="kg-legend">
|
315 |
-
<div class="legend-section">
|
316 |
<div class="legend-title">Node Types</div>
|
317 |
-
<div class="
|
318 |
|
319 |
-
# Node types
|
320 |
for node_type, color in NODE_TYPE_COLORS.items():
|
321 |
legend_html += f"""
|
322 |
<div class="legend-item">
|
@@ -324,13 +334,13 @@ def visualize_protein_subgraph(data, protein_id, prediction_df, limit=10):
|
|
324 |
<span class="legend-label">{node_type}</span>
|
325 |
</div>"""
|
326 |
|
327 |
-
# Edge types
|
328 |
legend_html += """
|
329 |
</div>
|
330 |
</div>
|
331 |
-
<div class="legend-section">
|
332 |
<div class="legend-title">Edge Colors</div>
|
333 |
-
<div class="
|
334 |
<div class="legend-item">
|
335 |
<div class="edge-indicator" style="background-color: #8338ec;"></div>
|
336 |
<span class="legend-label">Validated GO Prediction</span>
|
|
|
274 |
border: 1px solid #ddd;
|
275 |
border-radius: 5px;
|
276 |
font-family: Arial, sans-serif;
|
277 |
+
display: flex;
|
278 |
+
gap: 20px;
|
279 |
+
}
|
280 |
+
.legend-section-nodes {
|
281 |
+
flex: 2; /* Takes up 2/3 of the space */
|
282 |
}
|
283 |
+
.legend-section-edges {
|
284 |
+
flex: 1; /* Takes up 1/3 of the space */
|
285 |
}
|
286 |
.legend-title {
|
287 |
margin-bottom: 15px;
|
|
|
289 |
font-size: 16px;
|
290 |
font-weight: bold;
|
291 |
}
|
292 |
+
.nodes-grid {
|
293 |
+
display: grid;
|
294 |
+
grid-template-columns: repeat(2, 1fr);
|
295 |
+
gap: 12px;
|
296 |
+
}
|
297 |
+
.edges-grid {
|
298 |
display: grid;
|
299 |
+
grid-template-columns: 1fr;
|
300 |
gap: 12px;
|
301 |
}
|
302 |
.legend-item {
|
|
|
322 |
}
|
323 |
</style>
|
324 |
<div class="kg-legend">
|
325 |
+
<div class="legend-section-nodes">
|
326 |
<div class="legend-title">Node Types</div>
|
327 |
+
<div class="nodes-grid">"""
|
328 |
|
329 |
+
# Node types in 2 columns
|
330 |
for node_type, color in NODE_TYPE_COLORS.items():
|
331 |
legend_html += f"""
|
332 |
<div class="legend-item">
|
|
|
334 |
<span class="legend-label">{node_type}</span>
|
335 |
</div>"""
|
336 |
|
337 |
+
# Edge types in 1 column
|
338 |
legend_html += """
|
339 |
</div>
|
340 |
</div>
|
341 |
+
<div class="legend-section-edges">
|
342 |
<div class="legend-title">Edge Colors</div>
|
343 |
+
<div class="edges-grid">
|
344 |
<div class="legend-item">
|
345 |
<div class="edge-indicator" style="background-color: #8338ec;"></div>
|
346 |
<span class="legend-label">Validated GO Prediction</span>
|