---
title: UKBioCoin
canonical_url: "https://www.modelscope.cn/studios/UKC/UKBioCoin"
md_url: "https://www.modelscope.cn/studios/UKC/UKBioCoin.md"
repository: UKC/UKBioCoin
last_updated: 2026-08-26
sdk_type: docker
downloads: 0
stars: 2
---

# UKBioCoin

> UKBioCoin - UKC 在 ModelScope 创建的在线 Demo。Web application for GWAS analysis, GC correction, meta-analysis, Manhattan plot generation, and result packaging.

UKC/UKBioCoin 是 ModelScope 魔搭社区上的在线可交互 Demo（创空间），基于 docker 构建。

- **Repository**: UKC/UKBioCoin
- **SDK**: docker
- **Downloads**: 0
- **Stars**: 2
- **Last updated**: 2026-08-26

Source: https://www.modelscope.cn/studios/UKC/UKBioCoin

---

# UKBioCoin

Web application for GWAS analysis, GC correction, meta-analysis, Manhattan plot generation, and result packaging.

## Features

- GWAS analysis with `UKBioCoin`
- GC correction with `plink2`
- Meta-analysis with `plink`
- Manhattan plot generation with R (`qqman`)
- Result archiving and download
- Multi-user authentication
- SSE task progress updates
- Chinese and English UI

## Project Structure

```text
UKBioCoin/
├── backend/                 # Rust backend
│   ├── src/                 # API and task pipeline
│   ├── Cpp/                 # Prebuilt Linux executables
│   └── R/                   # R plotting scripts
├── frontend/                # Static frontend
├── docker/                  # Docker runtime files
│   ├── Dockerfile
│   ├── start.sh             # Runtime bootstrap
│   ├── fetch_nss.sh         # Download NSS datasets into runtime storage
│   ├── nginx.conf
│   └── patches/             # Docker-specific source overrides
├── Dockerfile               # Root Docker build entry
└── README.md
```

## Runtime Data Model

The container image no longer includes `NSS/`.

At startup, `docker/start.sh` prepares `/app/NSS` as a symlink to `/mnt/workspace/NSS` when `ModelScope` provides persistent storage. It then runs `docker/fetch_nss.sh`:

- If `/mnt/workspace/NSS/UKC` already contains a valid dataset, it is reused.
- If `/mnt/workspace/NSS/WBBC` already contains a valid dataset, it is reused.
- If either dataset is missing, it is downloaded from public ModelScope datasets.

Default dataset mapping:

```text
UKC/UKB-NSS  -> NSS/UKC
UKC/WBBC-NSS -> NSS/WBBC
```

You can override that mapping at runtime with `NSS_DATASET_SPECS`.

## NSS Layout

Each dataset under `/app/NSS` keeps the same structure as before:

```text
NSS/
├── UKC/
│   ├── labels.json
│   ├── nss-folders.json
│   └── SC02/
│       ├── 0.basic/
│       └── 2.matrix/
└── WBBC/
    ├── labels.json
    ├── nss-folders.json
    └── WBBC/
        ├── 0.basic/
        └── 2.matrix/
```

The backend still discovers datasets by scanning the runtime `NSS` directory. No API-level changes were required.

## Split File Restoration

Large matrix files may be uploaded to ModelScope datasets as split parts, for example:

```bash
split -b 40G -d -a 3 SC02_cov_xy.table SC02_cov_xy.table.part_
```

At runtime, `docker/fetch_nss.sh` automatically restores files from `*.part_000`, `*.part_001`, ... into the original file name and then removes the split parts.

## Running Locally

### Development

Prerequisites:

- Rust 1.88+
- R with `data.table`, `glue`, `calibrate`, `qqman`
- `UKBioCoin`, `plink`, and `plink2` in `backend/Cpp/`

Start backend:

```bash
cd backend
cargo run
```

Serve frontend:

```bash
cd frontend
python3 -m http.server 8080
```

### Docker

```bash
cd docker
docker compose up -d --build
```

Access the app at `http://localhost:7860`.

Local `docker compose` does not mount `/mnt/workspace` by default, so dataset downloads live inside the container unless you add your own persistent mount.

## ModelScope Deployment

This project is designed for Docker deployment on ModelScope Creative Space.

Key points:

- `deployspec.entry_file: docker/start.sh` is the startup entry.
- The public service port is `7860`.
- Persistent data must live under `/mnt/workspace`.
- `NSS` is downloaded at runtime instead of being baked into the image.

Startup sequence on ModelScope:

1. Build Docker image without `NSS`.
2. Start container and mount `/mnt/workspace`.
3. Symlink `/app/NSS` to `/mnt/workspace/NSS`.
4. Download any missing datasets from ModelScope dataset repos.
5. Restore split `*.part_*` files.
6. Start `nginx` and the Rust backend.

## Runtime Environment Variables

Optional variables:

- `NSS_DATASET_SPECS`: dataset-to-folder mapping, default `UKC/UKB-NSS:UKC UKC/WBBC-NSS:WBBC`
- `MODELSCOPE_ACCESS_TOKEN`: optional token for private datasets; public datasets do not require it
- `MODELSCOPE_CACHE`: ModelScope cache directory
- `NSS_DOWNLOAD_TMP`: temporary download directory before data is moved into place
- `RUST_LOG`: backend log level

## Notes

- Root `NSS/` is ignored and excluded from the Docker build context.
- The image build should now be much faster because large NSS data is no longer uploaded during build.
- Existing workspace data is preferred over re-downloading.

See [docker/README.md](docker/README.md) for Docker and runtime details.

## License

Apache License 2.0
