|
| 1 | +--- |
| 2 | +name: galaxy-workflow-viz |
| 3 | +description: Generate Galaxy-branded workflow visualization SVGs for IWC workflows. Creates static diagrams matching Galaxy's workflow editor style with bezier connections, node cards, and proper terminal positioning. Use when creating visual diagrams for workflows in this repository. |
| 4 | +--- |
| 5 | + |
| 6 | +# Galaxy Workflow Visualization |
| 7 | + |
| 8 | +Generate beautiful, static SVG workflow diagrams that match Galaxy's workflow editor visual style. |
| 9 | + |
| 10 | +## When to Use This Skill |
| 11 | + |
| 12 | +Use when: |
| 13 | +- Creating visual diagrams for IWC workflow files (in `workflows/` directory) |
| 14 | +- Generating workflow overview graphics for documentation |
| 15 | +- Building workflow previews for the IWC website (iwc.galaxyproject.org) |
| 16 | +- Need a Galaxy-branded visualization of a pipeline |
| 17 | + |
| 18 | +## Relationship to Mermaid Diagrams |
| 19 | + |
| 20 | +This repository already generates Mermaid diagrams via `scripts/create_mermaid.py` - those show the complete step-by-step workflow structure and are useful for detailed technical documentation. |
| 21 | + |
| 22 | +This skill creates **complementary** visualizations that are: |
| 23 | +- **Simplified** - Shows the workflow story, not every utility step |
| 24 | +- **Branded** - Matches Galaxy's workflow editor visual style |
| 25 | +- **Beautiful** - Designed for marketing, landing pages, and quick overviews |
| 26 | +- **Hand-crafted** - LLM-generated with human review for quality |
| 27 | + |
| 28 | +## IWC Workflow Locations |
| 29 | + |
| 30 | +Workflows in this repository are organized by domain: |
| 31 | +- `workflows/epigenetics/` - ChIP-seq, ATAC-seq, Hi-C |
| 32 | +- `workflows/transcriptomics/` - RNA-seq |
| 33 | +- `workflows/proteomics/` - Mass spec analysis |
| 34 | +- `workflows/computational-chemistry/` - GROMACS, docking |
| 35 | +- `workflows/genome-assembly/` - Assembly pipelines |
| 36 | +- `workflows/variant-calling/` - SNP/variant detection |
| 37 | + |
| 38 | +Each workflow directory contains a `.ga` file (Galaxy workflow JSON format). |
| 39 | + |
| 40 | +## Visual Style Reference |
| 41 | + |
| 42 | +The output should match Galaxy's actual workflow editor appearance. |
| 43 | + |
| 44 | +### Colors (Galaxy Theme) |
| 45 | + |
| 46 | +``` |
| 47 | +Primary (brand-primary): #25537b - Node headers, connections, borders |
| 48 | +Background grid light: #c5d5e4 - Minor grid lines |
| 49 | +Background grid major: #b0c4d8 - Major grid lines |
| 50 | +Canvas background: #f8f9fa - Light gray |
| 51 | +Input nodes: #ffd700 - Gold for workflow data inputs |
| 52 | +Output nodes: #f97316 - Orange for workflow outputs |
| 53 | +Report/QC nodes: #10b981 - Green for MultiQC, reports |
| 54 | +Text primary: #495057 - Body text |
| 55 | +Text secondary: #868e96 - Descriptions, labels |
| 56 | +Input node text: #2C3143 - Dark text on gold background |
| 57 | +``` |
| 58 | + |
| 59 | +### Node Color Semantics |
| 60 | + |
| 61 | +Use colors to convey meaning at a glance: |
| 62 | +- **Gold (#ffd700)**: Data inputs - FASTQs, reference files, GTF annotations, sample sheets |
| 63 | +- **Blue (#25537b)**: Processing/analysis steps - the main workflow tools |
| 64 | +- **Orange (#f97316)**: Final outputs - the deliverables users care about |
| 65 | +- **Green (#10b981)**: QC/Reports - MultiQC, quality summaries |
| 66 | + |
| 67 | +### Node Design |
| 68 | + |
| 69 | +Nodes are Bootstrap-style cards: |
| 70 | +- **Width**: ~180-200px for standard nodes |
| 71 | +- **Border radius**: 4px |
| 72 | +- **Border**: 1px solid #25537b |
| 73 | +- **Header**: 28px tall, filled with #25537b, white text |
| 74 | +- **Header content**: Step number + tool name (e.g., "2: fastp") |
| 75 | +- **Body**: White background, contains description text |
| 76 | +- **Drop shadow**: `drop-shadow(1px 2px 3px rgba(0,0,0,0.15))` |
| 77 | + |
| 78 | +### Connection Terminals |
| 79 | + |
| 80 | +- **Standard terminal**: 6px radius circle, white fill, 2px #25537b stroke |
| 81 | +- **Small terminal** (QC outputs): 5px radius, 1.5px stroke |
| 82 | +- **Position**: At edge of node card (cx=0 for inputs, cx=width for outputs) |
| 83 | + |
| 84 | +### Connection Lines (Bezier "Noodles") |
| 85 | + |
| 86 | +- **Stroke width**: 4px for main flow, 3px for secondary |
| 87 | +- **Color**: #25537b (same as nodes) |
| 88 | +- **Line cap**: round |
| 89 | +- **QC/optional connections**: stroke-dasharray="5 3" |
| 90 | +- **Curve style**: Cubic bezier (CSS curveBasis approximation) |
| 91 | + |
| 92 | +Forward connection (left-to-right): |
| 93 | +``` |
| 94 | +M startX startY |
| 95 | +C (startX + shift) startY, (endX - shift) endY, endX endY |
| 96 | +``` |
| 97 | + |
| 98 | +Where `shift = 15 + (distanceX * 0.15) + (distanceY * 0.08)` |
| 99 | + |
| 100 | +## SVG Structure Template |
| 101 | + |
| 102 | +```xml |
| 103 | +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 WIDTH HEIGHT" role="img" aria-label="WORKFLOW_NAME workflow diagram"> |
| 104 | + <title>WORKFLOW_NAME</title> |
| 105 | + <desc>Brief description of the workflow</desc> |
| 106 | + |
| 107 | + <defs> |
| 108 | + <!-- Grid pattern --> |
| 109 | + <pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"> |
| 110 | + <path d="M 20 0 L 0 0 0 20" fill="none" stroke="#c5d5e4" stroke-width="0.5"/> |
| 111 | + </pattern> |
| 112 | + <pattern id="grid-major" width="100" height="100" patternUnits="userSpaceOnUse"> |
| 113 | + <rect width="100" height="100" fill="url(#grid)"/> |
| 114 | + <path d="M 100 0 L 0 0 0 100" fill="none" stroke="#b0c4d8" stroke-width="1"/> |
| 115 | + </pattern> |
| 116 | + |
| 117 | + <style> |
| 118 | + .connection { |
| 119 | + stroke: #25537b; |
| 120 | + stroke-width: 4; |
| 121 | + fill: none; |
| 122 | + stroke-linecap: round; |
| 123 | + } |
| 124 | + .connection-qc { |
| 125 | + stroke: #25537b; |
| 126 | + stroke-width: 3; |
| 127 | + fill: none; |
| 128 | + stroke-linecap: round; |
| 129 | + stroke-dasharray: 5 3; |
| 130 | + } |
| 131 | + .node-card { |
| 132 | + filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.15)); |
| 133 | + } |
| 134 | + </style> |
| 135 | + </defs> |
| 136 | + |
| 137 | + <!-- Background --> |
| 138 | + <rect width="WIDTH" height="HEIGHT" fill="#f8f9fa"/> |
| 139 | + <rect width="WIDTH" height="HEIGHT" fill="url(#grid-major)"/> |
| 140 | + |
| 141 | + <!-- Title bar --> |
| 142 | + <rect x="0" y="0" width="WIDTH" height="45" fill="#25537b"/> |
| 143 | + <text x="20" y="28" font-family="system-ui, sans-serif" font-size="16" font-weight="600" fill="white"> |
| 144 | + WORKFLOW_NAME |
| 145 | + </text> |
| 146 | + |
| 147 | + <!-- CONNECTIONS (draw first, behind nodes) --> |
| 148 | + <!-- ... bezier paths ... --> |
| 149 | + |
| 150 | + <!-- NODES --> |
| 151 | + <!-- ... node groups ... --> |
| 152 | + |
| 153 | + <!-- Legend (optional) --> |
| 154 | +</svg> |
| 155 | +``` |
| 156 | + |
| 157 | +## Node Template (Processing - Blue) |
| 158 | + |
| 159 | +Standard processing/analysis nodes use blue (#25537b): |
| 160 | + |
| 161 | +```xml |
| 162 | +<g class="node-card" transform="translate(X, Y)"> |
| 163 | + <rect width="200" height="90" rx="4" fill="white" stroke="#25537b" stroke-width="1"/> |
| 164 | + <rect width="200" height="28" rx="4" fill="#25537b"/> |
| 165 | + <rect x="0" y="24" width="200" height="4" fill="#25537b"/> |
| 166 | + <text x="10" y="19" font-family="system-ui, sans-serif" font-size="11" fill="rgba(255,255,255,0.7)">N:</text> |
| 167 | + <text x="26" y="19" font-family="system-ui, sans-serif" font-size="11" font-weight="600" fill="white">Tool Name</text> |
| 168 | + <text x="100" y="55" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#495057">Description</text> |
| 169 | + <text x="100" y="72" text-anchor="middle" font-family="system-ui, sans-serif" font-size="9" fill="#868e96">Subtitle</text> |
| 170 | + <!-- Input terminal at left edge --> |
| 171 | + <circle cx="0" cy="45" r="6" fill="white" stroke="#25537b" stroke-width="2"/> |
| 172 | + <!-- Output terminal at right edge --> |
| 173 | + <circle cx="200" cy="45" r="6" fill="white" stroke="#25537b" stroke-width="2"/> |
| 174 | +</g> |
| 175 | +``` |
| 176 | + |
| 177 | +## Input Node Template (Gold header) |
| 178 | + |
| 179 | +Data input nodes use gold (#ffd700) with dark text (#2C3143): |
| 180 | + |
| 181 | +```xml |
| 182 | +<g class="node-card" transform="translate(X, Y)"> |
| 183 | + <rect width="180" height="90" rx="4" fill="white" stroke="#ffd700" stroke-width="1.5"/> |
| 184 | + <rect width="180" height="28" rx="4" fill="#ffd700"/> |
| 185 | + <rect x="0" y="24" width="180" height="4" fill="#ffd700"/> |
| 186 | + <text x="10" y="19" font-family="system-ui, sans-serif" font-size="11" fill="rgba(44,49,67,0.6)">1:</text> |
| 187 | + <text x="26" y="19" font-family="system-ui, sans-serif" font-size="11" font-weight="600" fill="#2C3143">Input Name</text> |
| 188 | + <text x="90" y="55" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" fill="#495057">Data type</text> |
| 189 | + <text x="90" y="72" text-anchor="middle" font-family="system-ui, sans-serif" font-size="9" fill="#868e96">Description</text> |
| 190 | + <!-- Output terminal only (inputs have no input terminal) --> |
| 191 | + <circle cx="180" cy="45" r="6" fill="white" stroke="#ffd700" stroke-width="2"/> |
| 192 | +</g> |
| 193 | +``` |
| 194 | + |
| 195 | +## Output Node Template (Orange header) |
| 196 | + |
| 197 | +```xml |
| 198 | +<g class="node-card" transform="translate(X, Y)"> |
| 199 | + <rect width="100" height="50" rx="4" fill="white" stroke="#f97316" stroke-width="1.5"/> |
| 200 | + <rect width="100" height="20" rx="4" fill="#f97316"/> |
| 201 | + <rect x="0" y="16" width="100" height="4" fill="#f97316"/> |
| 202 | + <text x="50" y="14" text-anchor="middle" font-family="system-ui, sans-serif" font-size="10" font-weight="600" fill="white">Output Name</text> |
| 203 | + <text x="50" y="38" text-anchor="middle" font-family="system-ui, sans-serif" font-size="8" fill="#868e96">format info</text> |
| 204 | + <circle cx="50" cy="0" r="5" fill="white" stroke="#f97316" stroke-width="2"/> |
| 205 | +</g> |
| 206 | +``` |
| 207 | + |
| 208 | +## Subworkflow Node Template |
| 209 | + |
| 210 | +For workflows containing subworkflows, use a larger card with diagonal stripe pattern: |
| 211 | + |
| 212 | +```xml |
| 213 | +<g class="subworkflow-card" transform="translate(X, Y)"> |
| 214 | + <rect width="280" height="170" rx="6" fill="url(#subworkflow-pattern)" stroke="#25537b" stroke-width="2"/> |
| 215 | + <rect width="280" height="170" rx="6" fill="rgba(255,255,255,0.9)" stroke="#25537b" stroke-width="2"/> |
| 216 | + <!-- Header --> |
| 217 | + <rect width="280" height="32" rx="6" fill="#25537b"/> |
| 218 | + <text x="12" y="22" font-family="system-ui, sans-serif" font-size="14" fill="white">⎔</text> |
| 219 | + <text x="30" y="22" font-family="system-ui, sans-serif" font-size="12" font-weight="700" fill="white">Subworkflow Name</text> |
| 220 | + <!-- Inner content: mini flow diagram, output list --> |
| 221 | +</g> |
| 222 | +``` |
| 223 | + |
| 224 | +## Legend Template |
| 225 | + |
| 226 | +Include a legend at the bottom of the diagram: |
| 227 | + |
| 228 | +```xml |
| 229 | +<g transform="translate(X, Y)"> |
| 230 | + <text x="0" y="0" font-family="system-ui, sans-serif" font-size="10" font-weight="600" fill="#495057">Legend:</text> |
| 231 | + <!-- Input --> |
| 232 | + <rect x="60" y="-10" width="14" height="14" rx="2" fill="white" stroke="#ffd700" stroke-width="1.5"/> |
| 233 | + <text x="80" y="0" font-family="system-ui, sans-serif" font-size="9" fill="#6c757d">Input</text> |
| 234 | + <!-- Data flow --> |
| 235 | + <line x1="120" y1="-4" x2="160" y2="-4" stroke="#25537b" stroke-width="4" stroke-linecap="round"/> |
| 236 | + <text x="168" y="0" font-family="system-ui, sans-serif" font-size="9" fill="#6c757d">Data flow</text> |
| 237 | + <!-- QC metrics --> |
| 238 | + <line x1="240" y1="-4" x2="280" y2="-4" stroke="#25537b" stroke-width="3" stroke-linecap="round" stroke-dasharray="5 3"/> |
| 239 | + <text x="288" y="0" font-family="system-ui, sans-serif" font-size="9" fill="#6c757d">QC metrics</text> |
| 240 | + <!-- Output --> |
| 241 | + <rect x="360" y="-10" width="14" height="14" rx="2" fill="white" stroke="#f97316" stroke-width="1.5"/> |
| 242 | + <text x="380" y="0" font-family="system-ui, sans-serif" font-size="9" fill="#6c757d">Output</text> |
| 243 | + <!-- Report --> |
| 244 | + <rect x="430" y="-10" width="14" height="14" rx="2" fill="white" stroke="#10b981" stroke-width="1.5"/> |
| 245 | + <text x="450" y="0" font-family="system-ui, sans-serif" font-size="9" fill="#6c757d">Report</text> |
| 246 | +</g> |
| 247 | +``` |
| 248 | + |
| 249 | +## Workflow Analysis Process |
| 250 | + |
| 251 | +When given a .ga file: |
| 252 | + |
| 253 | +1. **Identify the main spine** - The longest path of domain-meaningful steps |
| 254 | +2. **Classify tools** by category: |
| 255 | + - Input (data inputs, not parameters) |
| 256 | + - QC (fastp, FastQC, trimming tools) |
| 257 | + - Mapping (bowtie2, bwa, STAR, HISAT2) |
| 258 | + - Filtering (samtools filter, dedup) |
| 259 | + - Analysis (MACS2, featureCounts, DESeq2, domain-specific tools) |
| 260 | + - Report (MultiQC) |
| 261 | + - Output (workflow outputs) |
| 262 | + |
| 263 | +3. **Simplify** - Don't show every step: |
| 264 | + - Skip utility steps (format conversion, flatten collection, map_param_value) |
| 265 | + - Skip parameter inputs (quality %, thresholds, boolean flags) |
| 266 | + - Keep data inputs (FASTQs, reference files, GTF annotations) |
| 267 | + - Group repeated similar steps if needed |
| 268 | + - Represent subworkflows as single boxes showing their purpose |
| 269 | + |
| 270 | +4. **Layout** - Arrange for clarity: |
| 271 | + - Main spine flows left-to-right |
| 272 | + - QC branches curve down to a MultiQC node |
| 273 | + - Outputs positioned below or to the side of final analysis |
| 274 | + - Subworkflows as larger boxes with mini flow diagrams inside |
| 275 | + |
| 276 | +## Connection Math |
| 277 | + |
| 278 | +For a connection from output terminal at (x1, y1) to input terminal at (x2, y2): |
| 279 | + |
| 280 | +```javascript |
| 281 | +// Calculate line shift based on Galaxy's algorithm |
| 282 | +const distanceX = Math.abs(x2 - x1); |
| 283 | +const distanceY = Math.abs(y2 - y1); |
| 284 | +const shift = 15 + (distanceX * 0.15) + (distanceY * 0.08); |
| 285 | + |
| 286 | +// Forward connection (x2 >= x1) |
| 287 | +const path = `M ${x1} ${y1} C ${x1 + shift} ${y1}, ${x2 - shift} ${y2}, ${x2} ${y2}`; |
| 288 | + |
| 289 | +// Reverse connection (x2 < x1) - needs extra control points |
| 290 | +const lineShiftY = (y2 - y1) / 2; |
| 291 | +const path = `M ${x1} ${y1} |
| 292 | + C ${x1 + shift} ${y1}, ${x1 + shift} ${y1 + lineShiftY}, ${x1 + shift} ${y1 + lineShiftY} |
| 293 | + C ${x2 - shift} ${y2 - lineShiftY}, ${x2 - shift} ${y2}, ${x2} ${y2}`; |
| 294 | +``` |
| 295 | + |
| 296 | +## Critical Rules |
| 297 | + |
| 298 | +1. **Connections must connect to terminals** - Calculate absolute positions carefully: |
| 299 | + - Node at `translate(X, Y)` with terminal at `cx=CX, cy=CY` |
| 300 | + - Absolute terminal position is `(X + CX, Y + CY)` |
| 301 | + |
| 302 | +2. **No animations** - Static diagrams only |
| 303 | + |
| 304 | +3. **Draw connections BEFORE nodes** - So nodes appear on top |
| 305 | + |
| 306 | +4. **Include accessibility** - `role="img"`, `aria-label`, `<title>`, `<desc>` |
| 307 | + |
| 308 | +5. **Keep it simple** - Focus on the workflow story, not every detail |
| 309 | + |
| 310 | +## Example Workflows |
| 311 | + |
| 312 | +### Simple Linear (ChIP-seq style) |
| 313 | +``` |
| 314 | +Input → QC/Trim → Mapping → Filtering → Analysis → Outputs |
| 315 | + ↓ |
| 316 | + MultiQC |
| 317 | +``` |
| 318 | + |
| 319 | +### Branching (RNA-seq style) |
| 320 | +``` |
| 321 | +Input → QC → Mapping → ┬→ Quantification → Output |
| 322 | + ├→ Coverage → Output |
| 323 | + └→ MultiQC |
| 324 | +``` |
| 325 | + |
| 326 | +### With Subworkflows (End-to-End DE) |
| 327 | +``` |
| 328 | +Sample Sheet → [RNA-seq Processing] → [DE Analysis] → Results |
| 329 | + GTF ────────────┘ │ |
| 330 | + Volcano Plot |
| 331 | + Heatmaps |
| 332 | +``` |
| 333 | + |
| 334 | +## Input Modes |
| 335 | + |
| 336 | +1. **Path to .ga file**: `workflows/epigenetics/chipseq-pe/chipseq-pe.ga` |
| 337 | +2. **Galaxy API URL**: `https://usegalaxy.org/api/workflows/{id}/download` |
| 338 | +3. **Natural language**: "ChIP-seq workflow with fastp, bowtie2, MACS2" |
| 339 | + |
| 340 | +## Output |
| 341 | + |
| 342 | +Generate a complete, valid SVG file that: |
| 343 | +- Can be viewed directly in a browser |
| 344 | +- Scales cleanly (vector graphics) |
| 345 | +- Matches Galaxy's visual identity |
| 346 | +- Tells the workflow's story clearly |
| 347 | + |
| 348 | +Save SVGs to: |
| 349 | +- The workflow's directory: `workflows/domain/workflow-name/workflow-name-diagram.svg` |
| 350 | +- Or `/tmp/` for review before committing |
0 commit comments