comparison goseq.r @ 19:9442d1bf6d93 draft default tip

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/goseq_1_22_0 commit fdd0811efc61c31f88ff17096fbe8ee8cfacd766-dirty
author mvdbeek
date Fri, 26 Feb 2016 13:26:56 -0500
parents 5fb82111ec62
children
comparison
equal deleted inserted replaced
18:5fb82111ec62 19:9442d1bf6d93
11 make_option(c("-sw","--sample_vs_wallenius_plot"), type="character", default=FALSE, help="Path to plot comparing sampling with wallenius p-values."), 11 make_option(c("-sw","--sample_vs_wallenius_plot"), type="character", default=FALSE, help="Path to plot comparing sampling with wallenius p-values."),
12 make_option(c("-padj", "--p_adj_column"), type="integer",help="Column that contains p. adjust values"), 12 make_option(c("-padj", "--p_adj_column"), type="integer",help="Column that contains p. adjust values"),
13 make_option(c("-c", "--cutoff"), type="double",dest="p_adj_cutoff", 13 make_option(c("-c", "--cutoff"), type="double",dest="p_adj_cutoff",
14 help="Genes with p.adjust below cutoff are considered not differentially expressed and serve as control genes"), 14 help="Genes with p.adjust below cutoff are considered not differentially expressed and serve as control genes"),
15 make_option(c("-r", "--repcnt"), type="integer", default=100, help="Number of repeats for sampling"), 15 make_option(c("-r", "--repcnt"), type="integer", default=100, help="Number of repeats for sampling"),
16 make_option(c("-lf", "--length_file"), default=FALSE, help = "Path to "), 16 make_option(c("-lf", "--length_file"), type="character", default="FALSE", help = "Path to tabular file mapping gene id to length"),
17 make_option(c("-g", "--genome"), type="character", help = "Genome [used for looking up correct gene length]"), 17 make_option(c("-g", "--genome"), type="character", help = "Genome [used for looking up correct gene length]"),
18 make_option(c("-i", "--gene_id"), type="character", help="Gene ID of gene column in DGE file") 18 make_option(c("-i", "--gene_id"), type="character", help="Gene ID of gene column in DGE file")
19 ) 19 )
20 parser <- OptionParser(usage = "%prog [options] file", option_list=option_list) 20 parser <- OptionParser(usage = "%prog [options] file", option_list=option_list)
21 args = parse_args(parser) 21 args = parse_args(parser)
38 dge_table = read.delim(dge_file, header = TRUE, sep="\t", check.names = FALSE) 38 dge_table = read.delim(dge_file, header = TRUE, sep="\t", check.names = FALSE)
39 genes = as.integer(dge_table[,p_adj_column]<p_adj_cutoff) 39 genes = as.integer(dge_table[,p_adj_column]<p_adj_cutoff)
40 names(genes) = dge_table[,1] # Assuming first row contains gene names 40 names(genes) = dge_table[,1] # Assuming first row contains gene names
41 41
42 # Get gene lengths 42 # Get gene lengths
43 if (length_file !=FALSE) { 43 if (length_file != "FALSE" ) {
44 length_table = read.delim(length_file, header=TRUE, sep="\t", check.names=FALSE, row.names=TRUE) 44 length_table = read.delim(length_file, header=TRUE, sep="\t", check.names=FALSE)
45 row.names(length_table) = length_table[,1]
45 gene_lengths = length_table[names(genes),]$length 46 gene_lengths = length_table[names(genes),]$length
46 } else { 47 } else {
47 gene_lengths = getlength(names(genes), genome, gene_id) 48 gene_lengths = getlength(names(genes), genome, gene_id)
48 } 49 }
49 50