全部代码如下:
exprSet=exprs(gset)
boxplot(exprSet)
boxplot(exprSet,outline=FALSE, notch=T,col=group_list, las=2)
library(limma)
exprSet=normalizeBetweenArrays(exprSet)
boxplot(exprSet,outline=FALSE, notch=T,col=group_list, las=2)
exprSet=as.data.frame(exprSet)
ex <- exprSet
qx <- as.numeric(quantile(ex, c(0., 0.25, 0.5, 0.75, 0.99, 1.0), na.rm=T))
LogC <- (qx[5] > 100) ||
(qx[6]-qx[1] > 50 && qx[2] > 0) ||
(qx[2] > 0 && qx[2] < 1 && qx[4] > 1 && qx[4] < 2)
if (LogC) { ex[which(ex <= 0)] <- NaN
exprSet <- log2(ex)
print("log2 transform finished")}else{print("log2 transform not needed")}
GPL_anno <-data.table::fread("GSE68619_family.soft",skip ="ID",data.table = F)
library(dplyr)
library(tidyr)
probe2symbol_df <- GPL_anno %>%
dplyr::select(ID,gene_assignment) %>% # 选择GPL_anno的ID列和gene_assignment列
filter(gene_assignment != "---") %>% # 删掉gene_assignment列是"---"的,因为啥也没有
separate(gene_assignment,c("drop","symbol"),sep="//") %>% # 根据"//"分割,分割得到的前两个命名为"drop"和"symbol"
dplyr::select(-drop) # 把“drop”去掉
colnames(probe2symbol_df) <-c("probeset","symbol")
probe2symbol_df=as.character(probe2symbol_df)
##################以下代码运行后开始报错
library(dplyr)
library(tibble)
exprSet <- exprSet %>%
rownames_to_column(var="probeset") %>%
#合并探针的信息
inner_join(probe2symbol_df,by="probeset") %>%
#去掉多余信息
select(-probeset) %>%
#重新排列
select(symbol,everything()) %>%
#求出平均数(这边的点号代表上一步产出的数据)
mutate(rowMean =rowMeans(.[grep("GSM", names(.))])) %>%
#去除symbol中的NA
filter(symbol != "NA") %>%
#把表达量的平均值按从大到小排序
arrange(desc(rowMean)) %>%
# symbol留下第一个
distinct(symbol,.keep_all = T) %>%
#反向选择去除rowMean这一列
select(-rowMean) %>%
# 列名变成行名
column_to_rownames(var = "symbol")
错误:‘x'和'y’must share the same src ,set 'copy'=TRUE(may be slow)
Run `rlang::last_trace()` to see the full context.
> rlang::last_trace()
<error/rlang_error>
`x` and `y` must share the same src, set `copy` = TRUE (may be slow).
Backtrace:
x
1. \-`%>%`(...)
2. +-base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
3. \-base::eval(quote(`_fseq`(`_lhs`)), env, env)
4. \-base::eval(quote(`_fseq`(`_lhs`)), env, env)
5. \-`_fseq`(`_lhs`)
6. \-magrittr::freduce(value, `_function_list`)
7. \-function_list[[i]](value)
8. +-dplyr::inner_join(., probe2symbol_df, by = "probeset")
9. \-dplyr:::inner_join.data.frame(., probe2symbol_df, by = "probeset")
10. \-dplyr::auto_copy(x, y, copy = copy)
11. \-dplyr:::glubort(...)