impeller


Nameimpeller JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/aicb-ZhangLabs/Impeller
SummaryImpeller is a package for spatial transcriptomics imputation using path-based graph neural networks.
upload_time2024-08-16 05:40:16
maintainerNone
docs_urlNone
authorZiheng Duan
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Impeller

Impeller is a sophisticated package designed for imputing spatial transcriptomics data using path-based graph neural networks. It supports a variety of datasets and integrates powerful processing and machine learning techniques.

## Installation

Install the Impeller package using pip with the following command:

```bash
pip install Impeller
```

## Usage
The Impeller package simplifies the process of downloading, processing, and training models on spatial transcriptomics data. Follow the steps below to utilize the package effectively.

### Download Example Data
The package supports three datasets: '10XVisium', 'Stereoseq', and 'SlideseqV2'. Begin by downloading the dataset of your choice:

```python
from Impeller import download_example_data

# Replace '10XVisium' with 'Stereoseq' or 'SlideseqV2' to download other datasets
download_example_data('10XVisium')
```

### Load and Process Data
Once the data is downloaded, you can load and process it for analysis:
```python 
from Impeller import load_and_process_example_data

# Ensure to specify the same dataset you downloaded
data, val_mask, test_mask, x, original_x = load_and_process_example_data('10XVisium')
```

### Train Model
After loading and processing the data, you can initialize the model's arguments and start training:
```python 
from Impeller import create_args, train

args = create_args()
test_l1_distance, test_cosine_sim, test_rmse = train(args, data, val_mask, test_mask, x, original_x)
print(f"Final L1 distance: {test_l1_distance}, Cosine similarity: {test_cosine_sim}, RMSE: {test_rmse}.")
```

### Only Inference
You can use Impeller to perform inference on your custom data (you'll need to provide a mask indicating which genes in which cells you want to impute). Below is a demo for inference only (replace the following adata and inference_mask with your own data):
```python 
from Impeller import load_example_data, process_inference_data

adata, _, inference_mask = load_example_data(example_dataset = '10XVisium')
data = process_inference_data(adata)

from Impeller import inference

Impeller_imputed_data = inference(args, data, inference_mask)
```

### Naive Baseline
We also provide a simple baseline implementation using K-Nearest Neighbors (KNN):
```python 
from Impeller import SpatialKNNImputer

knn_imputer = SpatialKNNImputer(adata, n_neighbors=5)
knn_imputed_data = knn_imputer.impute(inference_mask)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aicb-ZhangLabs/Impeller",
    "name": "impeller",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Ziheng Duan",
    "author_email": "duanziheng1206@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/78/4d/466b5a7fbd271f4fdb65e94d8699804ad0be61df4e998b2f936196c9e803/impeller-0.1.2.tar.gz",
    "platform": null,
    "description": "# Impeller\n\nImpeller is a sophisticated package designed for imputing spatial transcriptomics data using path-based graph neural networks. It supports a variety of datasets and integrates powerful processing and machine learning techniques.\n\n## Installation\n\nInstall the Impeller package using pip with the following command:\n\n```bash\npip install Impeller\n```\n\n## Usage\nThe Impeller package simplifies the process of downloading, processing, and training models on spatial transcriptomics data. Follow the steps below to utilize the package effectively.\n\n### Download Example Data\nThe package supports three datasets: '10XVisium', 'Stereoseq', and 'SlideseqV2'. Begin by downloading the dataset of your choice:\n\n```python\nfrom Impeller import download_example_data\n\n# Replace '10XVisium' with 'Stereoseq' or 'SlideseqV2' to download other datasets\ndownload_example_data('10XVisium')\n```\n\n### Load and Process Data\nOnce the data is downloaded, you can load and process it for analysis:\n```python \nfrom Impeller import load_and_process_example_data\n\n# Ensure to specify the same dataset you downloaded\ndata, val_mask, test_mask, x, original_x = load_and_process_example_data('10XVisium')\n```\n\n### Train Model\nAfter loading and processing the data, you can initialize the model's arguments and start training:\n```python \nfrom Impeller import create_args, train\n\nargs = create_args()\ntest_l1_distance, test_cosine_sim, test_rmse = train(args, data, val_mask, test_mask, x, original_x)\nprint(f\"Final L1 distance: {test_l1_distance}, Cosine similarity: {test_cosine_sim}, RMSE: {test_rmse}.\")\n```\n\n### Only Inference\nYou can use Impeller to perform inference on your custom data (you'll need to provide a mask indicating which genes in which cells you want to impute). Below is a demo for inference only (replace the following adata and inference_mask with your own data):\n```python \nfrom Impeller import load_example_data, process_inference_data\n\nadata, _, inference_mask = load_example_data(example_dataset = '10XVisium')\ndata = process_inference_data(adata)\n\nfrom Impeller import inference\n\nImpeller_imputed_data = inference(args, data, inference_mask)\n```\n\n### Naive Baseline\nWe also provide a simple baseline implementation using K-Nearest Neighbors (KNN):\n```python \nfrom Impeller import SpatialKNNImputer\n\nknn_imputer = SpatialKNNImputer(adata, n_neighbors=5)\nknn_imputed_data = knn_imputer.impute(inference_mask)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Impeller is a package for spatial transcriptomics imputation using path-based graph neural networks.",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/aicb-ZhangLabs/Impeller"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f22986aabdf17a3891a9e541ff64619926b47b5dd982f49c9d740b1af62b2e74",
                "md5": "2c8a2121768d480d6dcd6efd663964ea",
                "sha256": "178f56f676a1786a83a1c227b5e88068b433971baeaa60b2c452363c54079147"
            },
            "downloads": -1,
            "filename": "impeller-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2c8a2121768d480d6dcd6efd663964ea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 10712,
            "upload_time": "2024-08-16T05:40:14",
            "upload_time_iso_8601": "2024-08-16T05:40:14.115239Z",
            "url": "https://files.pythonhosted.org/packages/f2/29/86aabdf17a3891a9e541ff64619926b47b5dd982f49c9d740b1af62b2e74/impeller-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "784d466b5a7fbd271f4fdb65e94d8699804ad0be61df4e998b2f936196c9e803",
                "md5": "00abd04c4d2cdeff1d84bb3221e7edd6",
                "sha256": "51236702e4d73383333951ff6c4031085fce7c74b4cf115e2f49bd13494dbb74"
            },
            "downloads": -1,
            "filename": "impeller-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "00abd04c4d2cdeff1d84bb3221e7edd6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8759,
            "upload_time": "2024-08-16T05:40:16",
            "upload_time_iso_8601": "2024-08-16T05:40:16.308812Z",
            "url": "https://files.pythonhosted.org/packages/78/4d/466b5a7fbd271f4fdb65e94d8699804ad0be61df4e998b2f936196c9e803/impeller-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-16 05:40:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aicb-ZhangLabs",
    "github_project": "Impeller",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "impeller"
}
        
Elapsed time: 1.32050s