Advanced Interdisciplinary Projects Lab(AIPLab) 討論區

Please login or register.

請輸入帳號, 密碼以及預計登入時間

新聞:

[開學]106學年第1學期的課程看版開張了 歡迎同學問問題-20170917

作者 主題: [資訊]0405課程  (閱讀 180 次)

admin

  • 管理員
  • Hero Member
  • *****
  • 文章: 1715
    • 檢視個人資料
[資訊]0405課程
« 於: 四月 05, 2017, 05:39:55 am »
程式碼: [Select]
basedir <- "E:/GeneExpression/SRP073050-Monocytes-counts"
setwd(basedir)
sample = c("S080","S081","S082","S083","S084","S085")
for (i in 1:length(sample) ) {
    filename <- paste(sample[i], '.counts', sep = "", collapse = "")
    exp_table <-read.table(filename, header = F, stringsAsFactors = FALSE)
    if (i==1){#read only once
        df<-read.table(filename, header = F, stringsAsFactors = FALSE)
        names(df) <- c("Gene", sample[i])
    }
    else{
        df2<-read.table(filename, header = F, stringsAsFactors = FALSE)
        df[sample[i]] <-df2[2]
    }
}
 write.csv(df, file = "SRP073050.csv")
 
程式碼: [Select]
library(DESeq2)
files = c("S080.counts","S081.counts","S082.counts","S083.counts","S084.counts","S085.counts")
cond = c("A","A","A","B","A","A")
sTable = data.frame(sampleName = files, fileName = files, condition = cond)
dds <-DESeqDataSetFromHTSeqCount(sampleTable=sTable, directory = "E:/GeneExpression/SRP073050-Monocytes-counts", design = ~condition)
dds <- DESeq(dds)
res <- results(dds)
summary(res)
write.csv(as.data.frame(res),file="SRP073050-FCGR3B.csv")

程式碼: [Select]
plotMA(res, main="DESeq2", ylim=c(-2,2))
« 最後編輯時間: 四月 05, 2017, 07:55:13 pm 由 admin »
已記錄

admin

  • 管理員
  • Hero Member
  • *****
  • 文章: 1715
    • 檢視個人資料
已記錄

admin

  • 管理員
  • Hero Member
  • *****
  • 文章: 1715
    • 檢視個人資料
已記錄
 

SimplePortal Classic 2.0.5