DAY1 差异分析前的数据导入和整理
> setwd("xena")
#xena需要与此任务在同一个文件夹里
> library(tidyverse)#每一次运算都要有这个步骤
> counts1 = read.table(file = "TCGA-LIHC.htseq_counts.tsv",sep = "\t",header = TRUE)
#先读取成为表格
> rownames(counts1)=counts1[,1]
#将第一列的内容作为行名
> counts1=counts1[,-1]
#将第一列的内容删掉
例 > substr("zhangguorong",1,4)
[1] "zhan"
#提取引号内内容前四位
table(substr(colnames(counts1),14,16))
01A 01B 02A 02B 11A
369 2 2 1 50
#c() 指一个集合
#%in% 前面是不是属于后面这个集合的
> counts1=counts1[,substr(colnames(counts1),14,16)%in%c("01A",'11A')]
#进行一个筛选
> table(substr(colnames(counts1),14,16))
01A 11A
369 50
> rownames(counts1)=substr(rownames(counts1),1,15)
#将网站里给到的adjusted数据重新转化为整数unit=log2(count+1)
> counts=ceiling(2^(counts1)-1)
> View(counts)
#将所得到的数据转化为文本格式
>write.table(counts,"counts.txt",sep="\t",row.name=T,col.names=NA,quote=F)
#再书写出一个新的表格
#会自动生成一个counts txt文件 在相应的文件夹里面