annotate pipe-t.R @ 9:69f5c4d6e6bd draft

planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
author davidecangelosi
date Fri, 10 May 2019 10:49:09 -0400
parents e5953805ad7a
children bc5697f41720
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
1
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
2 cat("\n Started! \n")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
3 #sessionInfo()
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
4
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
5
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
6 # Send R errors to stderr
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
7 options(show.error.messages = F, error = function(){cat(geterrmessage(), file = stderr()); q("no", 1, F)})
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
8
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
9 # Avoid crashing Galaxy with an UTF8 error on German LC settings
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
10 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
11 suppressPackageStartupMessages({
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
12 library(HTqPCR)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
13 library(base)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
14 library(Biobase)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
15 library(utils)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
16 library(stats)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
17 library(graphics)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
18 library(grDevices)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
19 library(RColorBrewer)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
20 library(limma)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
21 library(RankProd)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
22 library(methods)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
23 library(impute)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
24 library(BBmisc)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
25 library(affy)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
26 library(psych)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
27 #library(gmp)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
28 library(zoo)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
29 library(nondetects)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
30 library(Hmisc)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
31 #library(missForest)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
32 #library(mice)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
33 })
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
34
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
35 cat("\n R libraries...loaded!\n")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
36
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
37 args = commandArgs(trailingOnly=TRUE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
38 dpfiles<-basename(args[1])
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
39 path000<-dirname(args[1])
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
40 format<-args[2]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
41 nfeatures<-args[3]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
42 rawout<-args[4]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
43 path <- args[5]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
44 dcCtmin<-args[6]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
45 dcCtmax<-args[7]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
46 dcflag<-args[8]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
47 x<-args[9]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
48 normalizationMethod<-args[10]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
49 if (normalizationMethod=="deltaCt") {
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
50 submethod<-args[11]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
51 switch(submethod,
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
52 "userdefined"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
53 normalizers<-args[12]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
54 outputNorm<-args[13]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
55 outputECDF<-args[14]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
56 percentofnastoremove<-args[15]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
57 outputRemaining<-args[16]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
58 imputeMethod<-args[17]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
59 if (imputeMethod=="knn") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
60 kappa<- args[18]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
61 macsp<-args[19]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
62 outputIMP<-args[20]
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
63
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
64 DEAMethod<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
65 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
66 alternative<- args[22]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
67 paired<-args[23]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
68 replicates<- args[24]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
69 sort<-args[25]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
70 stringent<- args[26]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
71 padjust<-args[27]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
72 outputDEA<-args[28]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
73 filtnames<-args[29]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
74 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
75 outputDEA<-args[22]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
76 filtnames<-args[23]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
77 }
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
78 } else {
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
79 #mean, median, nondetects, cubic
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
80 outputIMP<-args[18]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
81 DEAMethod<-args[19]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
82 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
83 alternative<- args[20]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
84 paired<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
85 replicates<- args[22]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
86 sort<-args[23]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
87 stringent<- args[24]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
88 padjust<-args[25]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
89 outputDEA<-args[26]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
90 filtnames<-args[27]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
91 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
92 outputDEA<-args[20]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
93 filtnames<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
94 }
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
95 }
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
96 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
97 "genorm"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
98 user_number<-as.numeric(args[12])
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
99 outputNorm<-args[13]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
100 outputECDF<-args[14]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
101 percentofnastoremove<-args[15]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
102 outputRemaining<-args[16]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
103 imputeMethod<-args[17]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
104 if (imputeMethod=="knn") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
105 kappa<- args[18]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
106 macsp<-args[19]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
107 outputIMP<-args[20]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
108
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
109 DEAMethod<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
110 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
111 alternative<- args[22]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
112 paired<-args[23]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
113 replicates<- args[24]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
114 sort<-args[25]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
115 stringent<- args[26]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
116 padjust<-args[27]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
117 outputDEA<-args[28]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
118 filtnames<-args[29]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
119 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
120 outputDEA<-args[22]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
121 filtnames<-args[23]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
122 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
123 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
124 #mean, median, nondetects, cubic
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
125 outputIMP<-args[18]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
126 DEAMethod<-args[19]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
127 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
128 alternative<- args[20]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
129 paired<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
130 replicates<- args[22]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
131 sort<-args[23]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
132 stringent<- args[24]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
133 padjust<-args[25]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
134 outputDEA<-args[26]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
135 filtnames<-args[27]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
136 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
137 outputDEA<-args[20]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
138 filtnames<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
139 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
140 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
141
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
142 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
143 "normfinder"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
144 user_number<-as.numeric(args[12])
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
145 outputNorm<-args[13]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
146 outputECDF<-args[14]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
147 percentofnastoremove<-args[15]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
148 outputRemaining<-args[16]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
149 imputeMethod<-args[17]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
150 if (imputeMethod=="knn") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
151 kappa<- args[18]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
152 macsp<-args[19]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
153 outputIMP<-args[20]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
154
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
155 DEAMethod<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
156 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
157 alternative<- args[22]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
158 paired<-args[23]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
159 replicates<- args[24]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
160 sort<-args[25]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
161 stringent<- args[26]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
162 padjust<-args[27]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
163 outputDEA<-args[28]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
164 filtnames<-args[29]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
165 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
166 outputDEA<-args[22]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
167 filtnames<-args[23]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
168 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
169 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
170 #mean, median, nondetects, cubic
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
171 outputIMP<-args[18]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
172 DEAMethod<-args[19]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
173 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
174 alternative<- args[20]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
175 paired<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
176 replicates<- args[22]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
177 sort<-args[23]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
178 stringent<- args[24]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
179 padjust<-args[25]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
180 outputDEA<-args[26]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
181 filtnames<-args[27]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
182 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
183 outputDEA<-args[20]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
184 filtnames<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
185 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
186 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
187
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
188 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
189 stop("Enter something that switches me!")
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
190 )
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
191 }else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
192 outputNorm<-args[11]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
193 outputECDF<-args[12]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
194 percentofnastoremove<-args[13]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
195 outputRemaining<-args[14]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
196 imputeMethod<-args[15]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
197
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
198 if (imputeMethod=="knn") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
199 kappa<- args[16]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
200 macsp<-args[17]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
201 outputIMP<-args[18]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
202
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
203 DEAMethod<-args[19]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
204
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
205 if (DEAMethod=="ttest") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
206 alternative<- args[20]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
207 paired<-args[21]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
208 replicates<- args[22]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
209 sort<-args[23]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
210 stringent<- args[24]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
211 padjust<-args[25]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
212 outputDEA<-args[26]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
213 filtnames<-args[27]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
214 } else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
215 outputDEA<-args[20]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
216 filtnames<-args[21]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
217 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
218 } else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
219 #mean, median, nondetects, cubic
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
220 outputIMP<-args[16]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
221 DEAMethod<-args[17]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
222 if (DEAMethod=="ttest") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
223 alternative<- args[18]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
224 paired<-args[19]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
225 replicates<- args[20]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
226 sort<-args[21]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
227 stringent<- args[22]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
228 padjust<-args[23]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
229 outputDEA<-args[24]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
230 filtnames<-args[25]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
231
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
232 } else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
233 outputDEA<-args[18]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
234 filtnames<-args[19]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
235
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
236 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
237 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
238 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
239 cat("\n Initialization completed! \n")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
240
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
241 .readCtEDS <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
242 function(readfile=readfile, n.data=n.data, i=i, nspots=nspots, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
243 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
244 # Scan through beginning of file, max 100 lines
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
245 file.header <- readLines(con=readfile, n=100)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
246 n.header <- grep("^Well", file.header)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
247 if (length(n.header)==0)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
248 n.header <- 0
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
249 # Read data, skip the required lines
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
250 out <- read.delim(file=readfile, header=TRUE, colClasses="character", nrows=nspots*n.data[i], skip=n.header-1, strip.white=TRUE, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
251 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
252 } # .readCtEDS
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
253
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
254
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
255 .readCtPlain <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
256 function(readfile=readfile, header=header, n.features=n.features, n.data=n.data, i=i, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
257 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
258 # A check for file dimensions. Read a single file.
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
259 sample <- read.delim(file=readfile, header=header, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
260 nspots <- nrow(sample)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
261 if (nspots != n.features*n.data[1])
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
262 warning(paste(n.features, "gene names (rows) expected, got", nspots))
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
263 # Read in the required file
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
264 out <- read.delim(file=readfile, header=header, colClasses="character", nrows=nspots*n.data[i], ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
265 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
266 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
267 } # .readCtPlain
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
268
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
269 .readCtSDS <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
270 function(readfile=readfile, n.data=n.data, i=i, nspots=nspots, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
271 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
272 # Scan through beginning of file, max 100 lines
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
273 file.header <- readLines(con=readfile, n=100)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
274 n.header <- grep("^#", file.header)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
275 if (length(n.header)==0)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
276 n.header <- 0
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
277 # Read data, skip the required lines
7
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
278 out <- read.delim(file=readfile, header=FALSE, colClasses="character", nrows=nspots*n.data[i], skip=n.header, strip.white=TRUE, ...)
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
279 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
280 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
281 } # .readCtSDS
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
282
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
283 .readCtLightCycler <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
284 function(readfile=readfile, n.data=n.data, i=i, nspots=nspots, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
285 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
286 # Read data, skip the required lines
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
287 out <- read.delim(file=readfile, header=TRUE, as.is=TRUE, nrows=nspots*n.data[i], skip=1, strip.white=TRUE, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
288 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
289 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
290 } # .readCtLightCycler
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
291
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
292 .readCtCFX <- function(readfile=readfile, n.data=n.data, i=i, nspots=nspots, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
293 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
294 # Read data, skip the required lines
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
295 out <- read.csv(file=readfile, header=TRUE, as.is=TRUE, nrows=nspots*n.data[i], strip.white=TRUE, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
296 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
297 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
298 } # .readCtCFX
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
299
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
300 .readCtOpenArray <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
301 function(readfile=readfile, n.data=n.data, i=i, nspots=nspots, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
302 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
303 # Read data
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
304 out <- read.csv(file=readfile, header=TRUE, as.is=TRUE, nrows=nspots*n.data[i], strip.white=TRUE, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
305 # Regard those marked as outliers as "Unreliable"
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
306 out$ThroughHole.Outlier[out$ThroughHole.Outlier=="False"] <- "OK"
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
307 out$ThroughHole.Outlier[out$ThroughHole.Outlier=="True"] <- "Unreliable"
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
308 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
309 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
310 } # .readCtOpenArray
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
311
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
312 .readCtBioMark <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
313 function(readfile=readfile, n.data=n.data, i=i, nspots=nspots, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
314 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
315 # Scan through beginning of file, max 100 lines
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
316 file.header <- readLines(con=readfile, n=100)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
317 n.header <- grep("^ID", file.header)-1
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
318 if (length(n.header)==0)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
319 n.header <- 0
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
320 # Read data, skip the required lines
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
321 out <- read.csv(file=readfile, header=TRUE, as.is=TRUE, nrows=nspots*n.data[i], skip=n.header, strip.white=TRUE, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
322 # Convert the calls into flags
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
323 out$Call[out$Call=="Pass"] <- "OK"
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
324 out$Call[out$Call=="Fail"] <- "Undetermined"
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
325 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
326 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
327 } # .readCtBioMark
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
328
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
329
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
330
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
331 readCtDataDav<-
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
332 function (files, path = NULL, n.features = 384, format = "plain",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
333 column.info, flag, feature, type, position, Ct, header = FALSE,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
334 SDS = FALSE, n.data = 1, samples, na.value = 40, sample.info,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
335 ...)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
336 {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
337 if (missing(files))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
338 stop("No input files specified")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
339 if (length(files) != length(n.data) & length(n.data) != 1)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
340 stop("n.data must either be a single integer, or same length as number of files")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
341 if (length(n.data) == 1)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
342 n.data <- rep(n.data, length(files))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
343 nsamples <- sum(n.data)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
344 ncum <- cumsum(n.data)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
345 s.names <- NULL
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
346 nspots <- n.features
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
347 if (SDS) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
348 warning("Please use format='SDS'. The SDS' parameter is retained for backward compatibility only.")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
349 format <- "SDS"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
350 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
351 if (!missing(flag) | !missing(feature) | !missing(type) |
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
352 !missing(position) | !missing(Ct)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
353 warning("Please use 'column.info' for providing a list of column numbers containing particular information. The use of 'flag', 'feature', 'type', 'position' and 'Ct' is deprecated and will be removed in future versions.")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
354 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
355 if (missing(column.info)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
356 column.info <- switch(format, EDS = list(flag="EXPFAIL", feature="Target.Name", position="Well.Position", Ct="CT"),
4
e248cd7769e8 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit fe7763760d58ae2b51441b67162bb5f86cffa91e
davidecangelosi
parents: 3
diff changeset
357 plain = list(flag = 4, feature = 6, type = 7, position = 3, Ct = 8),
7
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
358 SDS = list(flag = 4,feature = 6, type = 7, position = 3, Ct = 8),
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
359 #SDS = list(flag = "Omit",feature = "Detector", type = "Task", position = "Pos", Ct = "Avg.Ct"),
4
e248cd7769e8 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit fe7763760d58ae2b51441b67162bb5f86cffa91e
davidecangelosi
parents: 3
diff changeset
360 LightCycler = list(feature = "Name",
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
361 position = "Pos", Ct = "Cp"), CFX = list(feature = "Content",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
362 position = "Well", Ct = "Cq.Mean"), OpenArray = list(flag = "ThroughHole.Outlier",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
363 feature = "Assay.Assay.ID", type = "Assay.Assay.Type",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
364 position = "ThroughHole.Address", Ct = "ThroughHole.Ct"),
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
365 BioMark = list(flag = "Call", feature = "Name.1",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
366 position = "ID", Ct = "Value"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
367 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
368 X <- matrix(0, nspots, nsamples)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
369 X.flags <- as.data.frame(X)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
370 X.cat <- data.frame(matrix("OK", ncol = nsamples, nrow = nspots),
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
371 stringsAsFactors = FALSE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
372 for (i in seq_along(files)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
373 if (i == 1) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
374 cols <- 1:ncum[i]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
375 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
376 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
377 cols <- (ncum[i - 1] + 1):ncum[i]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
378 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
379 readfile <- ifelse(is.null(path), files[i], file.path(path,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
380 files[i]))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
381 sample <- switch(format, EDS =.readCtEDS(readfile = readfile,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
382 n.data = n.data, i = i, nspots = nspots, ...), plain = .readCtPlain(readfile = readfile,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
383 header = header, n.features = n.features, n.data = n.data,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
384 i = i, ...), SDS = .readCtSDS(readfile = readfile,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
385 n.data = n.data, i = i, nspots = nspots, ...), LightCycler = .readCtLightCycler(readfile = readfile,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
386 n.data = n.data, i = i, nspots = nspots, ...), CFX = .readCtCFX(readfile = readfile,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
387 n.data = n.data, i = i, nspots = nspots, ...), OpenArray = .readCtOpenArray(readfile = readfile,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
388 n.data = n.data, i = i, nspots = nspots, ...), BioMark = .readCtBioMark(readfile = readfile,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
389 n.data = n.data, i = i, nspots = nspots, ...))
7
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
390 #if (format == "SDS") {
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
391 # if("Avg Ct" %in% colnames(n.data)){
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
392 # data <- matrix(sample[, column.info[["Avg.Ct"]]], ncol = n.data[i])
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
393 # } elseif {
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
394 # cat("\n Unsupported SDS format! ")
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
395 # }
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
396 #}else{
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
397 data <- matrix(sample[, column.info[["Ct"]]], ncol = n.data[i])
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
398 # }
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
399 undeter <- apply(data, 2, function(x) x %in% c("Undetermined",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
400 "No Ct"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
401 X.cat[, cols][undeter] <- "Undetermined"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
402 nas <- c("Undetermined", "No Ct", "999", "N/A")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
403 if (is.null(na.value)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
404 data[data %in% nas | data == 0] <- NA
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
405 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
406 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
407 data[data %in% nas | is.na(data) | data == 0] <- na.value
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
408 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
409 X[, cols] <- apply(data, 2, function(x) as.numeric(as.character(x)))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
410 if ("flag" %in% names(column.info)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
411 flags <- matrix(sample[, column.info[["flag"]]],
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
412 ncol = n.data[i])
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
413 flags[flags == "-"] <- "Failed"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
414 flags[flags == "+"] <- "Passed"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
415 X.flags[, cols] <- flags
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
416 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
417 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
418 X.flags[, cols] <- "Passed"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
419 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
420 if (format == "OpenArray") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
421 s.names <- c(s.names, unique(sample$SampleInfo.SampleID))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
422 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
423 else if (format %in% c("EDS","plain", "SDS")) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
424 s.names <- c(s.names, unique(sample[, 2]))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
425 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
426 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
427 s.names <- s.names
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
428 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
429 if (i == 1) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
430 featPos <- paste("feature", 1:nspots, sep = "")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
431 if ("position" %in% names(column.info))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
432 featPos <- as.character(sample[1:nspots, column.info[["position"]]])
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
433 featType <- factor(rep("Target", nspots))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
434 if ("type" %in% names(column.info))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
435 featType <- sample[1:nspots, column.info[["type"]]]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
436 featName <- paste("feature", 1:nspots, sep = "")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
437 if ("feature" %in% names(column.info))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
438 featName <- as.character(sample[1:nspots, column.info[["feature"]]])
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
439 df <- data.frame(featureNames = featName, featureType = as.factor(featType),
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
440 featurePos = featPos)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
441 metaData <- data.frame(labelDescription = c("Name of the qPCR feature (gene)",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
442 "Type pf feature", "Position on assay"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
443 featData <- AnnotatedDataFrame(data = df, varMetadata = metaData)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
444 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
445 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
446 if (!missing(samples)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
447 if (length(samples) < nsamples) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
448 warning("Not enough sample names provided; using Sample1, Sample2, ... instead\n")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
449 samples <- paste("Sample", 1:nsamples, sep = "")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
450 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
451 else if (length(samples) == nsamples) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
452 samples <- samples
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
453 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
454 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
455 else if (missing(samples)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
456 if (length(files) == nsamples) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
457 samples <- gsub("(.+)\\..+", "\\1", files)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
458 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
459 else if (length(s.names) == nsamples) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
460 samples <- s.names
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
461 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
462 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
463 samples <- paste("Sample", 1:nsamples, sep = "")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
464 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
465 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
466 samples <- make.unique(samples)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
467 if (any(is.na(X)))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
468 warning("One or more samples contain NAs. Consider replacing these with e.g. Ct=40 now.")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
469 if (missing(sample.info)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
470 pdata <- data.frame(sample = 1:length(samples), row.names = samples)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
471 sample.info <- new("AnnotatedDataFrame", data = pdata,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
472 varMetadata = data.frame(labelDescription = "Sample numbering",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
473 row.names = "Sample names"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
474 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
475 X.hist <- data.frame(history = capture.output(match.call(readCtData)),
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
476 stringsAsFactors = FALSE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
477 out <- new("qPCRset", exprs = X, phenoData = sample.info,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
478 featureData = featData, featureCategory = X.cat, flag = X.flags,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
479 CtHistory = X.hist)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
480 out
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
481 }
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
482
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
483
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
484 head(read.delim(file.path(path000, dpfiles), sep="\t"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
485 files <- read.delim(file.path(path000, dpfiles), sep="\t")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
486 switch(format,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
487 "EDS"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
488 columns<- list(flag="EXPFAIL", feature="Target.Name", position="Well.Position", Ct="CT")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
489 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
490 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
491 rownames(phenoData)=as.vector(files$sampleName)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
492 raw<- readCtDataDav(files = as.vector(files$sampleName), header=TRUE, format="EDS", column.info=columns, path = path,sample.info=phenoData,n.features = as.numeric(nfeatures))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
493 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
494 "plain"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
495 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
496 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
497 rownames(phenoData)=as.vector(files$sampleName)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
498 raw<- readCtDataDav(files = as.vector(files$sampleName), header=FALSE, format="plain", path = path, sample.info=phenoData,n.features = as.numeric(nfeatures))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
499 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
500 "SDS"={
8
e5953805ad7a planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7d54176ff26ed5f4411edb0582a3704dd90253c0
davidecangelosi
parents: 7
diff changeset
501 columns<- list(feature=3, Ct=6, flag=11)
e5953805ad7a planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7d54176ff26ed5f4411edb0582a3704dd90253c0
davidecangelosi
parents: 7
diff changeset
502 #columns <-list(flag = "Omit",feature = "Detector", type = "Task", position = "Wells", Ct = "Avg.Ct")
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
503 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
504 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
505 rownames(phenoData)=as.vector(files$sampleName)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
506 raw<- readCtDataDav(files = files$sampleName, format="SDS",column.info=columns, path = path, sample.info=phenoData, n.features=as.numeric(nfeatures))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
507 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
508 "LightCycler"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
509 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
510 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
511 rownames(phenoData)=as.vector(files$sampleName)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
512 raw <- readCtDataDav(files = files$sampleName, path = path, format = "LightCycler", sample.info=phenoData,n.features = as.numeric(nfeatures))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
513 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
514 "CFX"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
515 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
516 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
517 rownames(phenoData)=as.vector(files$sampleName)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
518 raw <- readCtDataDav(files = files$sampleName, path = path, format = "CFX", sample.info=phenoData,n.features = as.numeric(nfeatures))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
519 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
520 "OpenArray"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
521 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
522 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
523 rownames(phenoData)=as.vector(files$sampleName)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
524 raw <- readCtDataDav(files = files$sampleName, path = path, format = "OpenArray", sample.info=phenoData,n.features = as.numeric(nfeatures))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
525 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
526 "BioMark"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
527 metadata <- data.frame(labelDescription = c("sampleName", "Treatment"), row.names = c("sampleName", "Treatment"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
528 phenoData <- new("AnnotatedDataFrame", data = files, varMetadata = metadata)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
529 rownames(phenoData)=as.vector(files$sampleName)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
530 raw <- readCtDataDav(files = files$sampleName, path = path, format = "BioMark", sample.info=phenoData, n.features = as.numeric(nfeatures))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
531 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
532 stop("Enter something that switches me!")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
533 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
534 cat("\n Files read correctly! ")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
535
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
536 write.table(exprs(raw), file=rawout, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
537 ####################################################################################################################
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
538 #Set a new categories for the values meeting two criterions
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
539 switch(format,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
540 "EDS"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
541 unreliable<-setCategory(raw, Ct.max=dcCtmax, Ct.min=dcCtmin,replicates=FALSE, flag=dcflag, flag.out="Y", quantile=NULL)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
542 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
543 "plain"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
544 unreliable<-setCategory(raw, Ct.max=dcCtmax, Ct.min=dcCtmin,replicates=FALSE, flag=dcflag, flag.out="Flagged", quantile=NULL)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
545 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
546 "SDS"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
547 unreliable<-setCategory(raw, Ct.max=dcCtmax, Ct.min=dcCtmin,replicates=FALSE, flag=dcflag, flag.out="TRUE", quantile=NULL)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
548 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
549 "LightCycler"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
550 unreliable<-setCategory(raw, Ct.max=dcCtmax, Ct.min=dcCtmin,replicates=FALSE, flag=dcflag, flag.out="Y", quantile=NULL)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
551 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
552 "CFX"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
553 unreliable<-setCategory(raw, Ct.max=dcCtmax, Ct.min=dcCtmin,replicates=FALSE, flag=dcflag, flag.out="Y", quantile=NULL)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
554 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
555 "OpenArray"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
556 unreliable<-setCategory(raw, Ct.max=dcCtmax, Ct.min=dcCtmin,replicates=FALSE, flag=dcflag, flag.out="TRUE ", quantile=NULL)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
557 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
558 "BioMark"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
559 unreliable<-setCategory(raw, Ct.max=dcCtmax, Ct.min=dcCtmin,replicates=FALSE, flag=dcflag, flag.out="Fail", quantile=NULL)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
560 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
561 stop("Enter something that switches me!")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
562 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
563 #unreliable<-setCategory(raw, Ct.max=dcCtmax, Ct.min=dcCtmin,replicates=FALSE, flag=dcflag, flag.out="Y", quantile=NULL)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
564
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
565 ####################################################################################################################
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
566 #Filter out the values of the new category
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
567 xFilter <- filterCategory(unreliable)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
568
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
569 cat("\n Categorization completed! ")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
570
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
571 png(x, # create PNG for the heat map
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
572 width = 10*300, # 5 x 300 pixels
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
573 height = 10*300,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
574 res = 300, # 300 pixels per inch
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
575 pointsize = 8)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
576 plotCtBoxes(xFilter, stratify=NULL, xlab = "Samples", ylab="Ct", names=as.character(seq(1, ncol(xFilter), 1))) # smaller font size
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
577 dev.off()
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
578
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
579 #write.table(exprs(xFilter), file=x, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
580
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
581 ####################################################################################################################
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
582 #NORMALIZATION
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
583 #method version 3.5.1 + Global mean
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
584 normalizeCtDataDav <-
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
585 function(q,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
586 norm = "deltaCt",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
587 deltaCt.genes = NULL,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
588 scale.rank.samples,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
589 rank.type = "pseudo.median",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
590 Ct.max = dcCtmax,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
591 geo.mean.ref,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
592 verbose = TRUE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
593 {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
594 # Extract the data
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
595 data <- exprs(q)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
596 data.norm <- data
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
597 # Get the normalisation method
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
598 method <- match.arg(norm, c("quantile", "scale.rankinvariant", "norm.rankinvariant", "deltaCt", "geometric.mean", "globalmean"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
599 # Some general stuff that will be used by both rank.invariant methods
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
600 if (method %in% c("scale.rankinvariant", "norm.rankinvariant")) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
601 # Index to use for too high Ct values
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
602 #Ct.index <- data>Ct.max
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
603 data.Ctmax <- data
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
604 Ct.index <- is.na(data)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
605 #data.Ctmax[Ct.index] <- NA
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
606 data<-na.spline(data)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
607 # Define what to rank against
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
608 if (rank.type=="pseudo.median") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
609 ref.data <- apply(data.Ctmax, 1, median, na.rm=TRUE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
610 } else if (rank.type=="pseudo.mean") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
611 ref.data <- apply(data.Ctmax, 1, mean, na.rm=TRUE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
612 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
613 # Mark + replace NA values with something temporary
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
614 na.index <- is.na(ref.data)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
615 ref.data[na.index] <- 30
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
616 # Run the rank.invariant function
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
617 data.rankinvar <- apply(data, 2, normalize.invariantset, ref=ref.data)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
618 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
619 # The actual normalisation
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
620 switch(method,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
621 quantile = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
622 # Use an internal limma function
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
623 data.norm <- normalizeQuantiles(data)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
624 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
625 scale.rankinvariant = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
626 # Get all the rank invariant genes
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
627 ri.genes <- sapply(data.rankinvar, "[[", "i.set")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
628 # Remove those with too high Ct values
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
629 ri.genes[Ct.index] <- FALSE
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
630 # Remove those that were all NA for potentially other reasons
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
631 ri.genes[na.index,] <- FALSE
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
632 # Select those to use here
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
633 ri.count <- rowSums(ri.genes)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
634 if (missing(scale.rank.samples))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
635 scale.rank.samples <- ncol(data)-1
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
636 ri.index <- ri.count >= scale.rank.samples
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
637 if (sum(ri.index)==0)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
638 stop(paste("No rank invariant genes were found across", scale.rank.samples, "samples"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
639 # Extract the corresponding Ct values; average
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
640 ri.mean <- colMeans(data[ri.index,,drop=FALSE])
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
641 ri.scale <- ri.mean/ri.mean[1]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
642 # Correct the data
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
643 data.norm <- t(t(data)*ri.scale)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
644 # Print info
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
645 if (verbose) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
646 cat(c("Scaling Ct values\n\tUsing rank invariant genes:", paste(featureNames(q)[ri.index], collapse=" "), "\n"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
647 cat(c("\tScaling factors:", format(ri.scale, digits=3), "\n"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
648 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
649 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
650 norm.rankinvariant = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
651 # Print info
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
652 if (verbose)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
653 cat("Normalizing Ct values\n\tUsing rank invariant genes:\n")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
654 # Correct the data based on the calculations above
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
655 for (i in 1:ncol(data)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
656 # Check if there are any rank invariant genes
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
657 ri.sub <- data.rankinvar[[i]]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
658 ri.genes <- ri.sub[["i.set"]]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
659 # Remove those that don't pass the Ct.max criteria
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
660 ri.genes[Ct.index[,i]] <- FALSE
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
661 # Remove those that are NA for other reasons
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
662 ri.genes[na.index] <- FALSE
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
663 if (sum(ri.genes)==0) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
664 warning(paste("\tNo rank invariant genes were found for sample ", sampleNames(q)[i], "; sample not normalized\n", sep=""))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
665 next
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
666 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
667 # If verbose, print some info
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
668 if (verbose)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
669 cat(paste("\t", sampleNames(q)[i], ": ", sum(ri.genes), " rank invariant genes\n", sep=""))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
670 # The actual correction
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
671 data.norm[,i] <- as.numeric(approx(ri.sub$n.curve$y, ri.sub$n.curve$x, xout=data[,i], rule=2)$y)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
672 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
673 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
674 deltaCt = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
675 # Which are the reference genes (endogenous controls)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
676 if (is.null(deltaCt.genes))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
677 deltaCt.genes <- unique(featureNames(q)[featureType(q)=="Endogenous Control"])
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
678 c.index <- featureNames(q) %in% deltaCt.genes
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
679 if (verbose) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
680 cat(c("Calculating deltaCt values\n\tUsing control gene(s):", paste(deltaCt.genes, collapse=" "), "\n"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
681 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
682 # Run though all cards; perform internal normalisation
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
683 for (c in 1:ncol(data)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
684 # Calculate the control genes
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
685 refCt <- mean(data[c.index,c], na.rm=TRUE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
686 refsd <- sd(data[c.index,c], na.rm=TRUE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
687 # Difference for target and controls
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
688 data.norm[,c] <- data[,c]-refCt
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
689 # Print results
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
690 if (verbose)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
691 cat(paste("\tCard ", c, ":\tMean=", format(refCt, dig=4), "\tStdev=", format(refsd, dig=3), "\n", sep=""))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
692 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
693 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
694 geometric.mean = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
695 # For each column, calculate the geometric mean of Ct values<Ct.max
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
696 #geo.mean <- apply(data, 2, function(x) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
697 # xx <- log2(subset(x, x<Ct.max))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
698 # 2^mean(xx)})
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
699 geo.mean <- apply(data, 2, function(x) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
700 xx <- subset(x, x<=Ct.max)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
701 geometric.mean(xx)})
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
702 # Which sample to scale to
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
703 #if (missing(geo.mean.ref))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
704 # geo.mean.ref <- 1
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
705 # Calculate the scaling factor
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
706 #geo.scale <- geo.mean/geo.mean[geo.mean.ref]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
707 # Adjust the data accordingly
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
708 data.norm <- t(t(data) - geo.mean)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
709 if (verbose) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
710 cat(c("Scaling Ct values\n\tUsing geometric mean within each sample\n"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
711 #cat(c("\tScaling factors:", format(geo.scale, digits=3), "\n"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
712 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
713 } # switch
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
714 ,globalmean = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
715 glo <- apply(data, 2, function(x) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
716 xx <- subset(x, x <= Ct.max)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
717 mean(xx)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
718 })
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
719 data.norm <- t(t(data) - glo)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
720 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
721 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
722 # Replace with the normalised Ct exprs
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
723 exprs(q) <- data.norm
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
724 # Add to the history of the object
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
725 if (nrow(getCtHistory(q))==0)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
726 setCtHistory(q) <- data.frame(history="Manually created qPCRset object.", stringsAsFactors=FALSE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
727 setCtHistory(q) <- rbind(getCtHistory(q), capture.output(match.call(normalizeCtData)))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
728 # Return the normalised object
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
729 q
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
730 }
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
731 #library(NormqPCR)
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
732
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
733 #delete.na <- function(DF, n=0) {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
734 # DF[rowSums(is.na(DF)) <= n,]
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
735 #}
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
736
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
737 #user_number=5
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
738 #genorm <- selectHKs(t(delete.na(as.matrix(exprs(xGlico)),0)), method = "geNorm", Symbols = rownames(as.matrix(delete.na(exprs(xGlico),0))), minNrHK = as.numeric(user_number), log = TRUE)
7
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
739 #genorm
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
740 #normfinder <- selectHKs(as.matrix(t(delete.na(exprs(xGlico),0))), group= files$Treatment , method = "NormFinder", Symbols =rownames(as.matrix(delete.na(exprs(xGlico),0))), minNrHK = as.numeric(user_number), log = TRUE)
7
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
741 #normfinder
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
742 #intersection= intersect(normfinder$ranking, genorm$ranking[1:as.numeric(user_number)])
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
743
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
744 #cat("\n GeNorm and NormFinder transcripts selected as housekeeping for normalization! \n")
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
745 #intersection
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
746 #dnorm <- normalizeCtData(xGlico , norm="deltaCt", deltaCt.genes=as.vector(intersection))
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
747
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
748 switch(normalizationMethod,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
749 "deltaCt"={
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
750 delete.na <- function(DF, n=0) {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
751 DF[rowSums(is.na(DF)) <= n,]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
752 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
753 switch(submethod,
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
754 "userdefined"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
755 normalizedDataset <- normalizeCtDataDav(xFilter, norm="deltaCt", deltaCt.genes =explode(normalizers, sep = ","))
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
756 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
757 "genorm"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
758 library(NormqPCR)
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
759 genorm <- selectHKs(t(delete.na(as.matrix(exprs(xFilter)),0)), method = "geNorm", Symbols = rownames(as.matrix(delete.na(exprs(xFilter),0))), minNrHK = as.numeric(user_number), trace=TRUE, log = TRUE)
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
760 genorm
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
761 normalizedDataset <- normalizeCtDataDav(xFilter, norm="deltaCt", deltaCt.genes =genorm$ranking[1:length(genorm$meanM[genorm$meanM<1.5])])
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
762 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
763 "normfinder"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
764 library(NormqPCR)
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
765 normfinder <- selectHKs(as.matrix(t(delete.na(exprs(xFilter),0))), group= files$Treatment , method = "NormFinder", Symbols =rownames(as.matrix(delete.na(exprs(xFilter),0))), minNrHK = as.numeric(user_number), trace=TRUE, log = TRUE)
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
766 normfinder
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
767 normalizedDataset <- normalizeCtDataDav(xFilter, norm="deltaCt", deltaCt.genes =normfinder$ranking)
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
768 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
769 stop("Enter something that switches me!")
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
770 )
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
771 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
772 "quantile"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
773 normalizedDataset <- normalizeCtDataDav(xFilter, norm=normalizationMethod)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
774 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
775 "scale.rankinvariant"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
776 normalizedDataset <- normalizeCtDataDav(xFilter, norm=normalizationMethod)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
777 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
778 "norm.rankinvariant"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
779 normalizedDataset <- normalizeCtDataDav(xFilter, norm=normalizationMethod)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
780 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
781 "geometric.mean"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
782 normalizedDataset <- normalizeCtDataDav(xFilter, norm=normalizationMethod)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
783 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
784 "globalmean"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
785 normalizedDataset <- normalizeCtDataDav(xFilter, norm=normalizationMethod)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
786 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
787 stop("Enter something that switches me!")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
788 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
789
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
790 #if (normalizationMethod=="deltaCt") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
791 #normalize CT data
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
792
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
793 #normalizedDataset <- normalizeCtDataDav(xFilter, norm="deltaCt", deltaCt.genes =explode(normalizers, sep = ","))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
794 #} else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
795 #normalizedDataset <- normalizeCtDataDav(xFilter, norm=normalizationMethod)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
796
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
797 #}
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
798 cat("\n Data normalized correctly! \n")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
799 write.table(exprs(normalizedDataset), file=outputNorm, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
800
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
801
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
802 #normalizedDataset
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
803 ####################################################################################################################
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
804 #Check noise reduction by empirical cumulative distribution
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
805
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
806 #X = rnorm(100) # X is a sample of 100 normally distributed random variables
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
807 # P = ecdf(X) # P is a function giving the empirical CDF of X
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
808 #Y = rnorm(1000) # X is a sample of 100 normally distributed random variables
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
809 # PY = ecdf(Y)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
810 #plotâ„—
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
811
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
812 #lines(PY)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
813 png(outputECDF, # create PNG for the heat map
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
814 width = 10*300, # 5 x 300 pixels
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
815 height = 10*300,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
816 res = 300, # 300 pixels per inch
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
817 pointsize = 8) # smaller font size
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
818 vec=c()
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
819 for (i in 1:nrow(exprs(xFilter))){
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
820 CVX<-(sd(2^-exprs(xFilter)[i,], na.rm = TRUE)/mean(2^-exprs(xFilter)[i,], na.rm = TRUE))*100
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
821 vec=c(vec, c(CVX))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
822 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
823 vec<-na.omit(vec)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
824 P = ecdf(vec)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
825 gm=c()
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
826 for (i in 1:nrow(exprs(normalizedDataset))){
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
827 CVGM<-(sd(2^-exprs(normalizedDataset)[i,], na.rm = TRUE)/mean(2^-exprs(normalizedDataset)[i,], na.rm = TRUE))*100
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
828 gm=c(gm, c(CVGM))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
829 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
830 gm<-na.omit(gm)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
831
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
832 PY = ecdf(gm)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
833
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
834 plot_colors <- c(rgb(r=0.0,g=0.0,b=0.9), "red", "forestgreen",rgb(r=0.0,g=0.0,b=0.0),rgb(r=0.5,g=0.0,b=0.3),rgb(r=0.0,g=0.4,b=0.4))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
835
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
836 plot(P,col=plot_colors[1],xlim=c(0.0,600), ylim=c(0.0,1),xaxp = c(0.0, 600, 6),yaxp = c(0.0, 1, 10), cex=1.3, lwd=5, main=NULL,xlab="CV(%)",ylab="Empirical Cumulative Distribution")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
837 lines(PY, lwd=5, col=plot_colors[6],cex=1.3)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
838 legend("bottomright", c("not normalized", "normalized"), cex=1.3, col=c(plot_colors[1],plot_colors[6]), lwd=c(5,5));
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
839 dev.off()
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
840
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
841 #Two-sample Kolmogorov-Smirnov
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
842 ks.test(vec,gm)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
843
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
844
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
845 #write.table(exprs(qFiltNAs), file=outputIMP, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
846 png(outputIMP, # create PNG for the heat map
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
847 width = 10*300, # 5 x 300 pixels
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
848 height = 10*300,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
849 res = 300, # 300 pixels per inch
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
850 pointsize = 8)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
851 plotCtBoxes(normalizedDataset, stratify=NULL, xlab = "Samples", ylab="DeltaCt", names=as.character(seq(1, ncol(normalizedDataset), 1))) # smaller font size
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
852 dev.off()
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
853
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
854 ################################################## Filtering based on number of NAs##################################################
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
855
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
856 #FILTERING on the basis of NAs
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
857 #qPCRset.R
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
858 setMethod("exprs", signature(object="qPCRset"), definition =
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
859 function (object) {x <- assayDataElement(object, "exprs"); rownames(x) <- featureNames(object); colnames(x) <- sampleNames(phenoData(object));x}
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
860 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
861 ncatn <- as.integer(n.samples(normalizedDataset))*as.integer(percentofnastoremove)/100
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
862
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
863 qFiltNAs <- filterCtData(normalizedDataset, remove.category=c("Undetermined","Unreliable"), n.category=as.integer(ncatn),remove.name=explode(filtnames, sep = ","))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
864
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
865 cat("\n Data filtered correctly! \n")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
866
3
e2fcf5a4609c planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 51ea950c5c71f2cc8f45bc56cc5609ee7a12a3df
davidecangelosi
parents: 2
diff changeset
867 if (anyNA(exprs(qFiltNAs))){
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
868 switch(imputeMethod,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
869 "knn"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
870 imp<-impute.knn(exprs(qFiltNAs) ,k = as.integer(kappa), maxp = as.integer(macsp), rng.seed=362436069)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
871 exprs(qFiltNAs)=imp$data
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
872 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
873 "mestdagh"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
874 #Mesdagh
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
875 #sostituisce a NA -1000
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
876 for (i in 1:nrow(exprs(qFiltNAs))){
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
877 for(j in 1:ncol(exprs(qFiltNAs))){
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
878 if(is.na(exprs(qFiltNAs)[i,j])>0)exprs(qFiltNAs)[i,j]<- -1000
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
879 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
880 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
881 temp<-exprs(qFiltNAs)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
882 for (i in 1:nrow(exprs(qFiltNAs))){
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
883 for(j in 1:ncol(exprs(qFiltNAs))){
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
884 if(exprs(qFiltNAs)[i,j]<(-100))exprs(qFiltNAs)[i,j]<- max(temp[i,])+1
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
885 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
886 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
887 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
888 "cubic"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
889 exprs(qFiltNAs) <- na.spline(exprs(qFiltNAs))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
890 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
891 "mean"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
892 exprs(qFiltNAs)<-impute(exprs(qFiltNAs),mean)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
893 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
894 "median"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
895 exprs(qFiltNAs)<-impute(exprs(qFiltNAs),median)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
896 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
897 "nondetects"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
898 qFiltNAs <- qpcrImpute(qFiltNAs, outform=c("Single"),linkglm = c("logit"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
899 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
900 stop("Enter something that switches me!")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
901 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
902
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
903 cat("\n Imputation completed! \n")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
904 }else{
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
905 cat("\n Nothing to impute! \n")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
906 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
907
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
908 write.table(exprs(qFiltNAs), file=outputRemaining, quote=FALSE, row.names=TRUE, col.names=TRUE, sep = "\t")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
909
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
910 if (DEAMethod=="ttest") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
911 #Differential expression analysis (paired t test+BH). Returns Fold change in linear scale.
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
912 DEG<-ttestCtData(qFiltNAs, groups = files$Treatment, alternative = alternative, paired = ifelse(paired=="TRUE", TRUE, FALSE), replicates =ifelse(replicates=="TRUE", TRUE, FALSE), sort=ifelse(sort=="TRUE", TRUE, FALSE), stringent=ifelse(stringent=="TRUE", TRUE, FALSE), p.adjust=padjust)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
913 write.table(DEG, file=outputDEA, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
914 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
915 if (DEAMethod=="rp") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
916 DEG<-RP(exprs(qFiltNAs), as.numeric(pData(qFiltNAs)$Treatment)-1, num.perm = 1000,logged = TRUE, gene.names = featureNames(qFiltNAs), huge=TRUE, plot = FALSE, rand = 123)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
917 write.table(DEG[1:5], file=outputDEA, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
918 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
919 cat("\n Differential expression analysis completed correctly! \n")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
920 cat("\n Workflow ended correctly! \n")