annotate pipe-t.R @ 12:11393eb1c557 draft

planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d1be332a7da0e53b3e6451f0aeda0675f190dd64
author davidecangelosi
date Thu, 16 May 2019 10:34:26 -0400
parents bc5697f41720
children 969d0bbbf5a9
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 library(Hmisc)
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
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
31 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
32
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
33 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
34 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
35 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
36 format<-args[2]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
37 nfeatures<-args[3]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
38 rawout<-args[4]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
39 path <- args[5]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
40 dcCtmin<-args[6]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
41 dcCtmax<-args[7]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
42 dcflag<-args[8]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
43 x<-args[9]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
44 normalizationMethod<-args[10]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
45 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
46 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
47 switch(submethod,
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
48 "userdefined"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
49 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
50 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
51 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
52 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
53 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
54 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
55 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
56 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
57 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
58 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
59
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
60 DEAMethod<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
61 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
62 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
63 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
64 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
65 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
66 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
67 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
68 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
69 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
70 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
71 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
72 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
73 }
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
74 } else {
10
bc5697f41720 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 2c7880131d5a3ca88ddc31e2a52a12fa17774178
davidecangelosi
parents: 9
diff changeset
75 #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
76 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
77 DEAMethod<-args[19]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
78 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
79 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
80 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
81 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
82 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
83 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
84 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
85 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
86 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
87 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
88 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
89 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
90 }
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
91 }
9
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
92 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
93 "genorm"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
94 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
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 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
103 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
104
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
105 DEAMethod<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
106 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
107 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
108 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
109 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
110 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
111 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
112 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
113 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
114 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
115 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
116 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
117 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
118 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
119 } else {
10
bc5697f41720 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 2c7880131d5a3ca88ddc31e2a52a12fa17774178
davidecangelosi
parents: 9
diff changeset
120 #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
121 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
122 DEAMethod<-args[19]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
123 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
124 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
125 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
126 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
127 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
128 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
129 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
130 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
131 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
132 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
133 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
134 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
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 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
139 "normfinder"={
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
140 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
141 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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149 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
150
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
151 DEAMethod<-args[21]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
152 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
153 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
154 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
155 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
156 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
157 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
158 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
159 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
160 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
161 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
162 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
163 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
164 }
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
165 } else {
10
bc5697f41720 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 2c7880131d5a3ca88ddc31e2a52a12fa17774178
davidecangelosi
parents: 9
diff changeset
166 #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
167 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
168 DEAMethod<-args[19]
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
169 if (DEAMethod=="ttest") {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
170 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
171 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
172 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
173 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
174 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
175 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
176 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
177 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
178 } else {
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
179 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
180 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
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 },
69f5c4d6e6bd planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7664e4dc44eb4f141ffd01627ee66858cc9887ff
davidecangelosi
parents: 8
diff changeset
185 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
186 )
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
187 }else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
188 outputNorm<-args[11]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
189 outputECDF<-args[12]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
190 percentofnastoremove<-args[13]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
191 outputRemaining<-args[14]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
192 imputeMethod<-args[15]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
193
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
194 if (imputeMethod=="knn") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
195 kappa<- args[16]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
196 macsp<-args[17]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
197 outputIMP<-args[18]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
198
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
199 DEAMethod<-args[19]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
200
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
201 if (DEAMethod=="ttest") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
202 alternative<- args[20]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
203 paired<-args[21]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
204 replicates<- args[22]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
205 sort<-args[23]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
206 stringent<- args[24]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
207 padjust<-args[25]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
208 outputDEA<-args[26]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
209 filtnames<-args[27]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
210 } else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
211 outputDEA<-args[20]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
212 filtnames<-args[21]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
213 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
214 } else {
10
bc5697f41720 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 2c7880131d5a3ca88ddc31e2a52a12fa17774178
davidecangelosi
parents: 9
diff changeset
215 #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
216 outputIMP<-args[16]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
217 DEAMethod<-args[17]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
218 if (DEAMethod=="ttest") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
219 alternative<- args[18]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
220 paired<-args[19]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
221 replicates<- args[20]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
222 sort<-args[21]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
223 stringent<- args[22]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
224 padjust<-args[23]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
225 outputDEA<-args[24]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
226 filtnames<-args[25]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
227
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
228 } else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
229 outputDEA<-args[18]
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
230 filtnames<-args[19]
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 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
235 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
236
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
237 .readCtEDS <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
238 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
239 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
240 # 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
241 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
242 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
243 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
244 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
245 # 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
246 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
247 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
248 } # .readCtEDS
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
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
251 .readCtPlain <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
252 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
253 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
254 # 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
255 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
256 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
257 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
258 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
259 # 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
260 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
261 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
262 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
263 } # .readCtPlain
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
264
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
265 .readCtSDS <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
266 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
267 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
268 # 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
269 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
270 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
271 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
272 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
273 # Read data, skip the required lines
7
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
274 out <- read.delim(file=readfile, header=FALSE, colClasses="character", nrows=nspots*n.data[i], skip=n.header, strip.white=TRUE, ...)
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
275 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
276 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
277 } # .readCtSDS
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
278
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
279 .readCtLightCycler <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
280 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
281 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
282 # 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
283 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
284 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
285 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
286 } # .readCtLightCycler
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
287
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
288 .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
289 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
290 # 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
291 out <- read.csv(file=readfile, header=TRUE, as.is=TRUE, nrows=nspots*n.data[i], strip.white=TRUE, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
292 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
293 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
294 } # .readCtCFX
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
295
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
296 .readCtOpenArray <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
297 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
298 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
299 # Read data
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
300 out <- read.csv(file=readfile, header=TRUE, as.is=TRUE, nrows=nspots*n.data[i], strip.white=TRUE, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
301 # 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
302 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
303 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
304 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
305 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
306 } # .readCtOpenArray
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
307
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
308 .readCtBioMark <-
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
309 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
310 {
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
311 # 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
312 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
313 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
314 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
315 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
316 # 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
317 out <- read.csv(file=readfile, header=TRUE, as.is=TRUE, nrows=nspots*n.data[i], skip=n.header, strip.white=TRUE, ...)
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
318 # 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
319 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
320 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
321 # Return
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
322 out
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
323 } # .readCtBioMark
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
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
326
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
327 readCtDataDav<-
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
328 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
329 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
330 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
331 ...)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
332 {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
333 if (missing(files))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
334 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
335 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
336 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
337 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
338 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
339 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
340 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
341 s.names <- NULL
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
342 nspots <- n.features
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
343 if (SDS) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
344 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
345 format <- "SDS"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
346 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
347 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
348 !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
349 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
350 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
351 if (missing(column.info)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
352 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
353 plain = list(flag = 4, feature = 6, type = 7, position = 3, Ct = 8),
7
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
354 SDS = list(flag = 4,feature = 6, type = 7, position = 3, Ct = 8),
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
355 #SDS = list(flag = "Omit",feature = "Detector", type = "Task", position = "Pos", Ct = "Avg.Ct"),
4
e248cd7769e8 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit fe7763760d58ae2b51441b67162bb5f86cffa91e
davidecangelosi
parents: 3
diff changeset
356 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
357 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
358 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
359 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
360 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
361 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
362 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
363 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
364 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
365 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
366 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
367 stringsAsFactors = FALSE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
368 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
369 if (i == 1) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
370 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
371 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
372 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
373 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
374 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
375 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
376 files[i]))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
377 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
378 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
379 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
380 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
381 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
382 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
383 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
384 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
385 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
386 #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
387 # 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
388 # 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
389 # } elseif {
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
390 # 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
391 # }
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
392 #}else{
3e099c082954 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 5c55ecdfd6ed19c7eb7558f278884511620df5dd
davidecangelosi
parents: 6
diff changeset
393 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
394 # }
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
395 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
396 "No Ct"))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
397 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
398 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
399 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
400 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
401 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
402 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
403 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
404 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
405 X[, cols] <- apply(data, 2, function(x) as.numeric(as.character(x)))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
406 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
407 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
408 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
409 flags[flags == "-"] <- "Failed"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
410 flags[flags == "+"] <- "Passed"
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
411 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
412 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
413 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
414 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
415 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
416 if (format == "OpenArray") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
417 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
418 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
419 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
420 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
421 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
422 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
423 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
424 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
425 if (i == 1) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 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
434 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
435 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
436 featurePos = featPos)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
437 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
438 "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
439 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
440 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
441 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
442 if (!missing(samples)) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
443 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
444 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
445 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
446 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
447 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
448 samples <- samples
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 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
451 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
452 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
453 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
454 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
455 else if (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
456 samples <- s.names
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
457 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
458 else {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
459 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
460 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
461 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
462 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
463 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
464 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
465 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
466 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
467 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
468 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
469 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
470 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
471 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
472 stringsAsFactors = FALSE)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
473 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
474 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
475 CtHistory = X.hist)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
476 out
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
477 }
2
6cd22b1fbf6d planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 18d030f0c2e423a04617a3827ba5a652c8d7867a
davidecangelosi
parents: 0
diff changeset
478
0
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
479
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
480 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
481 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
482 switch(format,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
483 "EDS"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
484 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
485 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
486 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
487 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
488 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
489 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
490 "plain"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
491 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
492 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
493 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
494 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
495 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
496 "SDS"={
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(feature=3, Ct=6, flag=11)
e5953805ad7a planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 7d54176ff26ed5f4411edb0582a3704dd90253c0
davidecangelosi
parents: 7
diff changeset
498 #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
499 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
500 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
501 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
502 raw<- readCtDataDav(files = files$sampleName, format="SDS",column.info=columns, path = path, sample.info=phenoData, n.features=as.numeric(nfeatures))
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
503 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
504 "LightCycler"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
505 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
506 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
507 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
508 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
509 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
510 "CFX"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
511 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
512 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
513 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
514 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
515 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
516 "OpenArray"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
517 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
518 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
519 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
520 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
521 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
522 "BioMark"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
523 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
524 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
525 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
526 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
527 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
528 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
529 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
530 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
531
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
532 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
533 ####################################################################################################################
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
534 #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
535 switch(format,
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
536 "EDS"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
537 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
538 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
539 "plain"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
540 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
541 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
542 "SDS"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
543 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
544 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
545 "LightCycler"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
546 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
547 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
548 "CFX"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
549 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
550 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
551 "OpenArray"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
552 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
553 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
554 "BioMark"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
555 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
556 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
557 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
558 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
559 #unreliable<-setCategory(raw, Ct.max=dcCtmax, Ct.min=dcCtmin,replicates=FALSE, flag=dcflag, flag.out="Y", quantile=NULL)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
560
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
561 ####################################################################################################################
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
562 #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
563 xFilter <- filterCategory(unreliable)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
564
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
565 cat("\n Categorization completed! ")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
566
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)
12
11393eb1c557 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d1be332a7da0e53b3e6451f0aeda0675f190dd64
davidecangelosi
parents: 10
diff changeset
572 par(mar = c(8, 8,8, 8))
11393eb1c557 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d1be332a7da0e53b3e6451f0aeda0675f190dd64
davidecangelosi
parents: 10
diff changeset
573 plotCtBoxes(xFilter, cex.lab=3, cex.axis = 2,stratify=NULL, xlab = "Samples", ylab="Ct", 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) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
697 xx <- subset(x, x<=Ct.max)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
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) {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
713 xx <- subset(x, x <= Ct.max)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
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))
12
11393eb1c557 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d1be332a7da0e53b3e6451f0aeda0675f190dd64
davidecangelosi
parents: 10
diff changeset
798 par(mar = c(8, 8,8, 8)) # Set the margin on all sides to 8
11393eb1c557 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d1be332a7da0e53b3e6451f0aeda0675f190dd64
davidecangelosi
parents: 10
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)
12
11393eb1c557 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d1be332a7da0e53b3e6451f0aeda0675f190dd64
davidecangelosi
parents: 10
diff changeset
814 par(mar = c(8, 8,8, 8))
11393eb1c557 planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit d1be332a7da0e53b3e6451f0aeda0675f190dd64
davidecangelosi
parents: 10
diff changeset
815 plotCtBoxes(normalizedDataset, cex.lab=3, cex.axis = 2,stratify=NULL, xlab = "Samples", ylab="DeltaCt", 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 "mean"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
856 exprs(qFiltNAs)<-impute(exprs(qFiltNAs),mean)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
857 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
858 "median"={
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
859 exprs(qFiltNAs)<-impute(exprs(qFiltNAs),median)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
860 },
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
861 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
862 )
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
863
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
864 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
865 }else{
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
866 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
867 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
868
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
869 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
870
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
871 if (DEAMethod=="ttest") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
872 #Differential expression analysis (paired t test+BH). Returns Fold change in linear scale.
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
873 DEG<-ttestCtData(qFiltNAs, groups = files$Treatment, alternative = alternative, paired = ifelse(paired=="TRUE", TRUE, FALSE), replicates =ifelse(replicates=="TRUE", TRUE, FALSE), sort=ifelse(sort=="TRUE", TRUE, FALSE), stringent=ifelse(stringent=="TRUE", TRUE, FALSE), p.adjust=padjust)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
874 write.table(DEG, file=outputDEA, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
875 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
876 if (DEAMethod=="rp") {
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
877 DEG<-RP(exprs(qFiltNAs), as.numeric(pData(qFiltNAs)$Treatment)-1, num.perm = 1000,logged = TRUE, gene.names = featureNames(qFiltNAs), huge=TRUE, plot = FALSE, rand = 123)
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
878 write.table(DEG[1:5], file=outputDEA, quote=FALSE, row.names=TRUE, col.names=TRUE,sep = "\t")
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
879 }
185ba61836ab planemo upload for repository https://github.com/igg-molecular-biology-lab/pipe-t.git commit 04049039da97e1c9a8048e732afca48f2741cadf
davidecangelosi
parents:
diff changeset
880 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
881 cat("\n Workflow ended correctly! \n")