SkillAgentSearch skills...

SubClusterTool

Subclustering and Merging Tool for Seurat Objects

Install / Use

/learn @WilsonWukz/SubClusterTool
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

SubClusterTool

Overview

SubClusterTool is an R package designed to facilitate subclustering and integration of subclusters back into Seurat objects. It allows users to extract a specific cluster from a Seurat object, perform subclustering with custom resolutions and dimensions, and merge the refined subclusters back into the original Seurat object with user-defined labels. This tool is particularly useful for detailed single-cell RNA sequencing analysis, where deeper insights into specific clusters are needed.

Installation

First, install the devtools package if you haven't already:

install.packages("devtools")

Then, install the SubClusterTool package from GitHub:

devtools::install_github("WilsonWukz/SubClusterTool")

Usage

To use the SubClusterTool package, follow these steps:

1. Load the package and required dependencies:

library(Seurat)
library(SubClusterTool)

2. Subcluster a specific cluster within a Seurat object:

Example: Subcluster cluster 0 with resolution 0.5 and using the first 10 PCA dimensions

cluster_subset <- subcluster_view(seurat_obj = your_seurat_object, cluster_id = 0, resolution = 0.5, dims = 1:10)

# Visualize the subclustered result
DimPlot(cluster_subset, reduction = "umap", label = TRUE, pt.size = 0.5)

3. Merge subclusters back into the original Seurat object:

Define new labels for the subclusters

new_labels <- c("Subcluster_1", "Subcluster_2", "Subcluster_3")

Merge the subclusters back into the original object

your_seurat_object <- merge_subclusters(
  seurat_obj = your_seurat_object,
  subcluster_obj = cluster_subset,
  new_labels = new_labels,
  new_id_column = "refined_clusters"
)

Visualize the updated Seurat object with refined clusters

DimPlot(your_seurat_object, reduction = "umap", group.by = "refined_clusters", label = TRUE, pt.size = 0.5)

Example

image Then the code should be

B_subset <- subcluster_view(seurat_obj = Cell.integrated, cluster_id = "B cells", resolution = 0.6, dims = 1:10)

Then we will get image Then we try to merge them back to the Cell.intergrated, and if I want to devide the B_subsets into 2 kinds, B0 and B1

Cell.integrated <- merge_subclusters(
  seurat_obj = Cell.integrated,
  subcluster_obj = B_subset,
  new_labels = c("B0", "B0", "B0", "B0", "B1", "B1","B1"),
  new_id_column = "refined_clusters"
)

image

Functions

Built-in Functions

  • subcluster_view(seurat_obj, cluster_id, resolution, dims)
    Extracts a specified cluster from a Seurat object, performs subclustering, and returns the subclustered Seurat object.

  • merge_subclusters(seurat_obj, subcluster_obj, new_labels, new_id_column)
    Merges the refined subclusters back into the original Seurat object with user-defined labels. The merged labels are stored in a new column.

Author

Kezhao Wu
Maintainer: Kezhao Wu

Contributor

License

MIT

Bug Reports

If you encounter any issues or have suggestions for improvements, please report them on the GitHub issues page.

URL

GitHub Repository

Related Skills

View on GitHub
GitHub Stars5
CategoryDevelopment
Updated1y ago
Forks1

Languages

R

Security Score

55/100

Audited on Jan 14, 2025

No findings