rbbt-marq 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ CustomDS.process <- function(prefix, cross_platform, conditions, description, tw
12
12
  names = vector();
13
13
  for (file in conditions) {
14
14
  filename = paste(prefix,file,sep="/");
15
- values = scan(file=filename, what=character(), sep = "\n");
15
+ values = scan(file=filename, what=character(), sep = "\n", quiet=T);
16
16
  names = c(names, file);
17
17
  conditions.list = cbind(conditions.list, values);
18
18
  }
@@ -46,31 +46,14 @@ CustomDS.process <- function(prefix, cross_platform, conditions, description, tw
46
46
 
47
47
  values <- MA.process(m, conditions.list, two.channel);
48
48
 
49
- ratios = as.data.frame(values$ratios);
50
- t = as.data.frame(values$t);
51
- p.values = as.data.frame(values$p.values);
52
-
53
-
54
- # Calculate orders from best information
55
- best = vector();
56
- names = vector();
57
- for (name in colnames(ratios)){
58
- if (sum(colnames(t) == name) > 0){
59
- best = cbind(best, t[,name]);
60
- names = c(names, name);
61
- }else{
62
- best = cbind(best, ratios[,name]);
63
- names = c(names, paste(name,'[ratio]', sep=" "));
64
- }
65
- }
66
- rownames(best) <- rownames(ratios);
67
- orders = as.data.frame(MA.get_order(best));
68
- colnames(orders) <- names;
69
-
70
-
71
- if (is.null(values)){
49
+ if (length(values$ratios) == 0){
72
50
  write(file=paste(prefix,'skip',sep="."), "no suitable samples for analysis" );
73
51
  }else{
52
+ ratios = as.data.frame(values$ratios);
53
+ t = as.data.frame(values$t);
54
+ p.values = as.data.frame(values$p.values);
55
+ orders = as.data.frame(values$orders);
56
+
74
57
  MA.save(prefix, orders, ratios, t, p.values, colnames(orders), description);
75
58
  }
76
59
  },
data/R/GEO.R CHANGED
@@ -20,8 +20,6 @@ GEO.get <- function(name, cachedir = NULL){
20
20
  object <- getGEO(name, filename = complete_path);
21
21
  }
22
22
  }
23
-
24
-
25
23
  object
26
24
  }
27
25
 
@@ -184,30 +182,12 @@ GEO.values <- function(data){
184
182
  ratios = as.data.frame(values$ratios);
185
183
  t = as.data.frame(values$t);
186
184
  p.values = as.data.frame(values$p.values);
187
-
188
-
189
- # Calculate orders from best information
190
- best = vector();
191
- names = vector();
192
- for (name in colnames(ratios)){
193
- if (sum(colnames(t) == name) > 0){
194
- best = cbind(best, t[,name]);
195
- names = c(names, name);
196
- }else{
197
- best = cbind(best, ratios[,name]);
198
- names = c(names, paste(name,'[ratio]', sep=" "));
199
- }
200
- }
201
- rownames(best) <- rownames(ratios)
202
- orders = as.data.frame(MA.get_order(best));
203
- colnames(orders) <- names
185
+ orders = as.data.frame(values$orders);
204
186
 
205
187
  return(list(ratios = ratios, t = t, p.values = p.values, orders = orders));
206
188
  }
207
189
  }
208
190
 
209
-
210
-
211
191
  GEO.GDS.process <- function(name, prefix, id.field = NULL, translation.file = NULL,cachedir=NULL){
212
192
  tryCatch(
213
193
  {
data/R/MA.R CHANGED
@@ -5,20 +5,19 @@ MA.get_order <- function(values){
5
5
  orders[,] = NA;
6
6
 
7
7
  for (i in 1:dim(values)[2]){
8
- positions = names(sort(values[,i],decreasing=T))
9
-
10
- orders[,i] = NA
8
+ positions = names(sort(values[,i],decreasing=T,na.last=NA));
9
+ orders[,i] = NA;
11
10
  orders[positions,i] = 1:length(positions)
12
11
  }
13
12
  orders
14
13
  }
15
14
 
16
15
  MA.guess.do.log2 <- function(m, two.channel){
17
- if (two.channel){
18
- return (sum(m < 0, na.rm = TRUE) == 0);
19
- }else{
20
- return (max(m, na.rm = TRUE) > 100);
21
- }
16
+ if (two.channel){
17
+ return (sum(m < 0, na.rm = TRUE) == 0);
18
+ }else{
19
+ return (max(m, na.rm = TRUE) > 100);
20
+ }
22
21
  }
23
22
 
24
23
  MA.translate <- function(m, trans){
@@ -27,17 +26,16 @@ MA.translate <- function(m, trans){
27
26
 
28
27
  missing = length(trans) - dim(m)[1];
29
28
 
30
- # If extra genes
29
+ # If extra genes
31
30
  if (missing < 0){
32
- trans = c(trans,rep(NA, - missing))
33
- missing = 0;
31
+ trans = c(trans,rep(NA, - missing));
32
+ missing = 0;
34
33
  }
35
34
  n = apply(m,2,function(x){
36
-
37
- # Complete data with missing genes
38
- x.complete = c(x,rep(NA, missing));
39
- tapply(x.complete, factor(trans), median)
40
- });
35
+ # Complete data with missing genes
36
+ x.complete = c(x,rep(NA, missing));
37
+ tapply(x.complete, factor(trans), median)
38
+ });
41
39
  n[sort(rownames(n),index.return=T)$ix,]
42
40
  }
43
41
 
@@ -46,10 +44,10 @@ MA.translate <- function(m, trans){
46
44
  MA.conditions.has_control <- function(x){
47
45
  keywords = c('none', 'control', 'normal', 'wild', 'baseline', 'untreat', 'uninfected', 'universal', 'reference', 'vehicle', 'w.t.','wt');
48
46
  for(keyword in keywords){
49
- control = grep(keyword, x, ignore.case = TRUE);
50
- if (any(control)){
51
- return(x[control[1]]);
52
- }
47
+ control = grep(keyword, x, ignore.case = TRUE);
48
+ if (any(control)){
49
+ return(x[control[1]]);
50
+ }
53
51
  }
54
52
  return(NULL)
55
53
  }
@@ -60,18 +58,18 @@ MA.condition.values <- function(values){
60
58
  values.factor = factor(values);
61
59
  values.levels = levels(values.factor);
62
60
 
63
- # If there is a control state remove it from sorting
61
+ # If there is a control state remove it from sorting
64
62
  if (!is.null(control))
65
63
  values.levels = values.levels[values.levels != control];
66
64
 
67
-
68
- # Use numeric sort if they all have numbers
65
+
66
+ # Use numeric sort if they all have numbers
69
67
  if (length(grep('^ *[0-9]+',values.levels,perl=TRUE)) == length(values.levels)){
70
68
  ix = sort(as.numeric(sub('^ *([0-9]+).*',"\\1",values.levels)), decreasing = T, index.return = TRUE)$ix
71
69
  }else{
72
70
  ix = sort(values.levels, decreasing = T, index.return = TRUE)$ix
73
71
  }
74
-
72
+
75
73
  return(list(values = values.levels[ix], control = control));
76
74
  }
77
75
 
@@ -98,7 +96,7 @@ MA.ratio.contrast <- function(m, conditions, main, contrast){
98
96
  if (!is.null(dim(contrast))){
99
97
  contrast = apply(contrast, 1 ,function(x){mean(x, na.rm = TRUE)});
100
98
  }
101
-
99
+
102
100
  return (main - contrast);
103
101
  }
104
102
 
@@ -106,173 +104,204 @@ MA.ratio.contrast <- function(m, conditions, main, contrast){
106
104
  # Limma
107
105
 
108
106
  MA.limma.two_channel <- function(m, conditions, main){
109
- if (sum(conditions == main) < 3){
107
+ if (sum(conditions == main) < 3){
108
+ return(NULL);
109
+ }
110
+
111
+ design = rep(0,dim(m)[2]);
112
+ design[conditions == main] = 1;
113
+
114
+ # We need to subset the columns because of a problem with NA values. This
115
+ # might affect eBayes variance estimations, thats my guess anyway...
116
+
117
+ fit <- lmFit(m[,design == 1],rep(1, sum(design)));
118
+
119
+ tryCatch({
120
+ fit <- eBayes(fit);
121
+ sign = fit$t < 0;
122
+ sign[is.na(sign)] = FALSE;
123
+ fit$p.value[sign] = - fit$p.value[sign];
124
+ return(list(t= fit$t, p.values= fit$p.value));
125
+ }, error=function(x){
126
+ print("Exception caught in eBayes");
127
+ print(x);
128
+ })
129
+
110
130
  return(NULL);
111
- }
112
-
113
- design = rep(0,dim(m)[2]);
114
- design[conditions == main] = 1;
115
-
116
- # We need to subset the columns because of a problem with NA values. This
117
- # might affect eBayes variance estimations, thats my guess anyway...
118
-
119
- fit <- lmFit(m[,design == 1],rep(1, sum(design)));
120
-
121
- tryCatch({
122
- fit <- eBayes(fit);
123
- sign = fit$t < 0;
124
- sign[is.na(sign)] = FALSE;
125
- fit$p.value[sign] = - fit$p.value[sign];
126
- return(list(t= fit$t, p.values= fit$p.value));
127
- }, error=function(x){
128
- print("Exception caught in eBayes");
129
- print(x);
130
- })
131
-
132
- return(NULL);
133
131
  }
134
132
 
135
133
  MA.limma.contrast <- function(m, conditions, main, contrast){
136
- if (sum(conditions == main) + sum(conditions == contrast) < 3){
134
+ if (sum(conditions == main) + sum(conditions == contrast) < 3){
135
+ return(NULL);
136
+ }
137
+ m = cbind(m[,conditions == main],m[,conditions == contrast]);
138
+
139
+ design = cbind(rep(1,dim(m)[2]), rep(0,dim(m)[2]));
140
+ colnames(design) <-c('intercept', 'main');
141
+ design[1:sum(conditions==main),2] = 1;
142
+
143
+
144
+ fit <- lmFit(m,design);
145
+ tryCatch({
146
+ fit <- eBayes(fit);
147
+ sign = fit$t[,2] < 0;
148
+ sign[is.na(sign)] = FALSE;
149
+ fit$p.value[sign,2] = - fit$p.value[sign,2]
150
+ return(list(t= fit$t[,2], p.values= fit$p.value[,2] ));
151
+ }, error=function(x){
152
+ print("Exception caught in eBayes");
153
+ print(x);
154
+ })
155
+
137
156
  return(NULL);
138
- }
139
- m = cbind(m[,conditions == main],m[,conditions == contrast])
140
-
141
- design = cbind(rep(1,dim(m)[2]), rep(0,dim(m)[2]));
142
- colnames(design) <-c('intercept', 'main');
143
- design[1:sum(conditions==main),2] = 1;
144
-
145
-
146
- fit <- lmFit(m,design);
147
- tryCatch({
148
- fit <- eBayes(fit);
149
- sign = fit$t[,2] < 0;
150
- sign[is.na(sign)] = FALSE;
151
- fit$p.value[sign,2] = - fit$p.value[sign,2]
152
- return(list(t= fit$t[,2], p.values= fit$p.value[,2] ));
153
- }, error=function(x){
154
- print("Exception caught in eBayes");
155
- print(x);
156
- })
157
-
158
- return(NULL);
159
157
  }
160
158
 
161
159
 
162
160
  #########################################################################
163
161
  # Process conditions
164
162
 
163
+ MA.strip_blanks <- function(text){
164
+ text = sub(' *$', '' ,text);
165
+ text = sub('^ *', '' ,text);
166
+
167
+ return(text);
168
+ }
169
+
170
+ MA.orders <- function(ratios, t){
171
+ best = vector();
172
+ names = vector();
173
+ for (name in colnames(ratios)){
174
+ if (sum(colnames(t) == name) > 0){
175
+ best = cbind(best, t[,name]);
176
+ names = c(names, name);
177
+ }else{
178
+ best = cbind(best, ratios[,name]);
179
+ names = c(names, paste(name,'[ratio]', sep=" "));
180
+ }
181
+ }
182
+ rownames(best) <- rownames(ratios);
183
+ orders <- as.data.frame(MA.get_order(best));
184
+ colnames(orders) <- names;
185
+
186
+ return(orders);
187
+ }
188
+
165
189
  MA.process_conditions.contrasts <- function(m, conditions, two.channel){
166
- max_levels = 10;
167
- max_levels_control = 1;
168
-
169
-
170
- values = MA.condition.values(conditions);
171
-
172
-
173
- ratios = vector();
174
- t = vector();
175
- p.values = vector();
176
-
177
- ratio_names = vector();
178
- t_names = vector();
179
-
180
- if (!is.null(values$control)){
181
- contrast = values$control;
182
- for (main in values$values){
183
- name = paste(main, contrast, sep = " <=> ")
184
-
185
- ratio = MA.ratio.contrast(m, conditions, main, contrast);
186
- ratio_names = c(ratio_names, name);
187
- ratios = cbind(ratios, ratio);
188
-
189
- res = MA.limma.contrast(m, conditions, main, contrast);
190
- if (!is.null(res)){
191
- t_names = c(t_names, name);
192
- t = cbind(t, res$t);
193
- p.values = cbind(p.values, res$p.values);
194
- }
195
- }
196
- }
197
-
198
-
199
- if (length(values$values) <= max_levels_control || (is.null(values$control) && !two.channel && length(values$values) <= max_levels )){
200
-
201
- remaining = values$values;
202
- for (main in values$values){
203
- remaining = remaining[remaining != main];
204
- for (contrast in remaining){
205
- name = paste(main, contrast, sep = " <=> ");
206
-
207
- ratio = MA.ratio.contrast(m, conditions, main, contrast);
208
- ratio_names = c(ratio_names, name);
209
- ratios = cbind(ratios, ratio);
210
-
211
- res = MA.limma.contrast(m, conditions, main, contrast);
212
- if (!is.null(res)){
213
- t_names = c(t_names, name);
214
- t = cbind(t, res$t);
215
- p.values = cbind(p.values, res$p.values);
216
- }
217
- }
218
- }
219
- }
220
-
221
-
222
- if (length(ratio_names) != 0){
223
- colnames(ratios) <- ratio_names
224
- }
225
-
226
- if (length(t_names) != 0){
227
- colnames(t) <- t_names
228
- colnames(p.values) <- t_names
229
- }
230
-
231
- return(list(ratios = ratios, t=t, p.values = p.values));
190
+ max_levels = 10;
191
+ max_levels_control = 1;
192
+
193
+
194
+ values = MA.condition.values(conditions);
195
+
196
+
197
+ ratios = vector();
198
+ t = vector();
199
+ p.values = vector();
200
+
201
+ ratio_names = vector();
202
+ t_names = vector();
203
+
204
+ if (!is.null(values$control)){
205
+ contrast = values$control;
206
+ for (main in values$values){
207
+ name = paste(main, contrast, sep = " <=> ")
208
+
209
+ ratio = MA.ratio.contrast(m, conditions, main, contrast);
210
+ ratio_names = c(ratio_names, name);
211
+ ratios = cbind(ratios, ratio);
212
+
213
+ res = MA.limma.contrast(m, conditions, main, contrast);
214
+ if (!is.null(res)){
215
+ t_names = c(t_names, name);
216
+ t = cbind(t, res$t);
217
+ p.values = cbind(p.values, res$p.values);
218
+ }
219
+ }
220
+ }
221
+
222
+
223
+ if (length(values$values) <= max_levels_control || (is.null(values$control) && !two.channel && length(values$values) <= max_levels )){
224
+
225
+ remaining = values$values;
226
+ for (main in values$values){
227
+ remaining = remaining[remaining != main];
228
+ for (contrast in remaining){
229
+ name = paste(main, contrast, sep = " <=> ");
230
+
231
+ ratio = MA.ratio.contrast(m, conditions, main, contrast);
232
+ ratio_names = c(ratio_names, name);
233
+ ratios = cbind(ratios, ratio);
234
+
235
+ res = MA.limma.contrast(m, conditions, main, contrast);
236
+ if (!is.null(res)){
237
+ t_names = c(t_names, name);
238
+ t = cbind(t, res$t);
239
+ p.values = cbind(p.values, res$p.values);
240
+ }
241
+ }
242
+ }
243
+ }
244
+
245
+
246
+ if (length(ratio_names) != 0){
247
+ ratio_names = as.vector(sapply(ratio_names, MA.strip_blanks));
248
+ colnames(ratios) <- ratio_names
249
+ }
250
+
251
+ if (length(t_names) != 0){
252
+ t_names = as.vector(sapply(t_names, MA.strip_blanks));
253
+ colnames(t) <- t_names;
254
+ colnames(p.values) <- t_names;
255
+ }
256
+
257
+
258
+ return(list(ratios = ratios, t=t, p.values = p.values));
232
259
  }
233
260
 
234
261
  MA.process_conditions.two_channel <- function(m, conditions){
235
- values = MA.condition.values(conditions);
262
+ values = MA.condition.values(conditions);
263
+
264
+ all_values = values$values;
265
+ if (!is.null(values$control)){
266
+ all_values = c(all_values, values$control);
267
+ }
236
268
 
237
- all_values = values$values
238
- if (!is.null(values$control)){
239
- all_values = c(all_values, values$control);
240
- }
241
-
242
269
 
243
- ratios = vector();
244
- t = vector();
245
- p.values = vector();
270
+ ratios = vector();
271
+ t = vector();
272
+ p.values = vector();
246
273
 
247
- ratio_names = vector();
248
- t_names = vector();
274
+ ratio_names = vector();
275
+ t_names = vector();
249
276
 
250
277
 
251
- for (main in all_values){
252
- name = main;
278
+ for (main in all_values){
279
+ name = main;
253
280
 
254
- ratio = MA.ratio.two_channel(m, conditions, main);
255
- ratio_names = c(ratio_names, name);
256
- ratios = cbind(ratios, ratio);
281
+ ratio = MA.ratio.two_channel(m, conditions, main);
282
+ ratio_names = c(ratio_names, name);
283
+ ratios = cbind(ratios, ratio);
257
284
 
258
- res = MA.limma.two_channel(m, conditions, main);
259
- if (!is.null(res)){
260
- t_names = c(t_names, name);
261
- t = cbind(t, res$t);
262
- p.values = cbind(p.values, res$p.values);
263
- }
264
- }
285
+ res = MA.limma.two_channel(m, conditions, main);
286
+ if (!is.null(res)){
287
+ t_names = c(t_names, name);
288
+ t = cbind(t, res$t);
289
+ p.values = cbind(p.values, res$p.values);
290
+ }
291
+ }
265
292
 
266
- if (length(ratio_names) != 0){
267
- colnames(ratios) <- ratio_names
268
- }
293
+ if (length(ratio_names) != 0){
294
+ ratio_names = as.vector(sapply(ratio_names, MA.strip_blanks));
295
+ colnames(ratios) <- ratio_names
296
+ }
269
297
 
270
- if (length(t_names) != 0){
271
- colnames(t) <- t_names
272
- colnames(p.values) <- t_names
273
- }
298
+ if (length(t_names) != 0){
299
+ t_names = as.vector(sapply(t_names, MA.strip_blanks));
300
+ colnames(t) <- t_names;
301
+ colnames(p.values) <- t_names;
302
+ }
274
303
 
275
- return(list(ratios = ratios, t=t, p.values = p.values));
304
+ return(list(ratios = ratios, t=t, p.values = p.values));
276
305
  }
277
306
 
278
307
 
@@ -280,35 +309,36 @@ MA.process_conditions.two_channel <- function(m, conditions){
280
309
  # Process microarray matrix
281
310
 
282
311
  MA.process <- function(m, conditions_list, two.channel = FALSE){
283
-
284
- ratios = vector();
285
- t = vector();
286
- p.values = vector();
287
-
288
- for(type in colnames(conditions_list)){
289
- conditions = conditions_list[,type]
290
-
291
- if (two.channel){
292
- res = MA.process_conditions.two_channel(m, conditions);
293
- if (length(res$ratios) != 0){ colnames(res$ratios) <- sapply(colnames(res$ratios),function(x){paste(type,x,sep=": ")}); ratios = cbind(ratios,res$ratios);}
294
- if (length(res$t) != 0){ colnames(res$t) <- sapply(colnames(res$t),function(x){paste(type,x,sep=": ")}); t = cbind(t,res$t);}
295
- if (length(res$p.values) != 0){ colnames(res$p.values) <- sapply(colnames(res$p.values),function(x){paste(type,x,sep=": ")}); p.values = cbind(p.values,res$p.values);}
296
- }
297
-
298
- res = MA.process_conditions.contrasts(m, conditions, two.channel);
299
- if (length(res$ratios) != 0){ colnames(res$ratios) <- sapply(colnames(res$ratios),function(x){paste(type,x,sep=": ")}); ratios = cbind(ratios,res$ratios);}
300
- if (length(res$t) != 0){ colnames(res$t) <- sapply(colnames(res$t),function(x){paste(type,x,sep=": ")}); t = cbind(t,res$t);}
301
- if (length(res$p.values) != 0){ colnames(res$p.values) <- sapply(colnames(res$p.values),function(x){paste(type,x,sep=": ")}); p.values = cbind(p.values,res$p.values);}
302
- }
303
-
304
- return(list(ratios = ratios, t=t, p.values = p.values));
312
+
313
+ ratios = vector();
314
+ t = vector();
315
+ p.values = vector();
316
+
317
+ for(type in colnames(conditions_list)){
318
+ conditions = conditions_list[,type]
319
+
320
+ if (two.channel){
321
+ res = MA.process_conditions.two_channel(m, conditions);
322
+ if (length(res$ratios) != 0){ colnames(res$ratios) <- sapply(colnames(res$ratios),function(x){paste(type,x,sep=": ")}); ratios = cbind(ratios,res$ratios);}
323
+ if (length(res$t) != 0){ colnames(res$t) <- sapply(colnames(res$t),function(x){paste(type,x,sep=": ")}); t = cbind(t,res$t);}
324
+ if (length(res$p.values) != 0){ colnames(res$p.values) <- sapply(colnames(res$p.values),function(x){paste(type,x,sep=": ")}); p.values = cbind(p.values,res$p.values);}
325
+ }
326
+
327
+ res = MA.process_conditions.contrasts(m, conditions, two.channel);
328
+ if (length(res$ratios) != 0){ colnames(res$ratios) <- sapply(colnames(res$ratios),function(x){paste(type,x,sep=": ")}); ratios = cbind(ratios,res$ratios);}
329
+ if (length(res$t) != 0){ colnames(res$t) <- sapply(colnames(res$t),function(x){paste(type,x,sep=": ")}); t = cbind(t,res$t);}
330
+ if (length(res$p.values) != 0){ colnames(res$p.values) <- sapply(colnames(res$p.values),function(x){paste(type,x,sep=": ")}); p.values = cbind(p.values,res$p.values);}
331
+ }
332
+
333
+ orders <- MA.orders(ratios,t);
334
+ return(list(ratios = ratios, t=t, p.values = p.values, orders=orders));
305
335
  }
306
336
 
307
337
 
308
338
  MA.save <- function(prefix, orders, ratios, t , p.values, experiments, description = NULL) {
309
339
  if (is.null(orders)){
310
340
  cat("No suitable samples for analysis\n")
311
- write(file=paste(prefix,'skip',sep="."), "No suitable samples for analysis" );
341
+ write(file=paste(prefix,'skip',sep="."), "No suitable samples for analysis" );
312
342
  } else {
313
343
  write.table(file=paste(prefix,'orders',sep="."), orders, sep="\t", row.names=F, col.names=F, quote=F);
314
344
  write.table(file=paste(prefix,'codes',sep="."), rownames(orders), sep="\t", row.names=F, col.names=F, quote=F);
@@ -322,39 +352,39 @@ MA.save <- function(prefix, orders, ratios, t , p.values, experiments, descripti
322
352
  }
323
353
 
324
354
  MA.load <- function(prefix, orders = TRUE, logratios = TRUE, t = TRUE, p.values = TRUE){
325
- data = list();
326
- genes <- scan(file=paste(prefix,'codes',sep="."),sep="\n",quiet=T,what=character());
327
- experiments <- scan(file=paste(prefix,'experiments',sep="."),sep="\n",quiet=T,what=character());
328
-
329
- experiments.no.ratio = experiments[- grep('ratio', experiments)];
330
-
331
- if (orders){
332
- orders <- read.table(file=paste(prefix,'orders',sep="."),sep="\t");
333
- rownames(orders) <- genes;
334
- colnames(orders) <- experiments;
335
- data$orders=orders;
336
- }
337
- if (logratios){
338
- logratios <- read.table(file=paste(prefix,'logratios',sep="."),sep="\t");
339
- rownames(logratios) <- genes;
340
- colnames(logratios) <- experiments;
341
- data$logratios=logratios;
342
- }
343
- if (t){
344
- t <- read.table(file=paste(prefix,'t',sep="."),sep="\t");
345
- rownames(t) <- genes;
346
- colnames(t) <- experiments.no.ratio;
347
- data$t=t;
348
- }
349
- if (p.values){
350
- p.values <- read.table(file=paste(prefix,'pvalues',sep="."),sep="\t");
351
- rownames(p.values) <- genes;
352
- colnames(p.values) <- experiments.no.ratio;
353
- data$p.values=p.values;
354
- }
355
-
356
-
357
- return(data);
355
+ data = list();
356
+ genes <- scan(file=paste(prefix,'codes',sep="."),sep="\n",quiet=T,what=character());
357
+ experiments <- scan(file=paste(prefix,'experiments',sep="."),sep="\n",quiet=T,what=character());
358
+
359
+ experiments.no.ratio = experiments[- grep('ratio', experiments)];
360
+
361
+ if (orders){
362
+ orders <- read.table(file=paste(prefix,'orders',sep="."),sep="\t");
363
+ rownames(orders) <- genes;
364
+ colnames(orders) <- experiments;
365
+ data$orders=orders;
366
+ }
367
+ if (logratios){
368
+ logratios <- read.table(file=paste(prefix,'logratios',sep="."),sep="\t");
369
+ rownames(logratios) <- genes;
370
+ colnames(logratios) <- experiments;
371
+ data$logratios=logratios;
372
+ }
373
+ if (t){
374
+ t <- read.table(file=paste(prefix,'t',sep="."),sep="\t");
375
+ rownames(t) <- genes;
376
+ colnames(t) <- experiments.no.ratio;
377
+ data$t=t;
378
+ }
379
+ if (p.values){
380
+ p.values <- read.table(file=paste(prefix,'pvalues',sep="."),sep="\t");
381
+ rownames(p.values) <- genes;
382
+ colnames(p.values) <- experiments.no.ratio;
383
+ data$p.values=p.values;
384
+ }
385
+
386
+
387
+ return(data);
358
388
 
359
389
 
360
390
  }