基本打通RAIN+Mfuzz的流程

#导入数据-------------------------------------------------------------------------------------------
rm(list=ls())
setwd("")#getwd()
data <-read.csv("GSE201207_count_216.csv.gz")
kidney <- data[,c(1,26:37)]
#整理数据-----------------------------------------------------------------------------------------------------
library("biomaRt")
mart <- useMart("ENSEMBL_MART_ENSEMBL", dataset="mmusculus_gene_ensembl")
gene_symbols <- getBM(attributes=c("external_gene_name"),
                      filters="external_gene_name", 
                      values=kidney$X, 
                      mart=mart)
kidney <- merge(gene_symbols,kidney,by.x=1, by.y=1)
library(dplyr)
kidney <- na.omit(distinct(kidney, external_gene_name, .keep_all = T))
rownames(kidney) <- kidney$external_gene_name
kidney <- kidney[,-1]
write.table(kidney, file = "output.csv", sep = ",")
#绘制单一基因表达量的时间变化曲线----------------------------------------------------------
require('lattice')
#Pcnt <- kidney["Pcnt",(0:5 * 2 + rep(c(1, 2), each = 6))]
Pcnt <- kidney["Pcnt",]
xyplot(Pcnt~rep(0:11 * 4 + 2, each = 1), type = 'b', pch = 16, 
       xlab = 'time', ylab = 'expression value')
#rhythm analysis: RAIN--------------------------------------------------------------------- 
kidney.rain <- kidney[,c(1,7,2,8,3,9,4,10,5,11,6,12)]
library(rain)
results <- rain(t(kidney.rain),period = 24, deltat = 4, nr.series = 2,
                peak.border = c(0.3,0.7), verbose = FALSE)
best <- order(results$pVal)[1:10]
xyplot(as.matrix(kidney
                 [best, ])
       ~rep(0:11 * 4 + 2, each = 10) |rownames(kidney)[best],
       scales = list(y = list(relation = 'free')),
       layout = c(2, 5), type = 'b', pch = 16, xlab = 'time',
       ylab = 'expression value', cex.lab = 1)
select <- order(results$pVal)[1:50]
kidney.Mfuzz <- kidney[select, ]
#trend analysis: Mfuzz---------------------------------------------------------------------
require(Biobase)
bio.kidney.Mfuzz <- ExpressionSet(as.matrix(kidney.Mfuzz))
require("Mfuzz")
bio.kidney.Mfuzz <- standardise(
  filter.std(
     fill.NA(
      filter.NA(bio.kidney.Mfuzz, thres = 0.25), 
      mode = "mean"), 
      min.std = 0)
  )
m1 <- mestimate(bio.kidney.Mfuzz)
c1 <- mfuzz(bio.kidney.Mfuzz, c=3, m=m1)
mfuzz.plot(bio.kidney.Mfuzz, cl=c1, 
           mfrow = c(2,2),time.labels = seq(0,44,4))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值