diff 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
line wrap: on
line diff
--- a/goseq.r	Fri Feb 26 11:42:43 2016 -0500
+++ b/goseq.r	Fri Feb 26 13:26:56 2016 -0500
@@ -13,7 +13,7 @@
     make_option(c("-c", "--cutoff"), type="double",dest="p_adj_cutoff",
                 help="Genes with p.adjust below cutoff are considered not differentially expressed and serve as control genes"),
     make_option(c("-r", "--repcnt"), type="integer", default=100, help="Number of repeats for sampling"),
-    make_option(c("-lf", "--length_file"), default=FALSE, help = "Path to "),
+    make_option(c("-lf", "--length_file"), type="character", default="FALSE", help = "Path to tabular file mapping gene id to length"),
     make_option(c("-g", "--genome"), type="character", help = "Genome [used for looking up correct gene length]"),
     make_option(c("-i", "--gene_id"), type="character", help="Gene ID of gene column in DGE file")
   )
@@ -40,8 +40,9 @@
 names(genes) = dge_table[,1] # Assuming first row contains gene names
 
 # Get gene lengths
-if (length_file !=FALSE) {
-  length_table = read.delim(length_file, header=TRUE, sep="\t", check.names=FALSE, row.names=TRUE)
+if (length_file != "FALSE" ) {
+  length_table = read.delim(length_file, header=TRUE, sep="\t", check.names=FALSE)
+  row.names(length_table) = length_table[,1]
   gene_lengths = length_table[names(genes),]$length
   } else {
   gene_lengths = getlength(names(genes), genome, gene_id)