Skip to content

Instantly share code, notes, and snippets.

@boegel
Created December 2, 2013 14:03
Show Gist options
  • Save boegel/7749904 to your computer and use it in GitHub Desktop.
Save boegel/7749904 to your computer and use it in GitHub Desktop.
$ cat qiime.py
import os, shutil
from easybuild.apps.Application import Application
from easybuild.apps.Precompiled import Tarball
from easybuild.apps.Toolbox import PythonModuleSeparate
from easybuild.apps.Compiler import CMake
from easybuild.buildsoft.fileTools import convertName, runrun, runqanda
from distutils.version import LooseVersion
# PythonPackage should do here (not verified)
class QIIME(PythonModuleSeparate):
def test(self):
if self.getCfg('testinstall'):
testinstalldir = os.path.join(self.builddir, "mytemporarytestinstalldir")
qiimeconfigfile = os.path.join(self.builddir, "qiime_config")
qiimeconfigtxt = "qiime_scripts_dir %s" % testinstalldir
try:
f = open(qiimeconfigfile, 'w')
f.write(qiimeconfigtxt)
f.close()
self.log.debug("Successfully created test qiime_config file at: %s" % qiimeconfigfile)
except Exception, err:
self.log.error("Failed to create test qiime_config file at: %s (%s)" % (qiimeconfigfile, err))
extraexport = "export QIIME_CONFIG_FP=%s && " % qiimeconfigfile
extrapath = ""
"""
Install in test directory and export PYTHONPATH
"""
try:
os.makedirs(testinstalldir)
except:
self.log.exception("Creating testinstalldir %s failed" % testinstalldir)
ppath = "%s/reallib" % testinstalldir
cmd = "python setup.py install --install-scripts=%s --install-purelib=%s %s" % (testinstalldir, ppath, self.getCfg('installopts'))
runrun(cmd, logall=True, simple=True)
if os.environ.has_key('PYTHONPATH'):
extrapath = "export PYTHONPATH=%s:%s && " % (ppath, os.environ['PYTHONPATH'])
else:
extrapath = "export PYTHONPATH=%s && " % ppath
if self.getCfg('runtest'):
cmd = "%s%s%s" % (extraexport, extrapath, self.getCfg('runtest'))
runrun(cmd, logall=True, simple=True)
def makeModuleExtra(self):
"""Overwritten from PythonModuleSeparate to add extra txt"""
txt = PythonModuleSeparate.makeModuleExtra(self)
scriptsdir = os.path.join(self.installdir, 'bin')
qiimeconfigfile = os.path.join(self.installdir, "qiime_config")
qiimeconfigtxt = "qiime_scripts_dir %s" % scriptsdir
try:
f = open(qiimeconfigfile, 'w')
f.write(qiimeconfigtxt)
f.close()
self.log.debug("Successfully created qiime_config file at: %s" % qiimeconfigfile)
except Exception, err:
self.log.error("Failed to create qiime_config file at: %s (%s)" % (qiimeconfigfile, err))
return txt + "prepend-path\tQIIME_CONFIG_FP\t\t%s\n" % qiimeconfigfile
@boegel
Copy link
Author

boegel commented Dec 2, 2013

easyconfig:

name='QIIME'
version='1.1.0'

homepage='http://qiime.sourceforge.net/'
description="QIIME (canonically pronounced 'Chime') is a pipeline for performing microbial community analysis that integrates many third party tools which have become standard in the field."

toolkit={'name':'gimkl','version':'0.5.1'}

toolkitopts={'pic':True,'opt':True,'optarch':True}

namesource=name[:1]+name[1:].lower()
sources=['%s-%s.tar.gz'%(namesource,version)]

dependencies=[['Python','2.7'],['PyNAST','1.1'],['UCLUST','1.1.579q_i86linux64','','dummy'],['BLAST','2.2.22-x64-linux','','dummy']]
dependencies+=[['FastTree','2.1.3','-omp'],['CD-HIT','2009-0427','-omp'],['Java','1.6.0_20','','dummy'],['RDP-Classifier','2.2','','dummy']]
dependencies+=[['Denoiser','0.851']]

importdeps='cogent, numpy, matplotlib, pynast'

testinstall=True
runtest="cd tests && python all_tests.py"

@JensTimmerman
Copy link

does this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment