Mercurial > repos > crs4 > edge_pro
changeset 1:f77ce4f92b46 draft
Use $GALAXY_SLOTS instead of $EDGE_PRO_SITE_OPTIONS. Add dependency on bowtie2. Add readme.rst .
author | crs4 |
---|---|
date | Fri, 31 Jan 2014 05:44:03 -0500 |
parents | 7af33315bc5e |
children | bad8a51514dd |
files | COPYING edge_pro.py edge_pro.xml get_edge_data.py readme.rst tool_dependencies.xml |
diffstat | 6 files changed, 64 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYING Mon Sep 09 06:11:47 2013 -0400 +++ b/COPYING Fri Jan 31 05:44:03 2014 -0500 @@ -1,4 +1,4 @@ -Copyright © 2012-2013 CRS4 Srl. http://www.crs4.it/ +Copyright © 2012-2014 CRS4 Srl. http://www.crs4.it/ Created by: Paolo Uva <paolo.uva@crs4.it> Nicola Soranzo <nicola.soranzo@crs4.it>
--- a/edge_pro.py Mon Sep 09 06:11:47 2013 -0400 +++ b/edge_pro.py Fri Jan 31 05:44:03 2014 -0500 @@ -37,55 +37,25 @@ (options, args) = parser.parse_args() if len(args) > 0: parser.error('Wrong number of arguments') - + # Build command - if options.input2: - input2_flag = '-v %s' % (options.input2) - else: - input2_flag = '' - if options.num_threads is not None: - num_threads_flag = '-t %d' % options.num_threads - else: - num_threads_flag = '' - if options.minInsertSize is not None: - minInsertSize_flag = '-m %d' % options.minInsertSize - else: - minInsertSize_flag = '' - if options.maxInsertSize is not None: - maxInsertSize_flag = '-M %d' % options.maxInsertSize - else: - maxInsertSize_flag = '' - if options.window is not None: - window_flag = '-w %d' % options.window - else: - window_flag = '' - if options.utrSize is not None: - utrSize_flag = '-i %d' % options.utrSize - else: - utrSize_flag = '' - if options.similarity is not None: - similarity_flag = '-x %s' % options.similarity - else: - similarity_flag = '' - if options.readLength is not None: - readLength_flag = '-l %d' % (options.readLength) - else: - readLength_flag = '' - if options.minCoverage is not None: - minCoverage_flag = '-c %d' % options.minCoverage - else: - minCoverage_flag = '' - + input2_flag = '-v %s' % (options.input2) if options.input2 else '' + num_threads_flag = '-t %d' % options.num_threads if options.num_threads is not None else '' + minInsertSize_flag = '-m %d' % options.minInsertSize if options.minInsertSize is not None else '' + maxInsertSize_flag = '-M %d' % options.maxInsertSize if options.maxInsertSize is not None else '' + window_flag = '-w %d' % options.window if options.window is not None else '' + utrSize_flag = '-i %d' % options.utrSize if options.utrSize is not None else '' + similarity_flag = '-x %s' % options.similarity if options.similarity is not None else '' + readLength_flag = '-l %d' % (options.readLength) if options.readLength is not None else '' + minCoverage_flag = '-c %d' % options.minCoverage if options.minCoverage is not None else '' + wd = tempfile.mkdtemp() try: prefix = os.path.join(wd, 'out') cl = 'edge.pl -g %s -p %s -r %s -u %s -o %s %s %s %s %s %s %s %s %s %s' % (options.genome, options.ptt, options.rnt, options.input1, prefix, input2_flag, num_threads_flag, minInsertSize_flag, maxInsertSize_flag, window_flag, utrSize_flag, similarity_flag, readLength_flag, minCoverage_flag) - print cl - - if options.out_log: - sout = open(options.out_log, 'w') - else: - sout = sys.stdout + print "EDGE-pro command to be executed:\n %s" % (cl) + + sout = open(options.out_log, 'w') if options.out_log else sys.stdout try: subprocess.check_call(cl, stdout=sout, stderr=subprocess.STDOUT, shell=True) # need to redirect stderr because edge.pl calls bowtie2 and count which write some logging info there finally:
--- a/edge_pro.xml Mon Sep 09 06:11:47 2013 -0400 +++ b/edge_pro.xml Fri Jan 31 05:44:03 2014 -0500 @@ -1,11 +1,12 @@ <tool id="edge_pro" name="EDGE-pro" version="1.0.0"> <description>Gene expression in Prokaryotes</description> <requirements> + <requirement type="package" version="2.1.0">bowtie2</requirement> <requirement type="package" version="1.3.1">edge-pro</requirement> </requirements> <command interpreter="python"> edge_pro.py - \${EDGE_PRO_SITE_OPTIONS:---num-threads=4} + --num-threads=\${GALAXY_SLOTS:-4} ## Mandatory input parameters --genome $genome
--- a/get_edge_data.py Mon Sep 09 06:11:47 2013 -0400 +++ b/get_edge_data.py Fri Jan 31 05:44:03 2014 -0500 @@ -4,7 +4,7 @@ import optparse import sys -class GetData: +class GetData(object): def __init__(self, gbkid, fnafile, pttfile, rntfile, gfffile): self.gbkid = gbkid @@ -14,9 +14,6 @@ self.gfffile = gfffile self.ftpurl = 'ftp.ncbi.nlm.nih.gov' self.folder = '/genomes/Bacteria/' - - def getData(self): - """ """ strainName = self._getStrainName() print strainName if not strainName: @@ -25,7 +22,7 @@ ftp.login() newDir = self.folder + strainName ftp.cwd(newDir) - + directoryFiles = [] ftp.retrlines('NLST', directoryFiles.append) for fileName in directoryFiles: @@ -58,7 +55,7 @@ ftp = FTP(self.ftpurl) ftp.login() ftp.cwd(self.folder) - + straindirectories = [] ftp.retrlines("NLST " , straindirectories.append) #print "scanning directories..." @@ -77,7 +74,6 @@ def __main__(): - """ main function """ parser = optparse.OptionParser() parser.add_option('-i', dest='gbkid', help='RefSeq Genomic Accession ID') parser.add_option('--fna', dest='fnafile', help='Output FASTA file name') @@ -87,9 +83,8 @@ (options, args) = parser.parse_args() if len(args) > 0: parser.error('Wrong number of arguments') - - S = GetData(options.gbkid, options.fnafile, options.pttfile, options.rntfile, options.gfffile) - S.getData() + + GetData(options.gbkid, options.fnafile, options.pttfile, options.rntfile, options.gfffile) if __name__ == "__main__":
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/readme.rst Fri Jan 31 05:44:03 2014 -0500 @@ -0,0 +1,35 @@ +EDGE-pro wrapper +================ + +Dependencies of EDGE-pro which need to be installed separetely +-------------------------------------------------------------- + +- Switch_ Perl module. + +.. _Switch: http://search.cpan.org/~rgarcia/Switch/Switch.pm + +Configuration +------------- + +EDGE-pro tool may be configured to use more than one CPU core by selecting an appropriate destination for this tool in Galaxy job_conf.xml file (see http://wiki.galaxyproject.org/Admin/Config/Jobs and http://wiki.galaxyproject.org/Admin/Config/Performance/Cluster ). + +If you are using Galaxy release_2013.11.04 or later, this tool will automatically use the number of CPU cores allocated by the job runner according to the configuration of the destination selected for this tool. + +If instead you are using an older Galaxy release, you should also add a line + + GALAXY_SLOTS=N; export GALAXY_SLOTS + +(where N is the number of CPU cores allocated by the job runner for this tool) to the file + + <tool_dependencies_dir>/edge-pro/1.3.1/crs4/edge_pro/<hash_string>/env.sh + +Version history +--------------- + +- Release 1: Use $GALAXY_SLOTS instead of $EDGE_PRO_SITE_OPTIONS. Add dependency on bowtie2. Add readme.rst . +- Release 0: Initial release in the Tool Shed. + +Development +----------- + +Development is hosted at https://bitbucket.org/crs4/orione-tools . Contributions and bug reports are very welcome!
--- a/tool_dependencies.xml Mon Sep 09 06:11:47 2013 -0400 +++ b/tool_dependencies.xml Fri Jan 31 05:44:03 2014 -0500 @@ -1,5 +1,8 @@ <?xml version="1.0"?> <tool_dependency> + <package name="bowtie2" version="2.1.0"> + <repository changeset_revision="017a00c265f1" name="package_bowtie2_2_1_0" owner="devteam" toolshed="http://toolshed.g2.bx.psu.edu" /> + </package> <package name="edge-pro" version="1.3.1"> <install version="1.0"> <actions> @@ -14,14 +17,15 @@ <destination>$INSTALL_DIR/bin</destination> </action> <action type="set_environment"> - <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable> + <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR/bin</environment_variable> </action> </actions> </install> <readme> Dependencies of EDGE-pro which needs to be installed separately: -- bowtie2 ( http://bowtie-bio.sourceforge.net/bowtie2/ ), in particular bowtie2, bowtie2-align and bowtie2-build need to be in the $PATH . These are usually already installed for Galaxy; -- Switch Perl core module ( http://search.cpan.org/~rgarcia/Switch/Switch.pm ). +- Switch Perl module ( http://search.cpan.org/~rgarcia/Switch/Switch.pm ). + +Configuration: Previously (until Release 0), the EDGE_PRO_SITE_OPTIONS variable in the installed env.sh file was used to adjust the number of threads to use (--num-threads). This is not used anymore and may be removed. </readme> </package> </tool_dependency>