<- c("jhtools", "glue", "tidyverse", "jhuanglabRNAseq")
pkgs for (pkg in pkgs){
suppressPackageStartupMessages(library(pkg, character.only = T))
}<- "embryo"
project <- "zhangjing"
dataset <- "human"
species <- glue("~/projects/{project}/analysis/{dataset}/{species}/rnaseq") |> checkdir()
workdir setwd(workdir)
<- "~/projects/be_a_rich_man/RcisTarget/tflist/allTFs_hg38.txt"
tflist ::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human") |> checkdir()
glue
::Slurm_lapply(c("yao1", "yao2", "yao6", "yao5"), function(sample_id){
slurmR<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}") |> checkdir()
out_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/Spatial_counts/{sample_id}.csv.loom")
loom_dir <- glue::glue("pyscenic grn --num_workers 20 --output {out_dir}/{sample_id}.adj.sc.tsv --method grnboost2 {loom_dir} {tflist}")
cmd system(cmd)
mc.cores = 4L, njobs = 60L, plan = "collect",
}, export = c("tflist"),
tmp_path = "~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human", overwrite = T)
<- "~/projects/be_a_rich_man/RcisTarget/human/hg38/hg38_500bp_up_100bp_down_full_tx_v10_clust.genes_vs_motifs.rankings.feather"
feature_dir <- "~/projects/be_a_rich_man/RcisTarget/annotation/motifs-v10nr_clust-nr.hgnc-m0.001-o0.0.tbl"
annotations_dir ::Slurm_lapply(c("yao1", "yao2", "yao6", "yao5"), function(sample_id){
slurmR<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}.adj.sc.tsv")
adj.sample_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/Spatial_counts/{sample_id}.csv.loom")
loom_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}_reg_v10_v10hg38_500_100_rank.csv")
out_dir
<- glue::glue("pyscenic ctx {adj.sample_dir} {feature_dir} --annotations_fname {annotations_dir} --expression_mtx_fname {loom_dir} --mode 'dask_multiprocessing' --output {out_dir} --num_workers 20 --mask_dropouts")
cmd system(cmd)
mc.cores = 4L, njobs = 60L, plan = "collect",
}, export = c("feature_dir", "annotations_dir"),
tmp_path = "~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human", overwrite = T)
<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}.adj.sc.tsv")
adj.sample_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/Spatial_counts/{sample_id}.csv.loom")
loom_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}_reg_v10_v10hg38_500_100_rank.csv")
out_dir
<- glue::glue("pyscenic ctx {adj.sample_dir} {feature_dir} --annotations_fname {annotations_dir} --expression_mtx_fname {loom_dir} --mode 'dask_multiprocessing' --output {out_dir} --num_workers 20 --mask_dropouts")
cmd system(cmd)
::Slurm_lapply(c("yao1", "yao2", "yao6", "yao5"), function(sample_id){
slurmR<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/Spatial_counts/{sample_id}.csv.loom")
loom_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}_reg_v10_v10hg38_500_100_rank.csv")
reg_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}_SCENIC.csv")
out_dir <- glue::glue("pyscenic aucell {loom_dir} {reg_dir} --output {out_dir} --num_workers 8")
cmd system(cmd)
mc.cores = 4L, njobs = 60L, plan = "collect",
}, export = c("feature_dir", "annotations_dir"),
tmp_path = "~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human", overwrite = T)
<- "~/projects/be_a_rich_man/RcisTarget/tflist/allTFs_mm.txt"
tflist ::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse") |> checkdir()
glue
::Slurm_lapply(c("ME9.5", "ME11.5x1", "ME11.5x2", "ME13.5"), function(sample_id){
slurmR<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}") |> checkdir()
out_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/Spatial_counts/{sample_id}.csv.loom")
loom_dir <- glue::glue("pyscenic grn --num_workers 20 --output {out_dir}/{sample_id}.adj.sc.tsv --method grnboost2 {loom_dir} {tflist}")
cmd system(cmd)
mc.cores = 4L, njobs = 60L, plan = "collect",
}, export = c("tflist"),
tmp_path = "~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse", overwrite = T)
<- "~/projects/be_a_rich_man/RcisTarget/mouse/mm10/mm10_500bp_up_100bp_down_full_tx_v10_clust.genes_vs_motifs.rankings.feather"
feature_dir <- "~/projects/be_a_rich_man/RcisTarget/annotation/motifs-v10nr_clust-nr.mgi-m0.001-o0.0.tbl"
annotations_dir ::Slurm_lapply(c("ME9.5", "ME11.5x1", "ME11.5x2", "ME13.5"), function(sample_id){
slurmR<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/{sample_id}.adj.sc.tsv")
adj.sample_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/Spatial_counts/{sample_id}.csv.loom")
loom_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/{sample_id}_reg_v10_v10mm10_500_100_rank.csv")
out_dir
<- glue::glue("pyscenic ctx {adj.sample_dir} {feature_dir} --annotations_fname {annotations_dir} --expression_mtx_fname {loom_dir} --mode 'dask_multiprocessing' --output {out_dir} --num_workers 20 --mask_dropouts")
cmd system(cmd)
mc.cores = 4L, njobs = 60L, plan = "collect",
}, export = c("feature_dir", "annotations_dir"),
tmp_path = "~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse", overwrite = T)
::Slurm_lapply(c("ME9.5", "ME11.5x1", "ME11.5x2", "ME13.5"), function(sample_id){
slurmR<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/Spatial_counts/{sample_id}.csv.loom")
loom_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/{sample_id}_reg_v10_v10mm10_500_100_rank.csv")
reg_dir <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/{sample_id}_SCENIC.loom")
out_dir <- glue::glue("pyscenic aucell {loom_dir} {reg_dir} --output {out_dir} --num_workers 8")
cmd system(cmd)
mc.cores = 4L, njobs = 60L, plan = "collect",
}, tmp_path = "~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse", overwrite = T)
8 Transcription Factor Activity Analysis
8.1 Pyscenic
8.1.1 Run pyscenic
We calculated transcription factor activity based on spatial transcriptomics, and the specific calculation method has been described in the Method section.
8.1.2 Check TF on tissue and Run TF Moran’s I
To identify transcription factors associated with embryonic development, we computed the Moran’s Index scores of transcription factor activity scores across different stages of embryonic development. We clustered transcription factor scores and mapped their distribution and associated modules across tissues.
<- c("jhtools", "glue", "tidyverse", "jhuanglabRNAseq","Seurat","viridis","ComplexHeatmap")
pkgs for (pkg in pkgs){
suppressPackageStartupMessages(library(pkg, character.only = T))
}<- "embryo"
project <- "zhangjing"
dataset <- "human"
species <- glue("~/projects/{project}/analysis/{dataset}/{species}/rnaseq") |> checkdir()
workdir setwd(workdir)
<- read_rds("./MoransI/gene_human_mouseq.rds")
gene_human_mouse <- gene_human_mouse[["gene_ml_hu"]]
gene_ml_hu <- tibble(tissue_label = names(gene_ml_hu), new = c("yao1", "yao2", "yao5", "yao6"))
huch names(gene_ml_hu) <- huch$new
<- gene_ml_hu[c("yao1", "yao6", "yao5")]
gene_ml_hu
<- gene_human_mouse[["gene_ml_mu"]]
gene_ml_mu <- tibble(tissue_label = names(gene_ml_mu), new = c("ME9.5", "ME13.5", "ME11.5x2", "ME11.5x1"))
much names(gene_ml_mu) <- much$new
<- gene_ml_mu[c("ME9.5", "ME11.5x1", "ME13.5")]
gene_ml_mu
<- "~/projects/collabrators/analysis/wangwenjie/human/visium/manual_anot/seu_mrg2.rds" |> read_rds()
humanobj DefaultAssay(humanobj) <- "Spatial"
<- JoinLayers(humanobj)
humanobj <- humanobj |> NormalizeData() |> ScaleData()
humanobj @meta.data$tissue_label <- paste0(humanobj$orig.ident, humanobj$stage)
humanobj<- rownames(humanobj@meta.data)
rn @meta.data <- humanobj@meta.data |> left_join(as.data.frame(huch))
humanobjrownames(humanobj@meta.data) <- rn
<- "~/projects/collabrators/analysis/wangwenjie/mouse/visium/integrat/mtb_genes/anot_new/seu_mrg2.rds" |> read_rds()
mouseobj <- read_csv("delE95.csv")
delbarcode <- mouseobj[,!colnames(mouseobj) %in% delbarcode[[1]]]
mouseobj
DefaultAssay(mouseobj) <- "Spatial"
<- JoinLayers(mouseobj)
mouseobj <- mouseobj |> NormalizeData() |> ScaleData()
mouseobj @meta.data$tissue_label <- paste0(mouseobj$orig.ident, mouseobj$stage)
mouseobj<- rownames(mouseobj@meta.data)
rn @meta.data <- mouseobj@meta.data |> left_join(as.data.frame(much))
mouseobjrownames(mouseobj@meta.data) <- rn
<- Seurat::SplitObject(humanobj, split.by = "new")
humanobjlist <- Seurat::SplitObject(mouseobj, split.by = "new")
mouseobjlist
::mclapply(c("ME9.5", "ME11.5x1", "ME11.5x2", "ME13.5"), function(sample_id){
parallel<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- mouseobjlist[[sample_id]]
obj <- SCENIC |> column_to_rownames(var = "Cell") |> t() |> as.data.frame()
SCENIC <- SCENIC[,colnames(obj)]
SCENIC <- SCENIC[rowSums(SCENIC) > 0,]
SCENIC # SCENIC <- SCENIC[,c(T, colSums(SCENIC[-1]) > 0)]
<- rownames(SCENIC)
TFl
"SCENIC"]] <- Seurat::CreateAssayObject(data = as.matrix(SCENIC))
obj[[
<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/TF_tissue")
pth dir.create(pth, recursive = T)
::mclapply(TFl, function(i){
parallel<- Seurat::SpatialFeaturePlot(obj, features = i, pt.size.factor = 3) +
p theme_classic()+
ggtitle(i) +
coord_fixed() +
scale_fill_viridis()
pdf(glue("{pth}/{i}.pdf"), width = 5, height = 5)
print(p)
dev.off()
mc.cores = 10L)
}, mc.cores = 4L)
},
::mclapply(c("yao1", "yao2", "yao5", "yao6"), function(sample_id){
parallel<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- humanobjlist[[sample_id]]
obj <- SCENIC |> column_to_rownames(var = "Cell") |> t() |> as.data.frame()
SCENIC <- SCENIC[,colnames(obj)]
SCENIC <- SCENIC[rowSums(SCENIC) > 0,]
SCENIC <- rownames(SCENIC)
TFl
"SCENIC"]] <- Seurat::CreateAssayObject(data = as.matrix(SCENIC))
obj[[
<- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/TF_tissue")
pth dir.create(pth, recursive = T)
::mclapply(TFl, function(i){
parallelif(sample_id %in% c("yao5", "yao6")){
<- Seurat::SpatialFeaturePlot(obj, features = i, pt.size.factor = 2) +
p theme_classic()+
ggtitle(i) +
coord_fixed() +
scale_fill_viridis()
else{
}<- Seurat::SpatialFeaturePlot(obj, features = i, pt.size.factor = 3) +
p theme_classic()+
ggtitle(i) +
coord_fixed() +
scale_fill_viridis()
}
pdf(glue("{pth}/{i}.pdf"), width = 5, height = 5)
print(p)
dev.off()
mc.cores = 10L)
}, mc.cores = 4L)
},
<- parallel::mclapply(c("ME9.5", "ME11.5x1", "ME11.5x2", "ME13.5"), function(sample_id){
molI_frame <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- mouseobjlist[[sample_id]]
obj <- SCENIC[,c(T, colSums(SCENIC[-1]) > 0)]
SCENIC <- SCENIC[SCENIC$Cell %in% colnames(obj),]
SCENIC <- obj@images[[1]]@coordinates[,c("imagerow", "imagecol")]
pos <- Seurat::RunMoransI(scale(SCENIC[-1]) |> t(), pos = pos)
molI
molImc.cores = 4L)
}, names(molI_frame) <- c("ME9.5", "ME11.5x1", "ME11.5x2", "ME13.5")
<- parallel::mclapply(c("yao1", "yao2", "yao5", "yao6"), function(sample_id){
molI_frame_hu <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- humanobjlist[[sample_id]]
obj <- SCENIC[,c(T, colSums(SCENIC[-1]) > 0)]
SCENIC <- SCENIC[SCENIC$Cell %in% colnames(obj),]
SCENIC <- obj@images[[1]]@coordinates[,c("imagerow", "imagecol")]
pos <- Seurat::RunMoransI(SCENIC[-1] |> scale() |> t(), pos = pos)
molI
molImc.cores = 4L)
}, names(molI_frame_hu) <- c("yao1", "yao2", "yao5", "yao6")
write_rds(molI_frame, file = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/mouse_MoransI.rds") )
write_rds(molI_frame_hu, file = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/human_MoransI.rds") )
<- lapply(molI_frame, function(x){
molI_frame_ft |> dplyr::filter(observed > 0.2) |> rownames_to_column("TF")
x
})<- lapply(molI_frame_hu, function(x){
molI_frame_hu_ft |> dplyr::filter(observed > 0.2) |> rownames_to_column("TF")
x
})
<- function(obj, spmolI, k = 7, fn){
cluster_tf <- SCENIC[,c(T, colSums(SCENIC[-1]) > 0)]
SCENIC <- SCENIC[SCENIC$Cell %in% colnames(obj),]
SCENIC <- SCENIC |> column_to_rownames(var = "Cell") |> dplyr::select(any_of(spmolI))
SCENIC
<- SCENIC |> scale
SCENIC_scale <- cor(SCENIC_scale, method = "spearman")
corm <- hclust(as.dist(1-corm), method = "ward.D2")
hc
<- Heatmap(corm,
htd cluster_columns = hc,
cluster_rows = hc,
column_split = k,
row_split = k)
pdf(fn, width = 30, height = 30)
print(htd)
dev.off()
<- column_order(htd)
odc dev.off()
lapply(1:length(odc), function(i){
tibble(
tf = colnames(corm)[odc[[i]]],
group = paste0("cluster_", i)
)|>
}) list_rbind()
}<- function(SCENIC, cluster_tf_df, obj){
aggrated_value <- SCENIC |>
summarise_tf_cluster pivot_longer(cols = -Cell, names_to = "tf") |>
left_join(cluster_tf_df) |>
na.omit() |>
group_by(group, Cell) |>
summarise(value = mean(value)) |>
ungroup()
<- summarise_tf_cluster |>
img_summarise_tf_cluster left_join(
@images[[1]]@coordinates[,c("imagerow", "imagecol")] |> rownames_to_column(var = "Cell")
obj
)
img_summarise_tf_cluster
}<- function(img_summarise_tf_cluster){
plot_sp <- img_summarise_tf_cluster |>
p ggplot(aes(x = imagecol, y = imagerow, color = value)) +
geom_point() +
theme_classic()+
scale_color_viridis() +
facet_wrap(~group, ncol = 4) +
coord_fixed()
p
}
c("ME9.5", "ME11.5x1", "ME11.5x2", "ME13.5")
<- "ME9.5"
sample_id <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- mouseobjlist[[sample_id]]
obj <- molI_frame_ft[[sample_id]]$TF
spmolI <- cluster_tf(obj, spmolI, k = 7, fn = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_heatmap.pdf"))
cluster_tf_df write_csv(cluster_tf_df, file = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_tf.csv"))
<- aggrated_value(SCENIC, cluster_tf_df, obj)
img_summarise_tf_cluster <- plot_sp(img_summarise_tf_cluster)
p
pdf(glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_tf.pdf"),
width = 10, height = 5)
print(p)
dev.off()
<- "ME11.5x1"
sample_id <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- mouseobjlist[[sample_id]]
obj <- molI_frame_ft[[sample_id]]$TF
spmolI <- cluster_tf(obj, spmolI, k = 7, fn = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_heatmap.pdf"))
cluster_tf_df write_csv(cluster_tf_df, file = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_tf.csv"))
<- aggrated_value(SCENIC, cluster_tf_df, obj)
img_summarise_tf_cluster <- plot_sp(img_summarise_tf_cluster)
p
pdf(glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_tf.pdf"),
width = 15, height = 10)
print(p)
dev.off()
<- "ME11.5x2"
sample_id <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- mouseobjlist[[sample_id]]
obj <- molI_frame_ft[[sample_id]]$TF
spmolI <- cluster_tf(obj, spmolI, k = 7, fn = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_heatmap.pdf"))
cluster_tf_df write_csv(cluster_tf_df, file = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_tf.csv"))
<- aggrated_value(SCENIC, cluster_tf_df, obj)
img_summarise_tf_cluster <- plot_sp(img_summarise_tf_cluster)
p
pdf(glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_tf.pdf"),
width = 15, height = 10)
print(p)
dev.off()
<- "ME13.5"
sample_id <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- mouseobjlist[[sample_id]]
obj <- molI_frame_ft[[sample_id]]$TF
spmolI <- cluster_tf(obj, spmolI, k = 7, fn = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_heatmap.pdf"))
cluster_tf_df write_csv(cluster_tf_df, file = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_tf.csv"))
<- aggrated_value(SCENIC, cluster_tf_df, obj)
img_summarise_tf_cluster <- plot_sp(img_summarise_tf_cluster)
p
pdf(glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/mouse/{sample_id}/cluster_tf.pdf"),
width = 20, height = 18)
print(p)
dev.off()
c("yao1", "yao2", "yao5", "yao6")
<- "yao1"
sample_id <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- humanobjlist[[sample_id]]
obj <- molI_frame_hu_ft[[sample_id]]$TF
spmolI <- cluster_tf(obj, spmolI, k = 7, fn = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_heatmap.pdf"))
cluster_tf_df write_csv(cluster_tf_df, file = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_tf.csv"))
<- aggrated_value(SCENIC, cluster_tf_df, obj)
img_summarise_tf_cluster <- plot_sp(img_summarise_tf_cluster)
p
pdf(glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_tf.pdf"),
width = 14, height = 7)
print(p)
dev.off()
<- "yao2"
sample_id <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- humanobjlist[[sample_id]]
obj <- molI_frame_hu_ft[[sample_id]]$TF
spmolI <- cluster_tf(obj, spmolI, k = 7, fn = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_heatmap.pdf"))
cluster_tf_df write_csv(cluster_tf_df, file = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_tf.csv"))
<- aggrated_value(SCENIC, cluster_tf_df, obj)
img_summarise_tf_cluster <- plot_sp(img_summarise_tf_cluster)
p
pdf(glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_tf.pdf"),
width = 14, height = 10)
print(p)
dev.off()
<- "yao6"
sample_id <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- humanobjlist[[sample_id]]
obj <- molI_frame_hu_ft[[sample_id]]$TF
spmolI <- cluster_tf(obj, spmolI, k = 7, fn = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_heatmap.pdf"))
cluster_tf_df write_csv(cluster_tf_df, file = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_tf.csv"))
<- aggrated_value(SCENIC, cluster_tf_df, obj)
img_summarise_tf_cluster <- plot_sp(img_summarise_tf_cluster)
p
pdf(glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_tf.pdf"),
width = 20, height = 12)
print(p)
dev.off()
<- "yao5"
sample_id <- glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/{sample_id}_SCENIC.csv") |>
SCENIC read_csv()
<- humanobjlist[[sample_id]]
obj <- molI_frame_hu_ft[[sample_id]]$TF
spmolI <- cluster_tf(obj, spmolI, k = 7, fn = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_heatmap.pdf"))
cluster_tf_df write_csv(cluster_tf_df, file = glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_tf.csv"))
<- aggrated_value(SCENIC, cluster_tf_df, obj)
img_summarise_tf_cluster <- plot_sp(img_summarise_tf_cluster)
p
pdf(glue::glue("~/projects/embryo/analysis/zhangjing/human/rnaseq/pyscenic/human/{sample_id}/cluster_tf.pdf"),
width = 30, height = 17)
print(p)
dev.off()