annotate pipe-t.R @ 31:e4281dad3291 draft default tip

planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 488b3c091e8bf80f741a3e46b929427f1658ba3a-dirty
author davidecangelosi
date Thu, 10 Oct 2019 09:23:42 -0400
parents 5618ea415c4a
children
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(zoo)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
28 })
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
29
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
30 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
31
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
32 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
33 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
34 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
35 format<-args[2]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
36 nfeatures<-args[3]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
37 rawout<-args[4]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
38 path <- args[5]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
39 dcCtmin<-args[6]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
40 dcCtmax<-args[7]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
41 dcflag<-args[8]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
42 x<-args[9]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
43 normalizationMethod<-args[10]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
44 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
45 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
46 switch(submethod,
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
47 "userdefined"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
48 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
49 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
50 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
51 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
52 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
53 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
54 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
55 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
56 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
57 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
58
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
59 DEAMethod<-args[21]
18
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
60 if (DEAMethod=="ttest" || DEAMethod=="wtest") {
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 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
69 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
70 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
71 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
72 }
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
73 } else {
10
bc5697f41720 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 2c7880131d5a3ca88ddc31e2a52a12fa17774178
davidecangelosi
parents: 9
diff changeset
74 #mean, median, cubic
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
75 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
76 DEAMethod<-args[19]
18
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
77 if (DEAMethod=="ttest" || DEAMethod=="wtest") {
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
78 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
79 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
80 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
81 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
82 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
83 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
84 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
85 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
86 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
87 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
88 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
89 }
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
90 }
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
91 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
92 "genorm"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
93 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
94 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
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 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
103
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
104 DEAMethod<-args[21]
18
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
105 if (DEAMethod=="ttest" || DEAMethod=="wtest") {
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
106 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
107 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
108 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
109 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
110 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
111 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
112 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
113 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
114 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
115 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
116 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
117 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
118 } else {
10
bc5697f41720 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 2c7880131d5a3ca88ddc31e2a52a12fa17774178
davidecangelosi
parents: 9
diff changeset
119 #mean, median, cubic
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
120 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
121 DEAMethod<-args[19]
18
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
122 if (DEAMethod=="ttest" || DEAMethod=="wtest") {
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
123 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
124 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
125 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
126 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
127 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
128 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
129 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
130 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
131 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
132 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
133 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
134 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
135 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
136
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
137 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
138 "normfinder"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
139 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
140 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
141 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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
150 DEAMethod<-args[21]
18
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
151 if (DEAMethod=="ttest" || DEAMethod=="wtest") {
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
152 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
153 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
154 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
155 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
156 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
157 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
158 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
159 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
160 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
161 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
162 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
163 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
164 } else {
10
bc5697f41720 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 2c7880131d5a3ca88ddc31e2a52a12fa17774178
davidecangelosi
parents: 9
diff changeset
165 #mean, median, cubic
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
166 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
167 DEAMethod<-args[19]
18
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
168 if (DEAMethod=="ttest" || DEAMethod=="wtest") {
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
169 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
170 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
171 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
172 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
173 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
174 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
175 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
176 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
177 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
178 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
179 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
180 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
181 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
182
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
183 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
184 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
185 )
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
186 }else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
187 outputNorm<-args[11]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
188 outputECDF<-args[12]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
189 percentofnastoremove<-args[13]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
190 outputRemaining<-args[14]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
191 imputeMethod<-args[15]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
192
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
193 if (imputeMethod=="knn") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
194 kappa<- args[16]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
195 macsp<-args[17]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
196 outputIMP<-args[18]
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 DEAMethod<-args[19]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
199
18
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
200 if (DEAMethod=="ttest" || DEAMethod=="wtest") {
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
201 alternative<- args[20]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
202 paired<-args[21]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
203 replicates<- args[22]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
204 sort<-args[23]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
205 stringent<- args[24]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
206 padjust<-args[25]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
207 outputDEA<-args[26]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
208 filtnames<-args[27]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
209 } else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
210 outputDEA<-args[20]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
211 filtnames<-args[21]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
212 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
213 } else {
10
bc5697f41720 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 2c7880131d5a3ca88ddc31e2a52a12fa17774178
davidecangelosi
parents: 9
diff changeset
214 #mean, median, cubic
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
215 outputIMP<-args[16]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
216 DEAMethod<-args[17]
18
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
217 if (DEAMethod=="ttest" || DEAMethod=="wtest") {
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
218 alternative<- args[18]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
219 paired<-args[19]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
220 replicates<- args[20]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
221 sort<-args[21]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
222 stringent<- args[22]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
223 padjust<-args[23]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
224 outputDEA<-args[24]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
225 filtnames<-args[25]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
226
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
227 } else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
228 outputDEA<-args[18]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
229 filtnames<-args[19]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
230
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 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
233 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
234 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
235
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
236 .readCtEDS <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
237 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
238 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
239 # 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
240 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
241 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
242 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
243 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
244 # 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
245 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
246 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
247 } # .readCtEDS
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
248
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
249
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
250 .readCtPlain <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
251 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
252 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
253 # 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
254 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
255 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
256 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
257 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
258 # 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
259 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
260 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
261 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
262 } # .readCtPlain
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
263
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
264 .readCtSDS <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
265 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
266 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
267 # 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
268 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
269 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
270 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
271 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
272 # Read data, skip the required lines
15
5e8bf316343d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d5c46b42061ff823c19437d1c803119ef8b95627
davidecangelosi
parents: 14
diff changeset
273 out <- read.delim(file=readfile, header=TRUE, colClasses="character", nrows=nspots*n.data[i], skip=n.header-1, 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
274 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
275 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
276 } # .readCtSDS
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
277
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
278 .readCtLightCycler <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
279 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
280 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
281 # 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
282 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
283 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
284 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
285 } # .readCtLightCycler
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
286
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
287 .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
288 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
289 # Read data, skip the required lines
26
f008adc272a2 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit edd961b682ee4b19ba87eb7bd63ad169aa9678ea
davidecangelosi
parents: 24
diff changeset
290 out <- read.delim(file=readfile, header=TRUE, as.is=TRUE, nrows=nspots*n.data[i], 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
291 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
292 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
293 } # .readCtCFX
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
294
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
295 .readCtOpenArray <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
296 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
297 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
298 # Read data
26
f008adc272a2 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit edd961b682ee4b19ba87eb7bd63ad169aa9678ea
davidecangelosi
parents: 24
diff changeset
299 out <- read.delim(file=readfile, header=TRUE, as.is=TRUE, nrows=nspots*n.data[i], 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
300 # 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
301 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
302 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
303 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
304 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
305 } # .readCtOpenArray
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
306
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
307 .readCtBioMark <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
308 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
309 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
310 # 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
311 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
312 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
313 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
314 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
315 # Read data, skip the required lines
26
f008adc272a2 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit edd961b682ee4b19ba87eb7bd63ad169aa9678ea
davidecangelosi
parents: 24
diff changeset
316 out <- read.delim(file=readfile, header=TRUE, as.is=TRUE, 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
317 # 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
318 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
319 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
320 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
321 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
322 } # .readCtBioMark
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
323
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
324
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
325
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
326 readCtDataDav<-
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
327 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
328 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
329 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
330 ...)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
331 {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
332 if (missing(files))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
333 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
334 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
335 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
336 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
337 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
338 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
339 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
340 s.names <- NULL
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
341 nspots <- n.features
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
342 if (SDS) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
343 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
344 format <- "SDS"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
345 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
346 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
347 !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
348 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
349 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
350 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
351 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
352 plain = list(flag = 4, feature = 6, type = 7, position = 3, Ct = 8),
15
5e8bf316343d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d5c46b42061ff823c19437d1c803119ef8b95627
davidecangelosi
parents: 14
diff changeset
353 #SDS = list(flag = 4,feature = 6, type = 7, position = 3, Ct = 8),
17
81f51d722102 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit e398b5c7a84d650a355ab3a7fbff2757f7a1ca78
davidecangelosi
parents: 16
diff changeset
354 SDS = list(flag = "Omit",feature = "Detector", type = "Task", 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
355 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
356 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
357 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
358 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
359 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
360 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
361 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
362 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
363 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
364 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
365 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
366 stringsAsFactors = FALSE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
367 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
368 if (i == 1) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
369 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
370 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
371 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
372 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
373 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
374 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
375 files[i]))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
376 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
377 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
378 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
379 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
380 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
381 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
382 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
383 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
384 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
385 #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
386 # 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
387 # 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
388 # } elseif {
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
389 # 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
390 # }
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
391 #}else{
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[["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 # }
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
394 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
395 "No Ct"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
396 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
397 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
398 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
399 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
400 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
401 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
402 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
403 }
16
254114751c2e planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit f13c9430052e43a372b0bf311a663498ff79b4fe
davidecangelosi
parents: 15
diff changeset
404 X[, cols] <- suppressWarnings({apply(data, 2, function(x) as.numeric(as.character(x)))})
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
405 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
406 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
407 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
408 flags[flags == "-"] <- "Failed"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
409 flags[flags == "+"] <- "Passed"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
410 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
411 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
412 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
413 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
414 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
415 if (format == "OpenArray") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
416 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
417 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
418 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
419 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
420 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
421 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
422 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
423 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
424 if (i == 1) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
425 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
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 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
434 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
435 featurePos = featPos)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
436 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
437 "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
438 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
439 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
440 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
441 if (!missing(samples)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
442 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
443 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
444 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
445 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
446 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
447 samples <- samples
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
448 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
449 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
450 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
451 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
452 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
453 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
454 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
455 samples <- s.names
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
456 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
457 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
458 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
459 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
460 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
461 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
462 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
463 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
464 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
465 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
466 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
467 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
468 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
469 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
470 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
471 stringsAsFactors = FALSE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
472 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
473 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
474 CtHistory = X.hist)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
475 out
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
476 }
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
477
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
478
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
479 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
480 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
481 switch(format,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
482 "EDS"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
483 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
484 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
485 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
486 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
487 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
488 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
489 "plain"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
490 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
491 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
492 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
493 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
494 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
495 "SDS"={
15
5e8bf316343d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d5c46b42061ff823c19437d1c803119ef8b95627
davidecangelosi
parents: 14
diff changeset
496 #columns<- list(feature=3, Ct=6, flag=11)
8
e5953805ad7a planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7d54176ff26ed5f4411edb0582a3704dd90253c0
davidecangelosi
parents: 7
diff changeset
497 #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
498 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
499 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
500 rownames(phenoData)=as.vector(files$sampleName)
15
5e8bf316343d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d5c46b42061ff823c19437d1c803119ef8b95627
davidecangelosi
parents: 14
diff changeset
501 raw<- readCtDataDav(files = files$sampleName, header=TRUE,format="SDS",path = path, sample.info=phenoData, n.features=as.numeric(nfeatures))
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
502 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
503 "LightCycler"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
504 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
505 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
506 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
507 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
508 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
509 "CFX"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
510 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
511 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
512 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
513 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
514 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
515 "OpenArray"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
516 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
517 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
518 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
519 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
520 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
521 "BioMark"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
522 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
523 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
524 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
525 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
526 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
527 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
528 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
529 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
530
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
531 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
532 ####################################################################################################################
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
533 #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
534 switch(format,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
535 "EDS"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
536 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
537 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
538 "plain"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
539 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
540 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
541 "SDS"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
542 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
543 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
544 "LightCycler"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
545 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
546 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
547 "CFX"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
548 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
549 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
550 "OpenArray"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
551 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
552 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
553 "BioMark"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
554 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
555 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
556 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
557 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
558 #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
559
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 #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
562 xFilter <- filterCategory(unreliable)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
563
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
564 cat("\n Categorization completed! ")
23
465e643e1ea1 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 4ddffbbbad77ef6dd023dc3311a820413a8fa3c4
davidecangelosi
parents: 22
diff changeset
565 minvalue<-min(exprs(xFilter), na.rm = TRUE)
465e643e1ea1 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 4ddffbbbad77ef6dd023dc3311a820413a8fa3c4
davidecangelosi
parents: 22
diff changeset
566 maxvalue<-max(exprs(xFilter), na.rm = TRUE)
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
567 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
568 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
569 height = 10*300,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
570 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
571 pointsize = 8)
13
969d0bbbf5a9 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 413fab99454e4e29072af0120eacea0a78f966c1
davidecangelosi
parents: 12
diff changeset
572
23
465e643e1ea1 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 4ddffbbbad77ef6dd023dc3311a820413a8fa3c4
davidecangelosi
parents: 22
diff changeset
573 plotCtBoxes(xFilter, ylim=c(as.numeric(minvalue), as.numeric(maxvalue)), cex.lab=3, cex.axis = 2,stratify=NULL, xlab = "Samples", ylab="Ct", mar = c(8,8,8,8), names=as.character(seq(1, ncol(xFilter), 1))) # smaller font size
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
574 dev.off()
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
575
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
576 #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
577
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 #NORMALIZATION
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
580 #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
581 normalizeCtDataDav <-
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
582 function(q,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
583 norm = "deltaCt",
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
584 deltaCt.genes = NULL,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
585 scale.rank.samples,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
586 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
587 Ct.max = dcCtmax,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
588 geo.mean.ref,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
589 verbose = TRUE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
590 {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
591 # Extract the data
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
592 data <- exprs(q)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
593 data.norm <- data
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
594 # 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
595 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
596 # 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
597 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
598 # 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
599 #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
600 data.Ctmax <- data
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
601 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
602 #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
603 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
604 # 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
605 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
606 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
607 } 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
608 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
609 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
610 # 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
611 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
612 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
613 # 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
614 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
615 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
616 # The actual normalisation
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
617 switch(method,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
618 quantile = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
619 # 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
620 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
621 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
622 scale.rankinvariant = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
623 # 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
624 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
625 # 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
626 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
627 # 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
628 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
629 # 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
630 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
631 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
632 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
633 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
634 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
635 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
636 # 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
637 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
638 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
639 # Correct the data
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
640 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
641 # Print info
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
642 if (verbose) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
643 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
644 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
645 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
646 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
647 norm.rankinvariant = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
648 # Print info
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
649 if (verbose)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
650 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
651 # 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
652 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
653 # 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
654 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
655 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
656 # 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
657 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
658 # 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
659 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
660 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
661 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
662 next
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
663 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
664 # 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
665 if (verbose)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
666 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
667 # The actual correction
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
668 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
669 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
670 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
671 deltaCt = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
672 # 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
673 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
674 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
675 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
676 if (verbose) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
677 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
678 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
679 # 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
680 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
681 # 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
682 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
683 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
684 # 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
685 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
686 # Print results
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
687 if (verbose)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
688 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
689 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
690 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
691 geometric.mean = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
692 # 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
693 #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
694 # 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
695 # 2^mean(xx)})
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) {
20
9227f7b1c50b planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit ff16cfc0a6c2b83c1e32d1204e91f3a20d6dc231
davidecangelosi
parents: 19
diff changeset
697 xx <- subset(x, x<Ct.max)
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
698 geometric.mean(xx)})
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
699 # 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
700 #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
701 # 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
702 # 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
703 #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
704 # 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
705 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
706 if (verbose) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
707 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
708 #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
709 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
710 } # switch
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
711 ,globalmean = {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
712 glo <- apply(data, 2, function(x) {
20
9227f7b1c50b planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit ff16cfc0a6c2b83c1e32d1204e91f3a20d6dc231
davidecangelosi
parents: 19
diff changeset
713 xx <- subset(x, x <Ct.max)
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
714 mean(xx)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
715 })
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
716 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
717 }
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 # 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
720 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
721 # 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
722 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
723 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
724 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
725 # 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
726 q
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
727 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
728
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
729 switch(normalizationMethod,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
730 "deltaCt"={
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
731 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
732 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
733 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
734 switch(submethod,
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
735 "userdefined"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
736 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
737 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
738 "genorm"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
739 library(NormqPCR)
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
740 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
741 genorm
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
742 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
743 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
744 "normfinder"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
745 library(NormqPCR)
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
746 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
747 normfinder
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
748 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
749 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
750 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
751 )
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
752 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
753 "quantile"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
754 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
755 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
756 "scale.rankinvariant"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
757 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
758 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
759 "norm.rankinvariant"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
760 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
761 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
762 "geometric.mean"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
763 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
764 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
765 "globalmean"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
766 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
767 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
768 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
769 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
770
12
11393eb1c557 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d1be332a7da0e53b3e6451f0aeda0675f190dd64
davidecangelosi
parents: 10
diff changeset
771
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
772 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
773 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
774
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
775
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
776 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
777 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
778 height = 10*300,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
779 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
780 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
781 vec=c()
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
782 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
783 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
784 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
785 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
786 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
787 P = ecdf(vec)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
788 gm=c()
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
789 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
790 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
791 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
792 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
793 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
794
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
795 PY = ecdf(gm)
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 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))
14
3168db2e0ff5 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 4e1ae25e30206be75710403c7500980ddb474beb
davidecangelosi
parents: 13
diff changeset
798 par(mar = c(8,8,8,8))
3168db2e0ff5 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 4e1ae25e30206be75710403c7500980ddb474beb
davidecangelosi
parents: 13
diff changeset
799 plot(P,cex.lab=3, cex.axis = 2,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=paste("p-value=", formatC(ks.test(vec,gm)$p.value, format = "e", digits = 2)),xlab="CV(%)",ylab="Empirical Cumulative Distribution")
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
800 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
801 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
802 dev.off()
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 #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
805 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
806
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
807
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
808 #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
809 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
810 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
811 height = 10*300,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
812 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
813 pointsize = 8)
13
969d0bbbf5a9 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 413fab99454e4e29072af0120eacea0a78f966c1
davidecangelosi
parents: 12
diff changeset
814
24
6ae13912ab03 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit a642a9310fd2d16488b42aef5e0cde8124e978e3
davidecangelosi
parents: 23
diff changeset
815 plotCtBoxes(normalizedDataset, ylim=c(min(exprs(normalizedDataset), na.rm = TRUE),max(exprs(normalizedDataset), na.rm = TRUE)),cex.lab=3, cex.axis = 2,stratify=NULL, xlab = "Samples", ylab="DeltaCt", mar = c(8,8,8,8), names=as.character(seq(1, ncol(normalizedDataset), 1))) # smaller font size
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
816 dev.off()
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
817
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
818 ################################################## 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
819
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
820 #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
821 #qPCRset.R
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
822 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
823 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
824 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
825 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
826
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
827 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
828
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
829 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
830
3
e2fcf5a4609c planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 51ea950c5c71f2cc8f45bc56cc5609ee7a12a3df
davidecangelosi
parents: 2
diff changeset
831 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
832 switch(imputeMethod,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
833 "knn"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
834 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
835 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
836 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
837 "mestdagh"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
838 #Mesdagh
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
839 #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
840 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
841 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
842 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
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 temp<-exprs(qFiltNAs)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
846 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
847 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
848 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
849 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
850 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
851 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
852 "cubic"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
853 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
854 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
855 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
856 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
857
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
858 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
859 }else{
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
860 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
861 }
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 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
864
18
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
865 switch(DEAMethod,
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
866 "ttest"={
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
867 #Differential expression analysis (paired t test+BH). Returns Fold change in linear scale.
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
868 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)
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
869 write.table(DEG, file=outputDEA, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
870 },
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
871 "wtest"={
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
872 DEG<-mannwhitneyCtData(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)
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
873 write.table(DEG, file=outputDEA, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
874 },
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
875 "rp"={
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
876 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)
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
877 write.table(DEG[1:5], file=outputDEA, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
878 },
21
1e3113e565db planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit f53b88658dc1aa6627b064d7c8bed1562dfbc1dc
davidecangelosi
parents: 20
diff changeset
879 "none"={
1e3113e565db planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit f53b88658dc1aa6627b064d7c8bed1562dfbc1dc
davidecangelosi
parents: 20
diff changeset
880 },
18
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
881 stop("Enter something that switches me!")
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
882 )
2a6088c11d42 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d953cf83d97f579b4b03a30cd320f760d0ecdefc
davidecangelosi
parents: 17
diff changeset
883
19
8503457bd0c4 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit f98eba79c2036aa3e1b8f9048c0b1e61d4d87b60
davidecangelosi
parents: 18
diff changeset
884
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
885 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
886 cat("\n Workflow ended correctly! \n")