---
title: nuwa-script
canonical_url: "https://www.modelscope.cn/models/ai4s/nuwa-script"
md_url: "https://www.modelscope.cn/models/ai4s/nuwa-script.md"
repository: ai4s/nuwa-script
chinese_name: "女娲基因导航大模型（SCRIPT）"
last_updated: 2025-09-11
license: apache-2.0
downloads: 17
stars: 79
---

# nuwa-script

> nuwa-script - ai4s 在 ModelScope 开源的模型。SCRIPT Single-cell Cis-regulatory Relationship Identifier based on Pre-Trained graph attention networks

ai4s/nuwa-script 是 ModelScope 魔搭社区上的机器学习模型，采用 apache-2.0 许可。

- **Repository**: ai4s/nuwa-script
- **License**: apache-2.0
- **Downloads**: 17
- **Stars**: 79
- **Last updated**: 2025-09-11

Source: https://www.modelscope.cn/models/ai4s/nuwa-script

---

# SCRIPT
Single-cell Cis-regulatory Relationship Identifier based on Pre-Trained graph attention networks

## Overview
Single-cell *cis*-regulatory relationships (CRRs) are essential for understanding the pathogenic mechanisms of disease-associated non-coding variants. Existing computational methods underperform in predicting single-cell CRRs due to overlooking causal biological principles and large-scale single-cell data. Here, we present SCRIPT (Single-cell *Cis-*regulatory Relationship Identifier based on Pre-Trained graph attention networks) that infers single-cell CRRs from transcriptomic and chromatin accessibility data. SCRIPT incorporates two key innovations: graph causal attention networks supported by empirical CRR evidence, and representation learning enhanced through pretraining on atlas-scale single-cell chromatin accessibility data. SCRIPT significantly outperforms state-of-the-art methods, achieving a mean AUC of 0.9 and a threefold improvement in predicting long-range CRRs (>100Kb). Applying SCRIPT to Alzheimer’s disease and schizophrenia, we establish a framework for prioritizing disease-causing variants and elucidating their functional effects in a cell-type-specific manner. By uncovering molecular genetic mechanisms undetected by existing computational methods, SCRIPT provides a roadmap for advancing genetic diagnosis and target discovery.

## Installation

We recommend installing SCRIPT within a virtual environment. For Conda, use the following command to create and activate a dedicated environment:

```shell
conda create -n script python=3.10.6 && source activate script
```

Next, install the required dependencies with:

```shell
pip install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu121
pip install dgl -f https://data.dgl.ai/wheels/torch-2.2/cu121/repo.html
pip install -r requirements.txt
```

To extract the compressed files needed for the model:

```shell
gzip -d ./data/PO.txt.gz
```

## Tutorial

#### **Running SCRIPT in One Command**

To run SCRIPT in a single command, use:

```shell
python main.py --file_atac ./example_data/input_data/example_scatac.h5ad --file_rna ./example_data/input_data/example_scrna.h5ad
```

By default, temporary files generated during the model run are stored in ./temp_path, and the result files are saved in ./res_path.

Users can also specify custom storage paths for the temporary files and result files:

```shell
python main.py --file_atac ./example_data/input_data/example_scatac.h5ad --file_rna ./example_data/input_data/example_scrna.h5ad --path_out ./res_path --path_tmp ./temp_path
```

#### **Running SCRIPT in Separate Steps**

The usage of SCRIPT contains three steps.

The first step is generation of training data. Users need to provide a pair of scATAC-seq and scRNA-seq datasets. The two datasets are from the same tissue, and their cell types need to be aligned.

You can run the following code to perform the first step:

```shell
python generate_training_data.py --file_atac ./example_data/input_data/example_scatac.h5ad --file_rna ./example_data/input_data/example_scrna.h5ad --path_out ./temp_path/output_data
```
The second step is the simulation of cis-transcriptional regulation. Users need to input the training data generated by the first step.

You can run the following code to perform the second step:

```shell
python transcription_simulation.py --path_in ./example_data/output_data --folder_ckpt ./temp_path/simulation_model
```
The third step is the calculation of single-cell regulation scores by attribution method. Users need to input the training data generated by the first step, the configures and paremeters of the simulation model trained in the second step. 

You can run the following code to perform the third step:

```shell
python attribution.py --path_in ./temp_path/output_data --path_out ./res_path --config_simulation ./temp_path/simulation_model/args.pkl --model_simulation ../temp_path/simulation_model/best_model.pt
```
Single-cell regulation scores are saved in the '"./res_path" folder.
