comparison peca.R @ 11:19bb06146c2e draft

planemo upload for repository https://github.com/caleb-easterly/galaxytools/peca
author caleb-easterly
date Thu, 08 Mar 2018 18:27:44 -0500
parents e16cd77cf9f7
children
comparison
equal deleted inserted replaced
10:f0de83932f9e 11:19bb06146c2e
12 args <- commandArgs(trailingOnly = TRUE) 12 args <- commandArgs(trailingOnly = TRUE)
13 13
14 # read first argument, which is quant file (proteins in rows, samples in columns) 14 # read first argument, which is quant file (proteins in rows, samples in columns)
15 quant_file <- read.delim(args[1], 15 quant_file <- read.delim(args[1],
16 na.strings = c("0", "NA"), 16 na.strings = c("0", "NA"),
17 sep = '\t') 17 sep = '\t',
18 stringsAsFactors=FALSE)
18 19
19 # read 2nd and 3rd argument, which are path to files with group 1 and 2 column indices 20 # read 2nd and 3rd argument, which are path to files with group 1 and 2 column indices
20 group1_ind_file <- as.vector(as.matrix(read.csv(args[2], header = FALSE)[1, ])) 21 group1_ind_file <- as.vector(as.matrix(read.csv(args[2], header = FALSE)[1, ]))
21 group2_ind_file <- as.vector(as.matrix(read.csv(args[3], header = FALSE)[1, ])) 22 group2_ind_file <- as.vector(as.matrix(read.csv(args[3], header = FALSE)[1, ]))
22 23
23 # test type 24 # test type
24 ttype <- args[4] 25 ttype <- args[4]
25 26
26 # read 4th argument, which is output file name 27 # paired or not
27 out_file <- args[5] 28 pair <- args[5] == "true"
29
30 # output file name
31 out_file <- args[6]
28 32
29 # get vectors of column names 33 # get vectors of column names
30 df_names <- colnames(quant_file) 34 df_names <- colnames(quant_file)
31 group1_names <- df_names[group1_ind_file] 35 group1_names <- df_names[group1_ind_file]
32 group2_names <- df_names[group2_ind_file] 36 group2_names <- df_names[group2_ind_file]
33 37
34 # run PECA_df 38 # run PECA_df
35 # id column is first column (hard-coded) 39 # id column is first column (hard-coded)
36 results <- PECA_df(quant_file, 40 results <- PECA_df(df = quant_file,
37 group1_names, 41 samplenames1 = group1_names,
38 group2_names, 42 samplenames2 = group2_names,
43 test = ttype,
44 paired = pair,
39 id = df_names[1]) 45 id = df_names[1])
40 46
41 # put add protein names column 47 # put add protein names column
42 results$prot <- row.names(results) 48 results$prot <- row.names(results)
43 results <- results[, c("prot", "slr", "t", "score", "n", "p", "p.fdr")] 49 results <- results[, c("prot", "slr", "t", "score", "n", "p", "p.fdr")]