随记
R
-
出现Error in getGlobalsAndPackages的办法
-
Rmarkdown cell隐藏输出结果设置 include=F 办法
-
markdown增加按钮设置:
<details> <summary>content</summary> expression </details>
-
读取.rda文件,直接使用load函数
-
Convert Seurat object into monocle CDS data method
-
发生 **package ‘XXX’ is not available (for R version 4.0.2) **的错误 办法
- 本次没有找到办法
-
microsoft open R 无法修改default R library
-
Seurat的metadata添加列,保证行名一致
Idents(HF.dat) %>% data.frame() %>% setNames("New_Cell") -> a1 test <- AddMetaData(object = HF.dat, metadata = a1, col.name = "New_cell")
-
如何合并多个seurat object: 使用merge函数
seurat.object <- merge(p1, y = c(p2, p3, p4, p5, HF_object), project = "Heart Failure")
-
seurat的RunTSNE存在duplicates时报错解决办法:check_duplicates = FALSE
-
#Edit ~/.Rprofile or ~/.bashrc export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8
-
动态依赖包丢失:libicui18n.so.58: cannot open shared object file: No such file or directory 重装anaconda和R
Error: package or namespace load failed for 'DESeq2' in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/data/share/anaconda3/lib/R/library/stringi/libs/stringi.so': libicui18n.so.58: cannot open shared object file: No such file or directory
-
seurat clustering不是基于raw counts,而是基于raw counts的principal components,PC是使用most variability genes 的线性组合。
-
scRNA子分类方法:1. 降低分辨率,查看属于大类的子类是哪些;2.选择感兴趣的子类,重新聚类;
-
修改seurat Doheatmap函数的颜色显示参数
mapal <- colorRampPalette(c("blue", "white", "red"))(60) DoHeatmap(object = data.sub.new, features = top10$gene, label = TRUE)+ scale_fill_gradientn(colours = mapal)
-
pathway analysis of cell culsters
# ReactomeGSA http://bioconductor.org/packages/release/bioc/vignettes/ReactomeGSA/inst/doc/analysing-scRNAseq.html gsva_result <- analyse_sc_clusters(jerby_b_cells, verbose = TRUE) # GO enrichment terms https://ucdavis-bioinformatics-training.github.io/2017_2018-single-cell-RNA-sequencing-Workshop-UCD_UCB_UCSF/day3/scRNA_Workshop-PART6.html ## Create topGOdata object GOdata <- new("topGOdata", ontology = "BP", # use biological process ontology allGenes = geneList, geneSelectionFun = function(x)(x == 1), annot = annFUN.org, mapping = "org.Mm.eg.db", ID = "symbol") ## Test for enrichment using Fisher's Exact Test resultFisher <- runTest(GOdata, algorithm = "elim", statistic = "fisher") ## get gentable GenTable(GOdata, Fisher = resultFisher, topNodes = 20, numChar = 60) #Annotated: number of genes (out of all.genes) that are annotated with that GO term #Significant: number of genes that are annotated with that GO term and meet our criteria for “expressed” #Expected: Under random chance, number of genes that would be expected to be annotated with that GO term and meeting our criteria for “expressed” #Fisher: (Raw) p-value from Fisher’s Exact Test
-
Rmarkdown生成markdown过程,
knitr::opts_chunk$set(echo=T, warning=FALSE, message=FALSE)
设置echo=T
可获取输出结果。 -
rowwise() %>% mutate(SumAbundance=mean(c_across(everything()))) %>% ungroup() %>%
-
dplyr的mutate函数会丢失行名
-
format 数字
formatC(seq(1:100), width = 3, flag=0)
-
安装指定版本R包的方法
- 使用命令: devtools::install_version("Rcpp", version = "1.0.4.6",repos = "http://cran.us.r-project.org")
- 到https://mirrors.tuna.tsinghua.edu.cn/CRAN/下下载Rcpp_1.0.4.6.tar.gz文件后再本地安装
linux
-
杀死进程:top 或 ps命令查看进程PID,后使用 kill -s 9 PID
-
高速并发下载软件axel替代wget
-
centos8 网络配置文件路径 cd /etc/sysconfig/network-scripts/
-
查看服务器IP地址 ifconfig,设置静态IP地址
-
更改Homebrew的update设置(每次使用brew install packages时候一直出现homebrew updating等候):办法
-
conda activate py27报错conda init,先source activate进入base再conda deactivate
-
怎么下载B站视频并将flv转换成MP4格式
-
sudo apt-get install ffmpeg ffmpeg -i input2.flv -c copy output2.mp4
-
# 更新升级所有软件 sudo apt-get upgrade # 更新某个软件 sudo apt-get upgrade softname # 列出可更新软件 sudo apt list --upgradable
-
ssh登陆服务器的方法 ssh -p port name@ip
-
查看服务器操作系统信息 cat /proc/version
-
export LC_ALL="en_US.UTF-8" export LC_CTYPE="en_US.UTF-8"
-
本地安装已下载conda包:conda install --use-local icu-58.2-he6710b0_3.tar.bz2
wget https://anaconda.org/anaconda/icu/58.2/download/linux-64/icu-58.2-he6710b0_3.tar.bz2
-
解压tar.gz文件:
unzip filename. zip tar -zxvf filename. tar.gz tar -Jxvf filename. tar.xz tar -Zxvf filename. tar.Z
-
运行python出现 **python: symbol lookup error: /data/share/anaconda3/lib/python3.8/site-packages/mkl/../../../libmkl_intel_thread.so: undefined symbol: omp_get_num_procs **: 解决办法:
Visualization
-
机器学习lesson1 R 机器学习流程及案例实现
-
修改geom_boxplot的thickness:lwd(line width)=3
-
修改axis的thickness:within theme()
# axis-line thickness axis.line = element_line(color="black", size=2) # tick thickness aixs.ticks = elemet_line(color="black", size=2)
-
geom_boxplot修改boxplot线条粗细 lwd = 2 参数\
-
R配置渐变色
colors <- colorRampPalette(c("blue", "red"))(5)
windows
- 简体字和繁体字切换 Ctrl + shift + F 方法
markdown
-
放置照片的html语言
<p align="center"> <img src="figure.png" width="800" height="500"> </p>
-
Hello there! <center><img src="" ...></center> <center>This is an image</center> Hi!
-
标题居中的用法
# method1 : https://blog.csdn.net/qq_43444349/article/details/106366671 <h1 align = "center"> title head1</h1> # method2 <div align='center' ><font size='4'>The brief introduction of scRNA-seq data analysis</font></div>
amplicon
- vsearch joint PE reads出现错误,reads测序质量太差导致无法合并 参考
shiny
-
只需要输入源文名字和新名字,是否就可以重命名了,能够用R写一个
-
shiny入门,解决同事的图片组合问题,搭建自己的网站?
-
apps的位置 /srv/shiny-server/
-
config文件 /opt/shiny-server/config
-
日志文件目录 /var/log/shiny-server
-
root无R版本,利用软连接在/usr/bin下建立
ln -s /disk/share/anaconda3/bin/R /usr/bin/R
-
-
site和log路径无法更改(暂时没有找到更改办法),但可建立软连接
ln -s /disk2/user/zouhua/shiny/shiny-server-site/apps apps
-
shiny读取文件并画图遇到Error: 'file' must be a character string or connection错误的解决办法
# 读取输出数据的方法 inFile <- input$file1 # 读取输入文件的全部信息(包含路径信息) dat <- read.table(inFile$datapath) # dat <- read.table(input$file1$datapath)
software
-
PRICE find the CDS region
-
# 16s功能预测 conda create --name picrust2 -c bioconda picrust2 -y # https://github.com/bwemheu/Tax4Fun2 # metaphlan2 安装 conda create --name mpa -c bioconda python=3.7 metaphlan -y # metaphlan2软件包下载 metaphlan --install --index mpa_v30_CHOCOPhlAn_201901 --bowtie2db /data/share/database/metaphlan_databases/ # lefse conda create --name lefse -c bioconda lefse -y # humann 软件 conda install -n mpa humann -y # humann数据库 humann_databases --download chocophlan full humann_databases/ humann_databases --download uniref uniref90_diamond humann_databases/ # phylophlan conda install -n mpa phylophlan -y
-
# 安装metawrap git clone https://github.com/bxlab/metaWRAP.git PATH=yourpath/metaWRAP/bin/:$PATH # 创建环境和安装依赖包 conda create -y -n metawrap-env python=2.7 checkm-genome conda activate metawrap-env conda install --only-deps -c ursky metawrap-mg mkdir checkm_data NCBI_nt Kraken_database # 下载checkm data wget https://data.ace.uq.edu.au/public/CheckM_databases/checkm_data_2015_01_16.tar.gz # 下载NCBI_nt wget "ftp://ftp.ncbi.nlm.nih.gov/blast/db/nt.*.tar.gz" # 下载NCBI_tax wget ftp://ftp.ncbi.nlm.nih.gov/pub/taxonomy/taxdump.tar.gz
-
下载bcl2fastq软件
wget ftp://webdata:webdata@ussd-ftp.illumina.com/Downloads/Software/bcl2fastq/bcl2fastq-1.8.4-Linux-x86_64.rpm yum install bcl2fastq-1.8.4-Linux-x86_64.rpm
下载Kraken2 database
wget ftp://ftp.ccb.jhu.edu/pub/data/kraken2_dbs/old/minikraken2_v2_8GB_201904.tgz
metaWRAP安装
Biology
- trans- cis-pQTLs是什么意思
- RNA-seq网站:包含各类工具和最新研究
mac os
自学
Math
-
reduce batch effects: 什么是批次效应批次效应只能降低,不能消除;DESeq2的添加batch参数
VOOM + SNN : 构建符合snm的model.matrix数据
Therefore, we implemented a pipeline that converted discrete taxonomical counts into log-counts per million (log-cpm) per sample using Voom, and performed supervised normalization (SNM). Principal variance components analysis showed that normalization reduced batch effects while increasing biological signal, including “disease type” (i.e. cancer type), above the individual technical variables.
收集信息
-
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("ExperimentHubData") loman <- curatedMetagenomicData("LomanNJ_2013.metaphlan_bugs_list.stool", dryrun = FALSE)
网友评论