# if (!requireNamespace("BiocManager", quietly = TRUE))
# install.packages("BiocManager")
# BiocManager::install("TCseq")
if(F){
##//www.greatytc.com/p/26332e4da742
##将自己的数据处理成standard input data
## 安装
BiocManager::install("TCseq")
library(TCseq)
# 位置信息文件
genomicIntervals <- read.delim('intervial.txt',stringsAsFactors = FALSE)
genomicIntervals$chr <- as.factor(genomicIntervals$chr)
## 表达量矩阵文件
count <- read.delim('count.txt',header = T,row.names = 1)
# as.integer 转换为整数型
countsTable <- count %>% mutate(across(where(is.numeric), as.integer))
# or
#count1 <- apply(count, 2, as.integer)
rownames(countsTable) <- rownames(count)
##矩阵形式
countsTable <- as.matrix(countsTable)
# 分组文件
experiment <- read.delim('group.txt',header = T,stringsAsFactors = FALSE)
experiment$sampleid <- as.factor(experiment$sampleid)
}
#以下是官方文档modified
#三个输入文件:
#1)基因表达矩阵文件 **countsTable**
#2)分组文件(样品,时间点,分组三列) **experiment**
#3)基因的位置信息(染色体,起始及终止位点,基因id四列) **genomicIntervals**
library(TCseq)
############
#data preparation
############
str(experiment);class(experiment)
str(genomicIntervals);class(genomicIntervals)
str(countsTable);class(countsTable)
data("genomicIntervals")
head(genomicIntervals)
#Experiment design without BAM file information
data("experiment")
#Counts table
data("countsTable")
##creat a tca object
tca <- TCA(design = experiment, genomicFeature = genomicIntervals,
counts = countsTable)
tca
##or through **SummarizedExperiment** method
# suppressWarnings(library(SummarizedExperiment))
# se <- SummarizedExperiment(assays=list(counts = countsTable), colData = experiment)
# tca <- TCAFromSummarizedExperiment(se = se, genomicFeature = genomicIntervals)
#####
#differential analysis
#####
tca <- DBanalysis(tca)
#filter :The following step only keeps genomic regions with two or more more samples that have read counts more than 10.
tca <- DBanalysis(tca, filter.type = "raw", filter.value = 10, samplePassfilter = 2)
DBres <- DBresult(tca, group1 = "0h", group2 = c("24h","40h","72h"))
str(DBres, strict.width = "cut")
head(DBres$`24hvs0h`)
DBres.sig <- DBresult(tca, group1 = "0h", group2 = c("24h","40h","72h"), top.sig = TRUE) #top.sig = TRUE: abs(log2-fold > 2)&adjust p-value<0.05
str(DBres.sig, strict.width = "cut")
###################################################
###time Course analysis
###################################################
# values are logFC of all time points compared to the initial time point
#filter = TRUE: , the time course table will filter out all genomic regions with no significant changes between any two time points.
tca <- timecourseTable(tca, value = "FC", norm.method = "rpkm", filter = TRUE)
# values are normalized read counts
tca <- timecourseTable(tca, value = "expression", norm.method = "rpkm", filter = TRUE)
t <- tcTable(tca)
head(t)
###################################################
### cluster analysis
###################################################
tca <- timeclust(tca, algo = "cm", k = 6, standardize = TRUE)
p <- timeclustplot(tca, value = "z-score(PRKM)", cols = 3)
#plot cluster 1:
## print(p[[1]])
###################################################
### extract interested clusters
###################################################
a <- as.data.frame(tca@clusterRes@cluster) # interger with names transform to df
names(a) <- 'Cluster'
## 查看各个聚类中的基因数目
table(a)
##筛选
Cluster1 <- subset(a,Cluster == 2)
TCseq_time_course_DEGs_clusters
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- La manipulation de beau de course sur la piste au - delà ...
- 该系列仅在原课程基础上部分知识点添加个人学习笔记,或相关推导补充等。如有错误,还请批评指教。在学习了 Andrew...
- Miss美语发音上期翻译 On my end, everything is done. 我这边事情都完成了。 预计...
- 哲学即对智慧的 爱慕。 1.哲学是什么? 哲学是起源于古希腊的一种认识世界的方法论。其特点是思辨,不像宗教:毋庸置...
- course_set 叫课程,就是后台点击创建课程的时候创建的 course 叫计划,就是课程管理里面有个创建计划...