Skip to content

Commit

Permalink
update tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
lzj1769 committed Sep 20, 2024
1 parent 08148a6 commit dacdbc7
Show file tree
Hide file tree
Showing 18 changed files with 420 additions and 740 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: scMEGA
Type: Package
Title: Single-cell Multiomic Enhancer-based Gene Regulatory Network Inference
Version: 1.0.2
Version: 1.1.0
Author: Zhijian Li
Maintainer: Zhijian Li <[email protected]>
Description: Infering gene regulatory network from single-cell multi-omics data.
Expand Down
642 changes: 181 additions & 461 deletions docs/articles/install.html

Large diffs are not rendered by default.

461 changes: 212 additions & 249 deletions docs/articles/pbmc_10x_multiome.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

# R -e "devtools::document()"
# R -e "pkgdown::build_site(preview = FALSE, lazy=TRUE)"
R -e "pkgdown::build_article(name='myofibroblast-GRN', quiet=FALSE)"
# R -e "pkgdown::build_article(name='myofibroblast-GRN', quiet=FALSE)"
R -e "pkgdown::build_article(name='install', quiet=FALSE)"
R -e "pkgdown::build_article(name='pbmc_10x_multiome', quiet=FALSE)"
23 changes: 13 additions & 10 deletions vignettes/cardiomyocyte-GRN.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,18 @@ Let's load the data into memory and see how they look like
obj.rna <- readRDS("./Cardiomyocyte/snRNA.rds")
obj.atac <- readRDS("./Cardiomyocyte/snATAC.rds")
gene.activity <- readRDS("./Cardiomyocyte/gene.activity.rds")
```

We need to convert the assays to an Assay5 for Seuratv5
```{r to_seuratv5}
obj.rna[["RNA"]] <- as(obj.rna[["RNA"]], "Assay5")
obj.atac[["ATAC"]] <- as(obj.atac[["ATAC"]], "Assay5")
obj.rna
obj.atac
```


We can observe that there are 45,515 and 6,481 cells in our snRNA-seq and snATAC-seq datasets. We now visualize the data as colored by patients. Note that here we used the UMAP embedding generated from batch-corrected low-dimensional space so that no batch effects are observed from the 2D visualization.

```{r, fig.height = 5, fig.width = 12, fig.align = "center"}
Expand Down Expand Up @@ -111,16 +118,12 @@ So next we use [Harmony](https://www.nature.com/articles/s41592-019-0619-0) to
perform batch correction and generate a new UMAP embedding.

```{r, fig.height = 10, fig.width = 12, fig.align = "center"}
obj.coembed <- RunHarmony(
obj.coembed,
group.by.vars = c("patient", "region", "tech"),
reduction = "pca",
max.iter.harmony = 30,
dims.use = 1:30,
project.dim = FALSE,
plot_convergence = FALSE
)
obj.coembed <- RunHarmony(obj.coembed,
group.by.vars = c("patient", "region", "tech"),
reduction.use = "pca",
dims.use = 1:30,
project.dim = FALSE,
plot_convergence = FALSE)
obj.coembed <- RunUMAP(
obj.coembed,
dims = 1:30,
Expand Down
10 changes: 1 addition & 9 deletions vignettes/install.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@ You can install scMEGA via below commands:
if (!requireNamespace("devtools", quietly = TRUE))
install.packages("devtools")
# First install Seurate v5
devtools::install_github("satijalab/seurat", "seurat5", upgrade='always')
# Install Signac
devtools::install_github("stuart-lab/signac", "seurat5")
# Install scMEGA
devtools::install_github("CostaLab/scMEGA")
devtools::install_github("CostaLab/scMEGA", force = TRUE)
```


Expand Down
18 changes: 9 additions & 9 deletions vignettes/pbmc_10x_multiome.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,18 @@ meta.data <- [email protected] %>%
# create a Seurat object containing the RNA adata
pbmc <- CreateSeuratObject(
counts = obj.rna@assays$RNA@counts,
counts = GetAssayData(obj.rna, layer = "counts"),
assay = "RNA",
meta.data = meta.data
meta.data = meta.data
)
# create ATAC assay and add it to the object
pbmc[["ATAC"]] <- CreateChromatinAssay(
counts = obj.atac@assays$ATAC@counts,
counts = GetAssayData(obj.atac, layer = "counts",),
sep = c(":", "-"),
min.cells = 1,
genome = 'hg38',
fragments = './10x_pbmc/pbmc_granulocyte_sorted_10k_atac_fragments.tsv.gz'
min.cells = 1,
genome = 'hg38',
fragments = './10x_pbmc/pbmc_granulocyte_sorted_10k_atac_fragments.tsv.gz'
)
```

Expand Down Expand Up @@ -300,9 +300,9 @@ pbmc <- AddTrajectory(object = pbmc,
trajectory = c("naive CD4 T cells",
"memory CD4 T cells"),
group.by = "predicted.id",
reduction = "MOJITOO_UMAP",
dims = 1:2,
use.all = FALSE)
reduction = "MOJITOO_UMAP",
dims = 1:2,
use.all = FALSE)
# we only plot the cells that are in this trajectory
pbmc.t.cells <- pbmc[, !is.na(pbmc$Trajectory)]
Expand Down

0 comments on commit dacdbc7

Please sign in to comment.