Skip to content

Commit

Permalink
improve tooltips style and strains visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
gcroci2 committed Sep 27, 2024
1 parent a74d8b5 commit e73db0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
14 changes: 8 additions & 6 deletions app/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,21 @@ def process_bgc_class(bgc_class: tuple[str, ...] | None) -> list[str]:

for gcf in gcfs:
gcf_bgc_classes = [cls for bgc in gcf.bgcs for cls in bgc_to_class[bgc.id]]
bgc_ids = [bgc.id for bgc in gcf.bgcs]
bgc_smiles = [
bgc.smiles[0] if bgc.smiles and bgc.smiles[0] is not None else "N/A"
bgc_data = [
(bgc.id, bgc.smiles[0] if bgc.smiles and bgc.smiles[0] is not None else "N/A")
for bgc in gcf.bgcs
]
strains = [str(gcf.strains)]
bgc_data.sort(key=lambda x: x[0])
bgc_ids, bgc_smiles = zip(*bgc_data)
strains = [s.id for s in gcf.strains._strains]
strains.sort()
processed_data["gcf_data"].append(
{
"GCF ID": gcf.id,
"# BGCs": len(gcf.bgcs),
"BGC Classes": list(set(gcf_bgc_classes)), # Using set to get unique classes
"BGC IDs": bgc_ids,
"BGC smiles": bgc_smiles,
"BGC IDs": list(bgc_ids),
"BGC smiles": list(bgc_smiles),
"strains": strains,
}
)
Expand Down
11 changes: 10 additions & 1 deletion app/layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,16 @@
css=[
{
"selector": ".dash-table-tooltip",
"rule": "background-color: white; font-family: monospace; max-width: none !important; white-space: pre-wrap; padding: 5px;",
"rule": """
background-color: #ffd8cc;
font-family: monospace;
font-size: 12px;
max-width: none !important;
white-space: pre-wrap;
padding: 8px;
border: 1px solid #FF6E42;
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
""",
}
],
tooltip={"type": "markdown"},
Expand Down

0 comments on commit e73db0f

Please sign in to comment.