我在安装R包STUtility包时,一直处于失败的状态
https://ludvigla.github.io/STUtility_web_site/Installation.html
devtools::install_github("jbergenstrahle/STUtility")
最终总是显示
解决办法:
首先错误中提供的网址是可以下载的
下载后,本地安装即可
install.packages("~/Desktop/问题/jbergenstrahle-STUtility-1.1-2-gf120348.tar.gz", repos = NULL, type = "source")
这里会提示安装以下的依赖包
install.packages("zeallot")
install.packages("imager")
install.packages("Morpho")
install.packages("Rvcg")
install.packages("spatstat")
install.packages("imagerExtra")
install.packages("shinyjs")
install.packages("ggiraph")
再次安装就可以成功了
install.packages("~/Desktop/问题/jbergenstrahle-STUtility-1.1-2-gf120348.tar.gz", repos = NULL, type = "source")
测试demo
library(STutility)
library(SeuratData)
library(Seurat)
library(tidyverse)
df <- data.frame(samples =c("/Volumes/MACPAN/空间转录组数据集/BreastCancer/V1_Breast_Cancer_Block_A_Section_1/filtered_feature_bc_matrix.h5",
'/Volumes/MACPAN/空间转录组数据集/BreastCancer/V1_Breast_Cancer_Block_A_Section_2/filtered_feature_bc_matrix.h5'),
spotfiles = c("/Volumes/MACPAN/空间转录组数据集/BreastCancer/V1_Breast_Cancer_Block_A_Section_1/spatial/tissue_positions_list.csv",
'/Volumes/MACPAN/空间转录组数据集/BreastCancer/V1_Breast_Cancer_Block_A_Section_2/spatial/tissue_positions_list.csv'),
imgs = c("/Volumes/MACPAN/空间转录组数据集/BreastCancer/V1_Breast_Cancer_Block_A_Section_1/spatial/tissue_hires_image.png",
'/Volumes/MACPAN/空间转录组数据集/BreastCancer/V1_Breast_Cancer_Block_A_Section_2/spatial/tissue_hires_image.png'),
json = c("/Volumes/MACPAN/空间转录组数据集/BreastCancer/V1_Breast_Cancer_Block_A_Section_1/spatial/scalefactors_json.json",
'/Volumes/MACPAN/空间转录组数据集/BreastCancer/V1_Breast_Cancer_Block_A_Section_2/spatial/scalefactors_json.json'))
df
?InputFromTable # 依然会过滤一些
se <- InputFromTable(infotable = df,
min.gene.count = 100,
min.gene.spots = 5,
min.spot.count = 500,
platform = "Visium")
library(foreach)
library(parallel)
plt <- function(i){
print(ggplot() +
geom_histogram(data = se[[]], aes(get(i)), fill = "red", alpha = 0.7, color = "gray", bins = 50) +
Seurat::DarkTheme() +
ggtitle(paste0("Total", i , " per spots")))
}
pl = list()
pl1 <- foreach::foreach(i = c('nFeature_RNA','nCount_RNA'),.packages = c("Seurat","ggplot2")) %dopar% plt(i)
gene_attr <- data.frame(nUMI = Matrix::rowSums(se@assays$RNA@counts),
nSpots = Matrix::rowSums(se@assays$RNA@counts > 0))
plt2 <- function(i){
print(ggplot() +
geom_histogram(data = gene_attr, aes(get(i)), fill = "red", alpha = 0.7, color = "gray", bins = 50) +
Seurat::DarkTheme() +
ggtitle(paste0("Total", i , " per gene")))
}
pl2 <- foreach::foreach(i = c('nUMI','nSpots'),.packages = c("Seurat","ggplot2")) %dopar% plt2(i)
print(cowplot::plot_grid(plotlist = c(pl1,pl2)))