1)简介:

DESeq2-package: for differential analysis of count data(对count data 做差异分析)

2)安装

if("DESeq2" %in% rownames(installed.packages()) == FALSE) {source("http://bioconductor.org/biocLite.R");biocLite("DESeq2")}
suppressMessages(library(DESeq2))
ls('package:DESeq2')

3)对象的使用说明

3.1)coef(Extract a matrix of model coefficients/standard errors,高级用户检验模型系数)

语法:coef(object, SE = FALSE, ...)

参数解释:

object:a DESeqDataSet returned by DESeq, nbinomWaldTest, or nbinomLRT.

例子:

dds <- makeExampleDESeqDataSet(m=4)
dds <- DESeq(dds)
coef(dds)[1,]
coef(dds, SE=TRUE)[1,]

3.2) collapseReplicates:Collapse technical replicates in a RangedSummarizedExperiment or DESeqDataSet(用于消除技术重复)
用法:collapseReplicates(object, groupby, run, renameCols = TRUE)
参数:

object:A RangedSummarizedExperiment or DESeqDataSet
groupby:a grouping factor, as long as the columns of object,分组因子
run:optional, the names of each unique column in object. if provided, a new column runsCollapsed will be added to the colData which pastes together the names of run (测序run)
renameCols:whether to rename the columns of the returned object using the levels of the grouping factor

例子:

dds <- makeExampleDESeqDataSet(m=12)
str(dds)
dds$sample <- factor(sample(paste0("sample",rep(1:9, c(2,1,1,2,1,1,2,1,1))))) (#共9个样品:其中 3个样品有2个技术重重)
dds$run <- paste0("run",1:12) #12个run道
ddsColl <- collapseReplicates(dds, dds$sample, dds$run)
# examine the colData and column names of the collapsed data
colData(ddsColl)
colnames(ddsColl)
# check that the sum of the counts for "sample1" is the same
# as the counts in the "sample1" column in ddsColl
matchFirstLevel <- dds$sample == levels(dds$sample)[1]
stopifnot(all(rowSums(counts(dds[,matchFirstLevel])) == counts(ddsColl[,1])))

3.3)counts:Accessors for the ’counts’ slot of a DESeqDataSet object(对表达矩阵进行统计,)

one row for each observational unit (gene or the like), and one column for each sample(行代表观察值(例如基因),列代表样本(例如肝、脾、肾等))

语法:counts(object, normalized = FALSE,replaced = FALSE)

参数:

object:a DESeqDataSet object(表达矩阵).
normalized:logical indicating whether or not to divide the counts by the size factors or normalization factors before returning (normalization factors always preempt size factors),(即不同量级的数据要不要归一化)
replaced:返回极端值

dds <- makeExampleDESeqDataSet(m=4)  ##构建一个表达矩阵
head(counts(dds))
dds <- estimateSizeFactors(dds) # run this or DESeq() first
head(counts(dds, normalized=TRUE))

3.4)DESeq:Differential expression analysis based on the Negative Binomial (a.k.a.Gamma-Poisson) distribution(基于负二项分布进行差异分析)

语法:

DESeq(object, test = c("Wald", "LRT"), fitType = c("parametric", "local","mean"), sfType = c("ratio", "poscounts", "iterate"), betaPrior,full = design(object), reduced, quiet = FALSE,minReplicatesForReplace = 7, modelMatrixType, useT = FALSE, minmu = 0.5,
parallel = FALSE, BPPARAM = bpparam())

参数:

object:a DESeqDataSet object(表达矩阵对象)
test:Wald" or "LRT"检验
fitType:either "parametric", "local", or "mean"
sfType:either "ratio", "poscounts", or "iterate" for teh type of size factor estimation.
betaPrior:whether or not to put a zero-mean normal prior on the non-intercept coefficients
reduced:for test="LRT", a reduced formula to compare against
quiet:whether to print messages at each step
minReplicatesForReplace:the minimum number of replicates required
modelMatrixType:either "standard" or "expanded", which describe how the model matrix, X of the GLM formula is formed.
useT:logical, passed to nbinomWaldTest, default is FALSE
minmu:lower bound on the estimated count for fitting gene-wise dispersion
parallel:if FALSE, no parallelization. if TRUE, parallel execution using BiocParallel,
BPPARAM:an optional parameter object passed internally to bplapply when parallel=TRUE.
例子:

# count tables from RNA-Seq data
cnts <- matrix(rnbinom(n=1000, mu=100, size=1/0.5), ncol=10)
cond <- factor(rep(1:2, each=5)) # object construction
dds <- DESeqDataSetFromMatrix(cnts, DataFrame(cond), ~ cond) # standard analysis
dds <- DESeq(dds)
res <- results(dds) # moderated log2 fold changes
resultsNames(dds)
resLFC <- lfcShrink(dds, coef=2, type="apeglm") # an alternate analysis: likelihood ratio test
ddsLRT <- DESeq(dds, test="LRT", reduced= ~ 1)
resLRT <- results(ddsLRT)

3.5)DESeqDataSet-class(DESeqDataSet object and constructors)

语法:

DESeqDataSet(se, design, ignoreRank = FALSE)
DESeqDataSetFromMatrix(countData, colData, design, tidy = FALSE,ignoreRank = FALSE, ...)
DESeqDataSetFromHTSeqCount(sampleTable, directory = ".", design,ignoreRank = FALSE, ...)
DESeqDataSetFromTximport(txi, colData, design, ...)

例子:

countData <- matrix(1:100,ncol=4)
condition <- factor(c("A","A","B","B"))
dds <- DESeqDataSetFromMatrix(countData, DataFrame(condition), ~ condition)

3.6)DESeqResults-class:DESeqResults object and constructor

语法:DESeqResults(DataFrame, priorInfo = list())

参数:

DataFrame:a DataFrame of results, standard column names are: baseMean, log2FoldChange,lfcSE, stat, pvalue, padj.
priorInfo:a list giving information on the log fold change prior

3.7)DESeqTransform-class(DESeqTransform object and constructor)

语法:DESeqTransform(SummarizedExperiment)

参数:SummarizedExperiment a RangedSummarizedExperiment

3.8)rlog Apply a ’regularized log’ transformation

用法:
rlog(object, blind = TRUE, intercept, betaPriorVar, fitType = "parametric")
rlogTransformation(object, blind = TRUE, intercept, betaPriorVar,fitType = "parametric")

dds <- makeExampleDESeqDataSet(m=6,betaSD=1)
rld <- rlog(dds)
dists <- dist(t(assay(rld)))
plot(hclust(dists))

3.9)plotPCA(Sample PCA plot for transformed data)

用法:plotPCA(object, intgroup = "condition",ntop = 500, returnData = FALSE)

参数:

object:a DESeqTransform object, with data in assay(x), produced for example by either rlog or varianceStabilizingTransformation.
intgroup: interesting groups: a character vector of names in colData(x) to use for grouping
ntop:number of top genes to use for principal components, selected by highest row variance
returnData:should the function only return the data.frame of PC1 and PC2 with intgroup covariates for custom plotting

# using rlog transformed data:
dds <- makeExampleDESeqDataSet(betaSD=1)
rld <- rlog(dds)
plotPCA(rld) # also possible to perform custom transformation:
dds <- estimateSizeFactors(dds)
# shifted log of normalized counts
se <- SummarizedExperiment(log2(counts(dds, normalized=TRUE) + 1),
colData=colData(dds))
# the call to DESeqTransform() is needed to
# trigger our plotPCA method.
plotPCA( DESeqTransform( se ) )

3.10)

DESeq2包的更多相关文章

  1. 简单使用DESeq2/EdgeR做差异分析

    简单使用DESeq2/EdgeR做差异分析 Posted: 五月 07, 2017  Under: Transcriptomics  By Kai  no Comments DESeq2和EdgeR都 ...

  2. airway之workflow

    1)airway简介 在该workflow中,所用的数据集来自RNA-seq,气道平滑肌细胞(airway  smooth muscle cells )用氟美松(糖皮质激素,抗炎药)处理.例如,哮喘患 ...

  3. miRAN 分析以及mRNA分析

    一些参考资料 http://www.360doc.com/content/17/0528/22/19913717_658086490.shtml https://www.cnblogs.com/tri ...

  4. Error in library(DESeq2) : 不存在叫‘DESeq2’这个名字的程辑包

    Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type&quo ...

  5. DESeq2 install --- 如何安装R包("RcppArmadillo")?

    安装R包("RcppArmadillo")失败,导致依赖该包的DESeq2 无法使用: 首先对gcc,g++升级至4.7, 但依然报错,还是安装不了RcppArmadillo: 报 ...

  6. R包安装的正确方式

    options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")) if(! req ...

  7. Npm包的开发

    个人开发包的目录结构 ├── coverage //istanbul测试覆盖率生成的文件 ├── index.js //入口文件 ├── introduce.md //说明文件 ├── lib │   ...

  8. Windows server 2012 添加中文语言包(英文转为中文)(离线)

    Windows server 2012 添加中文语言包(英文转为中文)(离线) 相关资料: 公司环境:亚马孙aws虚拟机 英文版Windows2012 中文SQL Server2012安装包,需要安装 ...

  9. 如何在nuget上传自己的包+搭建自己公司的NuGet服务器(新方法)

    运维相关:http://www.cnblogs.com/dunitian/p/4822808.html#iis 先注册一个nuget账号https://www.nuget.org/ 下载并安装一下Nu ...

随机推荐

  1. linux 标准I/O (一)

    在前面<UNIX环境高级编程----文件描述符浅析>一文中所讲的I/O函数都是针对文件描述符.而对于标准I/O库,它们的操作都是围绕流来进行的.当用标准I/O库打开或创建一个文件时,我们已 ...

  2. jquery easyUI 时间格式

    今天用到了jquery easyUI datetime-box, 显示的是英文格式的,作为国人看着很不爽, 看了下度娘,原来引入个/locale/easyui-lang-zh_CN.js这个js 就o ...

  3. HDFS高级开发培训课程之HDFS开发实例课件

    前言: 刚刚完成的HDFS高级开发培训课程课件中的一个章节,不知道PPT,如何导出HTML格式,只好批量导出图片,贴图了. 连接管理:建立连接.断开连接.设置连接参数 文件操作:浏览文件.上传文件.下 ...

  4. BASIC-14_蓝桥杯_时间转换

    示例代码: #include <stdio.h> int main(void){ int t = 0 , h = 0 , m = 0 , s = 0 ; scanf("%d&qu ...

  5. spring boot学习(1) hello world

    第一节:SpringBoot 简介 主要是简化开发: 1. 创建独立的Spring应用程序 2. 嵌入的Tomcat,无需部署WAR文件 3. 简化Maven配置 4. 自动配置Spring 5. 提 ...

  6. 峰Spring4学习(3)注入参数的几种类型

    People.java  model类: package com.cy.entity; import java.util.ArrayList; import java.util.HashMap; im ...

  7. numpy里的randn

    这个函数的作用就是从标准正态分布中返回一个或多个样本值.什么是标准正态分布 来源:http://www.360doc.com/content/17/0306/13/32342759_634411464 ...

  8. [UE4]蓝图重构

    假设现在有一个蓝图类BP_GunRife(已经有其它很多类在使用这个类),现在要增加另外一把枪BP_BunLauncher. 可以新建一个父类BP_Gun,让BP_GunRife和BP_BunLaun ...

  9. 详解UE4静态库与动态库的导入与使用

    转自:http://blog.csdn.net/u012999985/article/details/71554628 一.基本内容概述   最近做项目时经常看到build.cs文件,就想研究一下UE ...

  10. PHP学习方法总结

    怎样快速学好PHP技术  PHP学习方法总结   怎样快速学好PHP技术?我想这应该是大多数参加PHP培训学习PHP的同学比较关心和想要知道的问题,今天扣丁学堂小编就给大家简单谈谈怎样快速学好PHP技 ...