annotate minfi_pipeline.R @ 0:8b26eeb2da29 draft

planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
author nturaga
date Tue, 19 Apr 2016 11:11:16 -0400
parents
children 3cd8ea4f7079
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
1 # setup R error handling to go to stderr
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
2 options(show.error.messages=F, error=function(){cat(geterrmessage(),file=stderr());q("no",1,F)})
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
3
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
4 # we need that to not crash galaxy with an UTF8 error on German LC settings.
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
5 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
6
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
7 library("getopt")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
8 options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
9 args <- commandArgs(trailingOnly = TRUE)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
10
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
11 # get options, using the spec as defined by the enclosed list.
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
12 # we read the options from the default: commandArgs(TRUE).
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
13 spec <- matrix(c(
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
14 'quiet', 'q', 2, "logical",
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
15 'help' , 'h', 0, "logical",
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
16 "preprocess","p",1,"character",
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
17 "cores","c",1,"integer",
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
18 "numPositions","n",2,"integer",
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
19 "shrinkVar","s",2,"logical",
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
20 "b_permutations","b",2,"integer",
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
21 "smooth","m",2,"logical",
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
22 "cutoff","t",2,"double",
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
23 "l_value","l",2,"integer")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
24 ,byrow=TRUE, ncol=4)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
25 opt <- getopt(spec)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
26
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
27 # If help was asked for print a friendly message
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
28 # and exit with a non-zero error code
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
29 if (!is.null(opt$help)) {
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
30 cat(getopt(spec, usage=TRUE))
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
31 q(status=1)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
32 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
33
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
34
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
35 ## Set verbose mode
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
36 verbose = if(is.null(opt$quiet)){TRUE}else{FALSE}
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
37 if(verbose){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
38 cat("Verbose mode is ON\n\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
39 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
40
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
41 # Enforce the following required arguments
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
42 if (is.null(opt$preprocess)) {
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
43 cat("'--preprocess' is required\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
44 q(status=1)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
45 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
46 cat("verbose = ", opt$quiet,"\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
47 cat("preprocess = ",opt$preprocess,"\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
48 cat("cores = ", opt$cores, "\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
49 cat("b_permutations = ",opt$b_permutations,"\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
50 cat("smooth = ",opt$smooth,"\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
51 cat("cutoff = ",opt$cutoff,"\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
52 cat("l_value = ",opt$l_value,"\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
53 cat("numPositions = ",opt$numPositions,"\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
54 cat("shrinkVar = ",opt$shrinkVar,"\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
55
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
56
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
57 # Load required libraries
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
58 suppressPackageStartupMessages({
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
59 library("minfi")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
60 library("FlowSorted.Blood.450k")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
61 library("TxDb.Hsapiens.UCSC.hg19.knownGene")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
62 library("doParallel")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
63 })
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
64
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
65
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
66 ## Parse cheetah code and make dataframe for creating tmp dir
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
67 minfi_config_file = paste0("minfi_temp","/minfi_config.txt")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
68 minfi_config = read.table(minfi_config_file)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
69 colnames(minfi_config) = c("status","green","red","name")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
70
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
71
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
72 ## Make the tmpdir for symlinking data
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
73 base_dir = paste0("minfi_temp","/base")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
74 system(paste0("mkdir ",base_dir))
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
75
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
76
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
77 ## Make symlinks of files
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
78 for (i in 1:nrow(minfi_config)){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
79 stopifnot(nrow(minfi_config) == nrow(minfi_config["name"]))
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
80
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
81 ## Make green idat file symlinks
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
82 file_green = paste0(base_dir,"/",as.character(minfi_config[i,"name"]),"_Grn.idat")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
83 cmd_green = paste("ln -s",as.character(minfi_config[i,"green"]),file_green,sep=" ")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
84 cat("Reading file ",i,"GREEN Channel ", file_green)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
85 system(cmd_green)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
86
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
87 ## Make red idat file symlinks
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
88 file_red = paste0(base_dir,"/",as.character(minfi_config[i,"name"]),"_Red.idat")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
89 cmd_red = paste("ln -s",as.character(minfi_config[i,"red"]),file_red,sep=" ")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
90 cat("Reading file ",i,"RED Channel ", file_red)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
91 system(cmd_red)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
92 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
93
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
94 ## Make dataframe with Basenames
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
95 Basename = paste0(base_dir,"/",unique(substr(list.files(base_dir),1,17)))
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
96 status = minfi_config[match(gsub(".+/","",Basename), minfi_config$name),"status"]
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
97 targets = data.frame(Basename=Basename,status=status)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
98
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
99 if ( verbose ) {
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
100 cat("Minfi targets file:\n\n ")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
101 print(targets)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
102 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
103
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
104 ## Read 450k files
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
105 RGset = read.450k.exp(targets=targets,verbose=T)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
106
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
107 if (verbose){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
108 cat("RGset has been read: \n\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
109 print(RGset)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
110 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
111
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
112 pd = pData(RGset)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
113
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
114 ## NOTE: QC report is for samples before normalization
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
115 ## QC REPORT
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
116 files = gsub(".+/","",pd$filenames)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
117 ## Produce PDF file
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
118 if (!is.null(RGset)) {
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
119 # Make PDF of QC report
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
120 minfi::qcReport(rgSet=RGset,sampNames=files,sampGroups=pd$status,pdf="qc_report.pdf")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
121 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
122
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
123
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
124 ## MDS Plot
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
125 ## Set phenotype data
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
126 files = gsub(".+/","",pd$filenames)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
127 #numPositions=as.integer("${numPositions}")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
128
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
129 ## Produce PDF file
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
130 if (!is.null(RGset)) {
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
131 ## Make PDF of MDS plot
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
132 pdf("mds_plot.pdf")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
133 minfi::mdsPlot(dat=RGset,sampNames=files,sampGroups=pd$status,main="Beta MDS",numPositions = opt$numPositions,pch=19)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
134 dev.off()
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
135 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
136
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
137 if(verbose){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
138 cat("Made plot of QC report and MDS plot\n\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
139 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
140
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
141
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
142 ## Preprocess data with the normalization method chosen
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
143 if(opt$preprocess == "quantile"){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
144 normalized_RGset = preprocessQuantile(RGset)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
145 if (verbose){cat("Preprocessed using Quantile normalization")};
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
146 } else if (opt$preprocess == "funnorm"){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
147 normalized_RGset = preprocessFunnorm(RGset)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
148 if(verbose){print("Preprocessed using Functional normalization")}
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
149 } else if (opt$preprocess == "noob"){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
150 normalized_RGset = preprocessNoob(RGset)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
151 if (verbose){cat("Preprocessed using Noob normalization")};
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
152 } else if (opt$preprocess == "illumina"){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
153 normalized_RGset = preprocessIllumina(RGset,bg.correct = TRUE, normalize = c("controls", "no"),reference = 1)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
154 if(verbose){print("Preprocessed using Illumina normalization")}
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
155 } else if (opt$preprocess == "swan"){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
156 normalized_RGset = preprocessSWAN(RGset)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
157 if(verbose){print("Preprocessed using SWAN normalization")}
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
158 }else {
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
159 normalized_RGset = RGset
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
160 if(verbose){print("Preprocessed using No normalization")}
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
161 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
162
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
163
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
164
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
165 ## Get beta values from Proprocessed data
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
166 beta = getBeta(normalized_RGset)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
167 ## Set phenotype data
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
168 pd = pData(normalized_RGset)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
169
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
170
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
171 ## DMP finder
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
172 dmp = dmpFinder(dat=beta,pheno=pd$status,type="categorical",shrinkVar=opt$shrinkVar)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
173 write.csv(dmp,file="dmps.csv",quote=FALSE,row.names=TRUE)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
174 if(verbose){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
175 cat("\n","DMP Finder successful \n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
176 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
177
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
178
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
179 # Model Matrix to pass into the bumphunter function
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
180 T1= levels(pd$status)[2]
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
181 T2= levels(pd$status)[1]
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
182
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
183 # Introduce error if levels are different
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
184 stopifnot(T1!=T2)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
185
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
186 keep=pd$status%in%c(T1,T2)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
187 tt=factor(pd$status[keep],c(T1,T2))
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
188 design=model.matrix(~tt)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
189
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
190 if(verbose){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
191 cat("Model matrix is: \n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
192 design
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
193 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
194
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
195 # Start bumphunter in a parallel environment
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
196 # Parallelize over cores on machine
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
197 registerDoParallel(cores = opt$cores)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
198
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
199 ## Bumphunter Run with normalized_RGset processed with Quantile Normalization
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
200 if (is(normalized_RGset,"GenomicRatioSet")) {
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
201 res=bumphunter(normalized_RGset[,keep],design,B=opt$b_permutations,smooth=opt$smooth,cutoff= opt$cutoff,type="Beta")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
202 bumps= res$tab
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
203 } else if(is(normalized_RGset,"MethylSet")) {
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
204 # convert MethylSet (norm.swan) into GenomicRatioSet through Ratioset
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
205 normalized_RGset = ratioConvert(normalized_RGset, what = "both", keepCN = TRUE)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
206 normalized_RGset = mapToGenome(normalized_RGset)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
207 res = bumphunter(normalized_RGset[,keep],design=design,B=opt$b_permutations,smooth=opt$smooth,cutoff=opt$cutoff)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
208 bumps = res$tab
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
209 } else {
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
210 # This else case is never supposed to run,
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
211 # it will run only if the normalized_RGset object
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
212 # did not have the expected class type
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
213 cat("Bumphunter did not run properly","\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
214 stopifnot(!is.null(bumps))
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
215 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
216
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
217 if(verbose){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
218 cat("Bumphunter result", "\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
219 head(bumps)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
220 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
221
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
222
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
223 ## Choose DMR's of a certain length threshold.
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
224 ## This helps reduce the size of DMRs early, and match
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
225 ## with genes closest to region
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
226 bumps = bumps[bumps$L > opt$l_value,]
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
227 genes <- annotateTranscripts(TxDb.Hsapiens.UCSC.hg19.knownGene)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
228 tab=matchGenes(bumps,genes)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
229 annotated_dmrs=cbind(bumps,tab)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
230
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
231 if(verbose){
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
232 cat("Match with annotation\n")
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
233 head(annotated_dmrs)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
234 }
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
235
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
236 # Save result, which contains DMR's and closest genes
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
237 write.csv(annotated_dmrs,file = "dmrs.csv",quote=FALSE,row.names=FALSE)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
238
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
239 # Garbage collect
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
240 gc()
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
241
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
242
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
243 ## TODO: FIX BLOCK FINDER
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
244 # Block finder
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
245 #library(sva)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
246 #pheno <- pData(GRset)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
247 #mod <- model.matrix(~as.factor(status), data=pheno)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
248 #mod0 <- model.matrix(~1, data=pheno)
8b26eeb2da29 planemo upload commit fb90aafc93e5e63acfcdac4c27cfd865cdf06c5a-dirty
nturaga
parents:
diff changeset
249 #sva.results <- sva(mval, mod, mod0)