macOS devtools安装github包失败解决

本文档详细记录了解决R包STUtility安装过程中遇到的问题,包括从GitHub下载源代码并手动安装,以及安装依赖包的步骤。同时,提供了使用STUtility进行数据处理的代码示例,涉及SeuratData、Seurat、tidyverse等多个库的配合使用,展示了如何加载数据和绘制图表。
摘要由CSDN通过智能技术生成

我在安装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)))

结果如下
在这里插入图片描述

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值