R语言设置国内源

~/Rprofile

# set a CRAN mirror
local({r <- getOption("repos")
r["CRAN"] <- "https://mirrors.aliyun.com/CRAN/"
options(repos=r)})
options("repos" = c(CRAN= "https://mirrors.aliyun.com/CRAN/"))
options(BioC_mirror= "https://mirrors.tuna.tsinghua.edu.cn/bioconductor")

Bioconductor 镜像使用帮助
CRAN 镜像使用帮助
查看设置成功

options()$repos

命令安装

apt-cache madison  r-base
sudo apt-get install r-base-dev=4.1.0-1.2004.0

R源码安装

./configure  --prefix=/pathto/R_3.6.0  --enable-R-shlib CPPFLAGS="-I/usr/include -I/path/zlib_1.2.11/include -I/path/bzip2-1.0.6/include -I/path/xz-5.2.4/include -I/path/pcre-8.43/include" LDFLAGS="-L/usr/lib -L/usr/lib64 -L/path/zlib_1.2.11/lib -L/path/bzip2-1.0.6/lib -L/path/xz-5.2.4/lib -L/path/pcre-8.43/lib -Wl,-rpath=/path/pcre-8.43/lib -Wl,-rpath=/path/xz-5.2.4/lib"

make

../../lib/libR.so: undefined reference to `ucol_strcollIter_58'
../../lib/libR.so: undefined reference to `u_getVersion_58'
../../lib/libR.so: undefined reference to `uloc_setDefault_58'
../../lib/libR.so: undefined reference to `ucol_close_58'
../../lib/libR.so: undefined reference to `ucol_getLocaleByType_58'
../../lib/libR.so: undefined reference to `ucol_setAttribute_58'
../../lib/libR.so: undefined reference to `u_versionToString_58'
../../lib/libR.so: undefined reference to `ucol_open_58'
../../lib/libR.so: undefined reference to `uiter_setUTF8_58'
../../lib/libR.so: undefined reference to `ucol_setStrength_58'
collect2: ld returned 1 exit status
make[3]: *** [Makefile:145: R.bin] Error 1
make[3]: Leaving directory '/software/R-3.6.0/src/main'
make[2]: *** [Makefile:136: R] Error 2
make[2]: Leaving directory '/software/R-3.6.0/src/main'
make[1]: *** [Makefile:28: R] Error 1
make[1]: Leaving directory '/software/R-3.6.0/src'
make: *** [Makefile:61: R] Error 1

https://stackoverflow.com/questions/57724031/how-to-set-parameter-to-solve-some-compile-error-like-below-when-make-r

https://blog.csdn.net/renyongzhe/article/details/101352683

安装R4.1

https://mirrors.bfsu.edu.cn/CRAN/

sudo apt-get install r-base
sudo apt-get install r-base-dev
sudo apt-get install libcurl4-openssl-dev libssl-dev
sudo apt-get install git

R包的使用

##安装
https://remotes.r-lib.org/reference/install_git.html

remotes::install_local()

install.packages("stepNorm", contriburl="http://url", lib="mydir")

查看已加载的包

(.packages())

卸除已加载的包

detach(“package:RMySQL”)

安装包

卸载已加载的包

remove. packages(c(“pkg1”,”pkg2”) , lib = file .path(“path”, “to”, “library”))

查看已安装的包

installed.packages()
library()

查看某个包提供的函数

help(package=’TSA’)

查看某个函数属于哪个包

help(函数名)

升级包

update.packages()

查看变量

ls.str()
ls()

R包的安装位置

.libPaths()

临时修改R包的安装位置

.libPaths("E:/R_library")
.libPaths()

临时修改R配置文件

修改安装目录下 /etc/profile.site文件来完成

修改环境变量

R_LIBS_SITE: 用来设置系统级别的目录
R_LIBS_USER:用来设置用户级别的目录

关于这个项目

这个项目基于NASQAR篇文献中的SeuratV3Wizard进行二次开发,实现了基于web的单细胞数据分析。

NASQAR中提供了许多基于web的生信分析工具,更多详见:https://nasqar.abudhabi.nyu.edu/

在线实例

快速开始

本项目可以通过两种方式运行

基于R package的方式

有关R package的更多知识,请参考devtools,或我们总结的文档devtools

devtools::install_git("http://10.110.1.10:3000/wangyang/SingleCellOnline")
wget http://10.110.1.10:3000/wangyang/SingleCellOnline/archive/master.zip

devtools::install_local("./master.zip")
git clone http://10.110.1.10:3000/wangyang/SingleCellOnline.git
cd SingleCellOnline/

devtools::install()
git clone http://10.110.1.10:3000/wangyang/SingleCellOnline.git
cd SingleCellOnline/


R CMD INSTALL .

注意通过devtools的方式安装,可以自动解决依赖;通过R CMD INSTALL .种方式安装需要手动运行install-seurat.R里面的内容。

通过以上方式安装好R package之后,通过以下命令运行web服务。

library(SeuratV3Wizard)
SeuratV3Wizard()

这将默认运行在http://0.0.0.0:1234/

基于shiny的方式

要使用shiny app的方式运行,只能通过源代码。

git clone http://10.110.1.10:3000/wangyang/SingleCellOnline.git
cd SingleCellOnline/inst/shiny/

shiny::runApp("./",host = "0.0.0.0",port = 1234,launch.browser = FALSE)

开发流程

程序调试

关于shiny debug的方式请参考:Debugging Shiny applications

服务器部署

关于shiny部署的更多内容请参考: Shiny Server Professional

更多关于shiny的技能

更多shniy的技能请参考:http://10.110.1.10/R/shiny/

参考