Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 31 additions & 5 deletions .github/scripts/generate_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,12 @@ def qmd_to_skill_offline(filepath: Path, base_url: str = DEFAULT_BASE_URL) -> Di
tips = _generate_tips(content, language, category, headings, all_blocks)
tips_text = "\n".join(f"- {t}" for t in tips)

# Build the skill title: strip any existing language tag from the QMD title to avoid
# duplication (e.g., QMD title "Scatter Plot (Python)" + "(Python)" = "Scatter Plot (Python) (Python)")
skill_title = re.sub(r'\s*\((R|Python|Julia)\)\s*$', '', title, flags=re.IGNORECASE).strip()

skill_text = (
f"# Skill: {title} ({lang_display})\n\n"
f"# Skill: {skill_title} ({lang_display})\n\n"
f"## Category\n{category}\n\n"
f"## When to Use\n{use_when}\n\n"
f"## Required {lang_display} Packages\n{pkg_list}\n\n"
Expand Down Expand Up @@ -327,6 +331,11 @@ def _build_combined_code(content: str, language: str, packages: List[str]) -> st
parts.append("# Load packages\n" + "\n".join(imp_lines))
elif language == 'julia':
using_lines = [f"using {p}" for p in packages[:6]]
# Also add `using Random` if the code references Random functions but Random is not in packages
# (Random is in JULIA_STDLIB so it's excluded from packages list)
all_code = "\n".join(code for _, code in blocks)
if 'Random.' in all_code and 'Random' not in packages:
using_lines.append("using Random")
if using_lines:
parts.append("# Load packages\n" + "\n".join(using_lines))

Expand Down Expand Up @@ -411,14 +420,21 @@ def _extract_key_parameters(content: str, language: str,
jl_params = {
'colormap': 'Color scheme for the plot (e.g., :viridis, :RdBu)',
'markersize': 'Size of scatter plot markers',
'alpha': 'Transparency level (0–1)',
'color': 'Color of plot elements',
'color': 'Color of plot elements (e.g., :steelblue or (:red, 0.5) for alpha)',
'linewidth': 'Width of lines in the plot',
'colorrange': 'Range for color mapping as (min, max) tuple',
'alpha': 'Transparency level (0–1) via color tuple (color, alpha)',
'side': 'Side of violin to draw (:left, :right, or both)',
'width': 'Width of violin or box plot elements',
'bandwidth': 'Kernel bandwidth for density estimation in violin plots',
'size': 'Figure size as (width, height) in pixels',
}
for param, desc in jl_params.items():
if param in combined_code and len(params) < 8:
params[param] = desc
# Detect color tuple usage (alpha via tuple syntax)
if re.search(r'\(\s*:\w+\s*,\s*[\d.]+\s*\)', combined_code) and 'alpha' not in params and len(params) < 8:
params['alpha'] = 'Transparency via color tuple syntax: color=(:steelblue, 0.7)'

# Ensure at least 3 params
if len(params) < 3:
Expand All @@ -430,9 +446,15 @@ def _extract_key_parameters(content: str, language: str,
elif language == 'python':
if 'figsize' not in params:
params['figsize'] = 'Figure dimensions as (width, height) in inches'
if 'alpha' not in params:
params['alpha'] = 'Transparency level (0–1)'
elif language == 'julia':
if 'color' not in params:
params['color'] = 'Color of plot elements'
params['color'] = 'Color of plot elements (e.g., :steelblue or (:red, 0.5) for alpha)'
if 'markersize' not in params:
params['markersize'] = 'Size of scatter plot markers'
if len(params) < 3 and 'size' not in params:
params['size'] = 'Figure size as (width, height) in pixels'

return dict(list(params.items())[:8])

Expand Down Expand Up @@ -553,6 +575,10 @@ def generate_skill(self, filepath: Path,
rel_html = str(filepath.with_suffix(".html")).lstrip("./")
tutorial_url = base_url.rstrip("/") + "/" + rel_html

# Strip language tag from title for the skill header to avoid duplication
# (e.g., "Scatter Plot (Python)" becomes "Scatter Plot" before "(Python)" is appended)
skill_title = re.sub(r'\s*\((R|Python|Julia)\)\s*$', '', title, flags=re.IGNORECASE).strip()

system_prompt = f"""You are an expert at creating AI skill documents for biomedical visualization tutorials.

Follow this specification exactly:
Expand All @@ -572,7 +598,7 @@ def generate_skill(self, filepath: Path,
user_prompt = f"""Convert this Bizard QMD tutorial into a skill document.

**Tutorial metadata:**
- Title: {title}
- Title: {skill_title}
- Language: {lang_display}
- Category: {category}
- Packages detected: {', '.join(packages) if packages else 'none detected'}
Expand Down
74 changes: 74 additions & 0 deletions GraphGallery.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,80 @@ div(
)
```

## 𝐏𝐘𝐓𝐇𝐎𝐍

```{r}
#| echo: false
data_PYTHON <- data[data$Level1=="PYTHON",]

tbl <- reactable(
data_PYTHON,
defaultColDef = colDef(vAlign = "center", headerClass = "header"),
columns = list(
Id = colDef(
name = "Id", align = "center", minWidth = 70, maxWidth = 90
),
Name = colDef(
name = "Graph", cell = JS("renderGraph"), html = TRUE, minWidth = 250
),
Image_url = colDef(show = FALSE),
Tutorial_url = colDef(show = FALSE),
Description =colDef(show = FALSE),
Type = colDef(name = "Type"),
Level1 =colDef(show = FALSE),
Level2 =colDef(show = FALSE)
),
searchable = TRUE,
defaultPageSize = 7
)

div(
class = "movies",
tbl,
div(id = "modal", class="modal", onclick="hideModal()",
img(
id="modal-image", class="modal-image"
))
)
```

## 𝐉𝐔𝐋𝐈𝐀

```{r}
#| echo: false
data_JULIA <- data[data$Level1=="JULIA",]

tbl <- reactable(
data_JULIA,
defaultColDef = colDef(vAlign = "center", headerClass = "header"),
columns = list(
Id = colDef(
name = "Id", align = "center", minWidth = 70, maxWidth = 90
),
Name = colDef(
name = "Graph", cell = JS("renderGraph"), html = TRUE, minWidth = 250
),
Image_url = colDef(show = FALSE),
Tutorial_url = colDef(show = FALSE),
Description =colDef(show = FALSE),
Type = colDef(name = "Type"),
Level1 =colDef(show = FALSE),
Level2 =colDef(show = FALSE)
),
searchable = TRUE,
defaultPageSize = 7
)

div(
class = "movies",
tbl,
div(id = "modal", class="modal", onclick="hideModal()",
img(
id="modal-image", class="modal-image"
))
)
```

## 𝐇𝐈𝐏𝐋𝐎𝐓

### BASICS
Expand Down
74 changes: 74 additions & 0 deletions GraphGallery.zh.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,80 @@ div(
)
```

## 𝐏𝐘𝐓𝐇𝐎𝐍

```{r}
#| echo: false
data_PYTHON <- data[data$Level1=="PYTHON",]

tbl <- reactable(
data_PYTHON,
defaultColDef = colDef(vAlign = "center", headerClass = "header"),
columns = list(
Id = colDef(
name = "Id", align = "center", minWidth = 70, maxWidth = 90
),
Name = colDef(
name = "Graph", cell = JS("renderGraph"), html = TRUE, minWidth = 250
),
Image_url = colDef(show = FALSE),
Tutorial_url = colDef(show = FALSE),
Description =colDef(show = FALSE),
Type = colDef(name = "Type"),
Level1 =colDef(show = FALSE),
Level2 =colDef(show = FALSE)
),
searchable = TRUE,
defaultPageSize = 7
)

div(
class = "movies",
tbl,
div(id = "modal", class="modal", onclick="hideModal()",
img(
id="modal-image", class="modal-image"
))
)
```

## 𝐉𝐔𝐋𝐈𝐀

```{r}
#| echo: false
data_JULIA <- data[data$Level1=="JULIA",]

tbl <- reactable(
data_JULIA,
defaultColDef = colDef(vAlign = "center", headerClass = "header"),
columns = list(
Id = colDef(
name = "Id", align = "center", minWidth = 70, maxWidth = 90
),
Name = colDef(
name = "Graph", cell = JS("renderGraph"), html = TRUE, minWidth = 250
),
Image_url = colDef(show = FALSE),
Tutorial_url = colDef(show = FALSE),
Description =colDef(show = FALSE),
Type = colDef(name = "Type"),
Level1 =colDef(show = FALSE),
Level2 =colDef(show = FALSE)
),
searchable = TRUE,
defaultPageSize = 7
)

div(
class = "movies",
tbl,
div(id = "modal", class="modal", onclick="hideModal()",
img(
id="modal-image", class="modal-image"
))
)
```

## 𝐇𝐈𝐏𝐋𝐎𝐓

### 基础
Expand Down
7 changes: 7 additions & 0 deletions files/gallery_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -785,3 +785,10 @@
784,Dice Plot with custom theme,https://openbiox.github.io/Bizard/Proportion/DicePlot_files/figure-html/fig-3ThemedDice-1.png,https://openbiox.github.io/Bizard/Proportion/DicePlot.html#fig-3ThemedDice,The package includes theme_dice() for cleaner visualization,Dice Plot,BASICS,Proportion
785,Basic Text Enrichment BarPlot,https://openbiox.github.io/Bizard/Omics/TextEnrichmentBarPlot_files/figure-html/fig1.SimpleRound-1.png,https://openbiox.github.io/Bizard/Omics/TextEnrichmentBarPlot.html#basic-plotting-simplified-version,Basic Enrichment Analysis Barplot,Text Enrichment BarPlot,OMICS,TextEnrichmentBarPlot
786,Advanced Enrichment Analysis Barplot,https://openbiox.github.io/Bizard/Omics/TextEnrichmentBarPlot_files/figure-html/fig2.ComplexRound-1.png,https://openbiox.github.io/Bizard/Omics/TextEnrichmentBarPlot.html#advanced-plotting-detailed-version,Advanced Enrichment Analysis Barplot,Text Enrichment BarPlot,OMICS,TextEnrichmentBarPlot
787,Scatter Plot (Python),https://openbiox.github.io/Bizard/images/Python/ScatterPlot_demo.png,https://openbiox.github.io/Bizard/Python/ScatterPlot.html,Scatter plot showing correlations using matplotlib and seaborn,Scatter Plot,PYTHON,Python
788,Violin Plot (Python),https://openbiox.github.io/Bizard/images/Python/ViolinPlot_demo.png,https://openbiox.github.io/Bizard/Python/ViolinPlot.html,Violin plot combining box plot and kernel density estimation,Violin Plot,PYTHON,Python
789,Heatmap (Python),https://openbiox.github.io/Bizard/images/Python/Heatmap_demo.png,https://openbiox.github.io/Bizard/Python/Heatmap.html,Heatmap for gene expression profiles and correlation matrices,Heatmap,PYTHON,Python
790,Volcano Plot (Python),https://openbiox.github.io/Bizard/images/Python/VolcanoPlot_demo.png,https://openbiox.github.io/Bizard/Python/VolcanoPlot.html,Volcano plot for differential expression analysis,Volcano Plot,PYTHON,Python
791,Scatter Plot (Julia),https://openbiox.github.io/Bizard/images/Julia/ScatterPlot_demo.png,https://openbiox.github.io/Bizard/Julia/ScatterPlot.html,High-performance scatter plot using CairoMakie,Scatter Plot,JULIA,Julia
792,Violin Plot (Julia),https://openbiox.github.io/Bizard/images/Julia/ViolinPlot_demo.png,https://openbiox.github.io/Bizard/Julia/ViolinPlot.html,Violin plot for distribution comparison using CairoMakie,Violin Plot,JULIA,Julia
793,Heatmap (Julia),https://openbiox.github.io/Bizard/images/Julia/Heatmap_demo.png,https://openbiox.github.io/Bizard/Julia/Heatmap.html,Heatmap for matrix visualization using CairoMakie,Heatmap,JULIA,Julia
7 changes: 7 additions & 0 deletions files/gallery_data_zh.csv
Original file line number Diff line number Diff line change
Expand Up @@ -785,3 +785,10 @@
784,自定义骰子图主题,https://openbiox.github.io/Bizard/zh/Proportion/DicePlot_files/figure-html/fig-3ThemedDice-1.png,https://openbiox.github.io/Bizard/zh/Proportion/DicePlot.html#fig-3ThemedDice,该包包含 theme_dice() 以实现更清晰的可视化,骰子图,BASICS,Proportion
785,基础富集分析柱状图,https://openbiox.github.io/Bizard/zh/Omics/TextEnrichmentBarPlot_files/figure-html/fig1.SimpleRound-1.png,https://openbiox.github.io/Bizard/zh/Omics/TextEnrichmentBarPlot.html#basic-plotting-simplified-version,基础富集分析柱状图,文字叠加的富集分析柱状图,OMICS,TextEnrichmentBarPlot
786,进阶富集分析柱状图,https://openbiox.github.io/Bizard/zh/Omics/TextEnrichmentBarPlot_files/figure-html/fig2.ComplexRound-1.png,https://openbiox.github.io/Bizard/zh/Omics/TextEnrichmentBarPlot.html#advanced-plotting-detailed-version,进阶富集分析柱状图,文字叠加的富集分析柱状图,OMICS,TextEnrichmentBarPlot
787,散点图 (Python),https://openbiox.github.io/Bizard/images/Python/ScatterPlot_demo.png,https://openbiox.github.io/Bizard/zh/Python/ScatterPlot.html,使用 matplotlib 和 seaborn 绘制散点图展示变量间相关性,散点图,PYTHON,Python
788,小提琴图 (Python),https://openbiox.github.io/Bizard/images/Python/ViolinPlot_demo.png,https://openbiox.github.io/Bizard/zh/Python/ViolinPlot.html,小提琴图结合箱线图和核密度估计展示数据分布,小提琴图,PYTHON,Python
789,热力图 (Python),https://openbiox.github.io/Bizard/images/Python/Heatmap_demo.png,https://openbiox.github.io/Bizard/zh/Python/Heatmap.html,热力图用于基因表达谱和相关性矩阵可视化,热力图,PYTHON,Python
790,火山图 (Python),https://openbiox.github.io/Bizard/images/Python/VolcanoPlot_demo.png,https://openbiox.github.io/Bizard/zh/Python/VolcanoPlot.html,火山图用于差异表达分析结果可视化,火山图,PYTHON,Python
791,散点图 (Julia),https://openbiox.github.io/Bizard/images/Julia/ScatterPlot_demo.png,https://openbiox.github.io/Bizard/zh/Julia/ScatterPlot.html,使用 CairoMakie 绘制高性能散点图,散点图,JULIA,Julia
792,小提琴图 (Julia),https://openbiox.github.io/Bizard/images/Julia/ViolinPlot_demo.png,https://openbiox.github.io/Bizard/zh/Julia/ViolinPlot.html,使用 CairoMakie 绘制小提琴图展示数据分布,小提琴图,JULIA,Julia
793,热力图 (Julia),https://openbiox.github.io/Bizard/images/Julia/Heatmap_demo.png,https://openbiox.github.io/Bizard/zh/Julia/Heatmap.html,使用 CairoMakie 绘制热力图进行矩阵可视化,热力图,JULIA,Julia
Binary file modified images/Julia/Heatmap_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Julia/ScatterPlot_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Julia/ViolinPlot_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Python/Heatmap_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Python/ScatterPlot_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Python/ViolinPlot_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Python/VolcanoPlot_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions skills/Julia/Heatmap_skill.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions skills/Julia/ScatterPlot_skill.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions skills/Julia/ViolinPlot_skill.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion skills/Python/Heatmap_skill.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion skills/Python/ScatterPlot_skill.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion skills/Python/ViolinPlot_skill.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion skills/Python/VolcanoPlot_skill.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading