# HG changeset patch
# User cmonjeau
# Date 1441892301 0
# Node ID d085f995d556999b9fead81196cd2bf7b1c42e21
# Parent 1478d48df8c7287dcb72b7853feb760552b1ec2b
remove prepare_commet and change/add packages
diff -r 1478d48df8c7 -r d085f995d556 commet.py
--- a/commet.py Thu Sep 10 09:59:53 2015 +0000
+++ b/commet.py Thu Sep 10 13:38:21 2015 +0000
@@ -1,6 +1,6 @@
#!/usr/bin/env python
import sys, tempfile, subprocess, glob
-import os, re, shutil, optparse
+import os, re, shutil, argparse
import zipfile, tarfile, gzip
from os.path import basename
@@ -13,7 +13,7 @@
http://github.com/pierrepeterlongo/commet
-or with the galaxy_commet package in the GenOuest toolshed (coming soon)
+or with the package_commet package in the GenOuest toolshed and the main toolshed
NOTE :
@@ -25,69 +25,51 @@
def __main__():
# arguments recuperation
- parser = optparse.OptionParser()
- parser.add_option("--input", dest="input")
- parser.add_option("-k", dest="kmer")
- parser.add_option("-t", dest="minsharedkmer")
- parser.add_option("-l", dest="minlengthread")
- parser.add_option("-n", dest="maxn")
- parser.add_option("-e", dest="minshannonindex")
- parser.add_option("-m", dest="maxreads")
+ parser = argparse.ArgumentParser()
+
+ parser.add_argument("--set", dest="set", action='append')
+ parser.add_argument("-k", dest="kmer")
+ parser.add_argument("-t", dest="minsharedkmer")
+ parser.add_argument("-l", dest="minlengthread")
+ parser.add_argument("-n", dest="maxn")
+ parser.add_argument("-e", dest="minshannonindex")
+ parser.add_argument("-m", dest="maxreads")
- parser.add_option("--output")
- parser.add_option("--output_vectors")
- parser.add_option("--output_dendro")
- parser.add_option("--output_logs")
- parser.add_option("--output_matrix")
- parser.add_option("--output_heatmap1")
- parser.add_option("--output_heatmap2")
- parser.add_option("--output_heatmap3")
+ parser.add_argument("--output")
+ parser.add_argument("--output_vectors")
+ parser.add_argument("--output_dendro")
+ parser.add_argument("--output_matrix")
+ parser.add_argument("--output_heatmap1")
+ parser.add_argument("--output_heatmap2")
+ parser.add_argument("--output_heatmap3")
- (options, args) = parser.parse_args()
-
+ options = parser.parse_args()
# copy R script into the current dir
shutil.copy(os.environ['RSCRIPTS']+"/heatmap.r", os.getcwd())
shutil.copy(os.environ['RSCRIPTS']+"/dendro.R", os.getcwd())
- # remove the first line of the input file
- commet_file = open(options.input, "r")
- commet_file_clean = open("commet_clean_file", "w")
-
- # delete the first line
- commet_file.readline()
- for line in commet_file:
- commet_file_clean.write(line)
-
- # close files
- commet_file.close()
- commet_file_clean.close()
+ # prepare input file
+ commet_file=open('commet_config_file', 'w')
+
+ for set in options.set:
+ clean_set=set.replace(',', ';').replace('::', ':')
+ commet_file.write(clean_set+"\n")
+ commet_file.close()
# edit the command line
cmd_line=[]
cmd_line.append("Commet.py")
- cmd_line.extend(["commet_clean_file","-b",os.environ['BINARIES'],"-k",options.kmer,"-t",options.minsharedkmer,"-l",options.minlengthread,"-e",options.minshannonindex])
+ cmd_line.extend(["commet_config_file","-b",os.environ['BINARIES'],"-k",options.kmer,"-t",options.minsharedkmer,"-l",options.minlengthread,"-e",options.minshannonindex])
# add options
if options.maxn:
-
- #cmd_line += ' -n '+options.maxn+' -m '+options.maxreads+' > '+options.output+' 2>>'+options.output
cmd_line.extend(["-n",options.maxn,"-m",options.maxreads])
- #else:
- #cmd_line += ' > '+options.output+' 2>>'+options.output
# execute job
- p=subprocess.Popen(cmd_line,
- stdout=subprocess.PIPE,stderr=subprocess.PIPE)
-
- stdoutput, stderror = p.communicate()
+ p=subprocess.call(cmd_line)
- # log file
- logfile=open(options.output, "w")
- logfile.write("[COMMAND LINE]"+' '.join(cmd_line)+"\n\n")
- logfile.write(str(stdoutput))
- logfile.write(str(stderror))
- logfile.close()
+ print "[COMMAND LINE]"+' '.join(cmd_line)
# copy .bv files inside a .bv archive
tmp_output_dir=os.getcwd()+"/output_commet/"
@@ -120,10 +102,13 @@
shutil.move(tmp_output_dir+'matrix.zip.temp', options.output_matrix)
# outputs
- shutil.move(tmp_output_dir+'dendrogram_normalized.png', options.output_dendro)
- shutil.move(tmp_output_dir+'heatmap_normalized.png', options.output_heatmap1)
- shutil.move(tmp_output_dir+'heatmap_percentage.png', options.output_heatmap2)
- shutil.move(tmp_output_dir+'heatmap_plain.png', options.output_heatmap3)
+ try:
+ shutil.move(tmp_output_dir+'dendrogram_normalized.png', options.output_dendro)
+ shutil.move(tmp_output_dir+'heatmap_percentage.png', options.output_heatmap2)
+ shutil.move(tmp_output_dir+'heatmap_normalized.png', options.output_heatmap1)
+ shutil.move(tmp_output_dir+'heatmap_plain.png', options.output_heatmap3)
+ except:
+ print "There is a problem with gplots execution"
if __name__ == "__main__": __main__()
diff -r 1478d48df8c7 -r d085f995d556 commet.xml
--- a/commet.xml Thu Sep 10 09:59:53 2015 +0000
+++ b/commet.xml Thu Sep 10 13:38:21 2015 +0000
@@ -2,12 +2,13 @@
COmpare Multiple METagenomes
commet
- R
- ggplot2
+ R
commet.py
---input $input
+#for $set in $sets
+ --set ${set.setname}::${set.reads}
+#end for
-k $kmer
-t $minsharedkmer
-l $minlengthread
@@ -19,7 +20,6 @@
--output $output
--output_vectors $output_vectors
--output_dendro $output_dendro
---output_logs $output_logs
--output_matrix $output_matrix
--output_heatmap1 $output_heatmap1
--output_heatmap2 $output_heatmap2
@@ -28,7 +28,10 @@
-
+
+
+
+
@@ -44,9 +47,7 @@
-
-
@@ -55,6 +56,9 @@
+
+
+
**Description**
diff -r 1478d48df8c7 -r d085f995d556 repository_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/repository_dependencies.xml Thu Sep 10 13:38:21 2015 +0000
@@ -0,0 +1,4 @@
+
+
+
+
diff -r 1478d48df8c7 -r d085f995d556 tool_dependencies.xml
--- a/tool_dependencies.xml Thu Sep 10 09:59:53 2015 +0000
+++ b/tool_dependencies.xml Thu Sep 10 13:38:21 2015 +0000
@@ -3,11 +3,7 @@
-
-
+
+
-
-
-
-