Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 在两组不同的数据之间进行对比_R_Bioconductor_Contrast - Fatal编程技术网

R 在两组不同的数据之间进行对比

R 在两组不同的数据之间进行对比,r,bioconductor,contrast,R,Bioconductor,Contrast,我需要在35个品系(微阵列)之间找到差异表达的基因。30行名称以RAL开头,5行名称以ZI开头。我想在30条RAL线和5条ZI线之间进行对比。因为我不想手动输入所有150个字符,所以我想使用makeContrast 我的数据如下: dput(sampletype) structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 9L, 9L,

我需要在35个品系(微阵列)之间找到差异表达的基因。30行名称以RAL开头,5行名称以ZI开头。我想在30条RAL线和5条ZI线之间进行对比。因为我不想手动输入所有150个字符,所以我想使用makeContrast

我的数据如下:

dput(sampletype)

structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 
5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L, 10L, 
10L, 10L, 11L, 11L, 11L, 12L, 12L, 12L, 13L, 13L, 13L, 14L, 14L, 
14L, 15L, 15L, 15L, 16L, 16L, 16L, 17L, 17L, 17L, 18L, 18L, 18L, 
19L, 19L, 19L, 20L, 20L, 20L, 21L, 21L, 21L, 22L, 22L, 22L, 23L, 
23L, 23L, 24L, 24L, 24L, 25L, 25L, 25L, 26L, 26L, 26L, 27L, 27L, 
27L, 28L, 28L, 28L, 29L, 29L, 29L, 30L, 30L, 30L, 31L, 31L, 32L, 
32L, 32L, 33L, 33L, 33L, 34L, 34L, 34L, 35L, 35L, 35L), .Label = c("RAL307", 
"RAL820", "RAL705", "RAL765", "RAL852", "RAL799", "RAL301", "RAL427", 
"RAL437", "RAL315", "RAL357", "RAL304", "RAL391", "RAL313", "RAL486", 
"RAL380", "RAL859", "RAL786", "RAL399", "RAL358", "RAL360", "RAL517", 
"RAL639", "RAL732", "RAL379", "RAL555", "RAL324", "RAL774", "RAL42", 
"RAL181", "ZI50N", "ZI186N", "ZI357N", "ZI31N", "ZI197N"), class = "factor")

design.matrix <- model.matrix(~ 0 + sample types)

谢谢

由于您在两个类别之间存在类别比较问题,我建议您阅读Bioconductor的limma软件包的用户指南,该软件包是一个用于识别差异表达基因的流行软件包()。如果您正在使用单色微阵列,则可以关注第9.2节

顺便说一下,您必须创建一个两级因子来执行比较:

# build the design matrix

library(limma)

yourfactor <- c(rep("RAL", 30),rep("ZI", 5))
design <- model.matrix(~ 0 + yourfactor)
colnames(design) <- gsub("yourfactor", "", colnames(design)) # to simplify the colnames of design

# perform the comparison


fit <- lmFit(data, design)    # data is your gene expression matrix
contrast.matrix <- makeContrasts(RAL-ZI, levels=design)
fit2 <- contrasts.fit(fit, contrast.matrix)
fit2 <- eBayes(fit2)

# summarize the results of the linear model
results <- topTable(fit2, number=nrow(data), adjust.method="BH")
#构建设计矩阵
图书馆(林玛)
你的因素
# build the design matrix

library(limma)

yourfactor <- c(rep("RAL", 30),rep("ZI", 5))
design <- model.matrix(~ 0 + yourfactor)
colnames(design) <- gsub("yourfactor", "", colnames(design)) # to simplify the colnames of design

# perform the comparison


fit <- lmFit(data, design)    # data is your gene expression matrix
contrast.matrix <- makeContrasts(RAL-ZI, levels=design)
fit2 <- contrasts.fit(fit, contrast.matrix)
fit2 <- eBayes(fit2)

# summarize the results of the linear model
results <- topTable(fit2, number=nrow(data), adjust.method="BH")