Skip to content

Commit cbd8a52

Browse files
authored
Merge pull request #53 from WEHI-ResearchComputing/feature/gradio-gui
Feature/gradio gui
2 parents e591696 + e0f5c78 commit cbd8a52

31 files changed

Lines changed: 2310 additions & 89 deletions

.github/workflows/deploy.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
defaults:
12+
run:
13+
working-directory: docs
14+
15+
jobs:
16+
deploy:
17+
name: Deploy to GitHub Pages
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
cache: npm
28+
cache-dependency-path: docs/package-lock.json
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Build website
34+
run: npm run build
35+
36+
- name: Deploy to GitHub Pages
37+
uses: peaceiris/actions-gh-pages@v4
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
publish_dir: docs/build
41+
commit_message: "Deploy website"

.github/workflows/singularity.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,42 @@ jobs:
88
build-test-containers:
99
runs-on: ubuntu-latest
1010
strategy:
11-
# Keep going on other deployments if anything bloops
1211
fail-fast: false
1312
matrix:
13+
# Must match an existing tag on quay.io/singularity/singularity (full semver, e.g. 4.1.0 not 4.0).
1414
singularity_version:
15-
- '3.8.1'
15+
- '4.1.0'
1616

1717
container:
1818
image: quay.io/singularity/singularity:v${{ matrix.singularity_version }}
1919
options: --privileged
2020

2121
steps:
22-
2322
- name: Check out code for the container builds
24-
uses: actions/checkout@v2
23+
uses: actions/checkout@v4
2524
with:
2625
submodules: recursive
2726

28-
- name: Build Container
27+
- name: Verify Singularity definition exists
2928
run: |
30-
if [ -f Singularity ]; then
31-
sudo -E singularity build container.sif Singularity
32-
else
33-
echo "Singularity is not found."
34-
echo "Present working directory: $PWD"
35-
ls
36-
fi
37-
29+
if [ ! -f Singularity ]; then
30+
echo "Singularity definition file not found in $(pwd)"
31+
ls -la
32+
exit 1
33+
fi
34+
35+
- name: Build Container
36+
run: sudo -E singularity build container.sif Singularity
37+
3838
- name: Set Tag Based on Branch Name
3939
run: |
40-
# Get the branch name and set it as the tag
4140
tag=${GITHUB_REF##*/}-singularity
4241
echo "Tag is $tag."
4342
echo "tag=$tag" >> $GITHUB_ENV
4443
4544
- name: Login and Deploy Container
4645
if: (github.event_name != 'pull_request')
4746
run: |
48-
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
49-
container_name=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')
50-
singularity push container.sif oras://ghcr.io/${container_name}:${tag}
47+
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
48+
container_name=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')
49+
singularity push container.sif oras://ghcr.io/${container_name}:${tag}

.github/workflows/test-deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Test deployment
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
defaults:
9+
run:
10+
working-directory: docs
11+
12+
jobs:
13+
test-deploy:
14+
name: Test deployment
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: npm
25+
cache-dependency-path: docs/package-lock.json
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Test build website
31+
run: npm run build

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,9 @@ cython_debug/
164164

165165
# DynamicDet run files
166166
runs
167+
gui/.venv/
168+
partinet-env/
169+
170+
# Container images and scratch shell scripts
171+
*.sif
172+
*.sh

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ RUN python -m pip install --no-cache-dir --no-cache /opt/PartiNet
88

99
LABEL AUTHORS Mihin Perera, Edward Yang, Julie Iskander
1010
LABEL MAINTAINERS Mihin Perera, Edward Yang, Julie Iskander
11-
LABEL VERSION v1.0.1
11+
LABEL VERSION v1.1.0

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Use our pretrained model at [Model Weights](https://huggingface.co/MihinP/PartiN
1717
- Seamless integration with cryoSPARC and RELION workflows
1818
- Confidence-based particle filtering
1919
- Visual detection validation
20+
- Browser GUI (`partinet gui`) with optional Slurm job submission
2021

2122
## Prerequisites
2223

@@ -112,6 +113,7 @@ Available commands:
112113
- `denoise`: Clean input micrographs
113114
- `detect`: Identify particles
114115
- `star`: Generate STAR files
116+
- `gui`: Launch the Gradio GUI (local or Slurm execution)
115117
- `train`: Train custom models
116118

117119

Singularity

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ from: python:3.9.19-slim-bookworm
1818
%labels
1919
AUTHORS Mihin Perera, Edward Yang, Julie Iskander
2020
MAINTAINERS Mihin Perera, Edward Yang, Julie Iskander
21-
VERSION v1.0.1
21+
VERSION v1.1.0

docs/docs/getting-started.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ sidebar_position: 3
66

77
This guide walks you through your first PartiNet analysis using the three-stage pipeline. We'll process cryo-EM micrographs from start to finish.
88

9+
:::tip New to PartiNet?
10+
The **[GUI](gui.md)** is the easiest way to get started — no command-line experience needed. Launch it with `partinet gui` and run all three stages from your browser.
11+
12+
![PartiNet GUI overview](/img/gui_overview.png)
13+
14+
The CLI walkthrough below is for users who prefer scripting, are working in containers, or need to run PartiNet on an HPC cluster.
15+
:::
16+
917
## Prerequisites
1018

1119
Before starting, ensure you have:
@@ -24,27 +32,29 @@ project_directory/
2432
│ ├── micrograph1.mrc
2533
│ ├── micrograph2.mrc
2634
│ └── ...
27-
├── denoised/ # Created by denoise stage
28-
│ ├── micrograph1.mrc
29-
│ ├── micrograph2.mrc
35+
├── denoised/ # Created by denoise stage (default: .png)
36+
│ ├── micrograph1.png
37+
│ ├── micrograph2.png
3038
│ └── ...
3139
├── exp/ # Created by detect stage
3240
│ ├── labels/ # Detection coordinates (YOLO format)
3341
│ │ ├── micrograph1.txt
3442
│ │ ├── micrograph2.txt
3543
│ │ └── ...
36-
│ ├── micrograph1.png # Micrographs with detections drawn
37-
│ ├── micrograph2.
44+
│ ├── micrograph1.png # Micrographs with detections drawn
45+
│ ├── micrograph2.png
3846
│ └── ...
3947
└── partinet_particles.star # CryoSPARC-style STAR file (created by star stage)
4048
```
4149

4250
**Pipeline Flow:**
4351
1. **Input**`motion_corrected/` (your micrographs)
44-
2. **Stage 1**`denoised/` (cleaned micrographs)
52+
2. **Stage 1**`denoised/` (cleaned micrographs, PNG by default)
4553
3. **Stage 2**`exp*/` (detections + visualizations)
4654
4. **Stage 3**`*.star` (final particle coordinates)
4755

56+
See [Detect — skip denoise](stages/detect.md#skip-denoise-raw-mrc) if picking directly on raw MRC without denoising.
57+
4858
## Stage 1: Denoise
4959

5060
The first stage removes noise from your micrographs and improves signal-to-noise ratios:
@@ -53,8 +63,8 @@ The first stage removes noise from your micrographs and improves signal-to-noise
5363

5464
```shell title="Local Installation"
5565
partinet denoise \
56-
--source /data/my_project/motion_corrected \
57-
--project /data/my_project
66+
--source /data/partinet_picking/motion_corrected \
67+
--project /data/partinet_picking
5868
```
5969

6070
</div>
@@ -100,9 +110,9 @@ The final stage converts detections to STAR format and applies confidence filter
100110

101111
```shell title="Local Installation"
102112
partinet star \
103-
--labels /data/my_project/exp/labels \
104-
--images /data/my_project/denoised \
105-
--output /data/my_project/partinet_particles.star \
113+
--labels /data/partinet_picking/exp/labels \
114+
--images /data/partinet_picking/denoised \
115+
--output /data/partinet_picking/partinet_particles.star \
106116
--conf 0.1
107117
```
108118

@@ -118,7 +128,7 @@ partinet star \
118128
After running all three stages, you'll have:
119129

120130
1. **Denoised micrographs** (`denoised/`) - Cleaned input for particle detection
121-
2. **Detection visualizations** (`exp/*.mrc`) - Micrographs with particle boxes drawn
131+
2. **Detection visualizations** (`exp/*.png`) - Micrographs with particle boxes drawn
122132
3. **Detection coordinates** (`exp/labels/*.txt`) - Raw detection data
123133
4. **STAR file** (`*.star`) - Final particle coordinates ready for downstream processing
124134

0 commit comments

Comments
 (0)