最近很多人借TIDE账号,也有人问我如何进行数据标准化,按照网站说明,对于没有Control样本的测序数据,把表达量减去每个基因在所有样本中的平均值即可,即按照行计算平均值,再拿这一行所有表达量-该平均值。

#读取数据
Expr <- read.delim("TIDE_COAD.txt",sep = "\t",row.names = 1)
#使用apply函数
Expr <- t(apply(Expr, 1, function(x)x-(mean(x))))
一句代码就得到标准化矩阵
测试代码:
ma <- matrix(c(1:4, 1, 6:8), nrow = 2)
ma
# [,1] [,2] [,3] [,4]
#[1,] 1 3 1 7
#[2,] 2 4 6 8
apply(ma, 2, function(x)x-(mean(x))) ##按列计算
# [,1] [,2] [,3] [,4]
#[1,] -0.5 -0.5 -2.5 -0.5
#[2,] 0.5 0.5 2.5 0.5
apply(ma, 1, function(x)x-(mean(x))) ##按行计算
# [,1] [,2]
#[1,] -2 -3
#[2,] 0 -1
#[3,] -2 1
#[4,] 4 3
转置一下即可:
t(apply(ma, 1, function(x)x-(mean(x))))
# [,1] [,2] [,3] [,4]
#[1,] -2 0 -2 4
#[2,] -3 -1 1 3
apply函数参数帮助。
apply(X, MARGIN, FUN, …)
Arguments
X
an array, including a matrix.
MARGIN
a vector giving the subscripts which the function will be applied over. E.g., for a matrix 1 indicates rows, 2 indicates columns, c(1, 2) indicates rows and columns. Where X has named dimnames, it can be a character vector selecting dimension names.
FUN
the function to be applied: see ‘Details’. In the case of functions like +, %*%, etc., the function name must be backquoted or quoted.
…
optional arguments to FUN.
> Expr <- t(apply(tumor, 1, function(x)x-(mean(x))))
Error in apply(tumor, 1, function(x) x – (mean(x))) :
dim(X)的值必需是正数 为什么他会说dim(x)必须是正数
解决可了,没有更换名称
棒!
请问输入文件需要是什么格式呢?谢谢!
不需要什么特别格式,就是基因表达矩阵,列是样本,行是基因
请问可以展示一下您的数据集“TIDE_COAD.txt”的结构吗?
你好,文件里面就是基因表达矩阵,列是样本,行是基因
请问我在输入数据之后,网站提示必须是TAB制表符文件才能识别,但是我的文件制表符没问题,请问要怎么解决
确认是制表符分割的吗?搞不定可以加我微信 我看看
进哥,请问TIDE网站是不能用了吗?我用TIDE网站,点了predict response后为啥都是Page unavailable?还是我哪儿弄错了o(╥﹏╥)o,卡好久了
能用哇 刚刚试了一下 出结果了
请问数据应该在哪里下载呢,可不可以用UCSC中TCGA-BRCA的gene expression RNAseq中的IlluminaHiSeq (n=1,218) TCGA Hub数据,它是RSEM数据
应该可以的,不要取log的数据,标准化之后上传TIDE
试试看吧 我也不是很清楚
不过TIDE上提供了计算好的TCGA数据 直接下载即可
进哥,我想问一下,这个标准化后的矩阵应该怎么输出呢?
write.csv(Expr,”路径/文件名.csv”,row.names = F)