Exemplo n.º 1
0
def main(args=None):
    if which('git') is None:
        print('Error: git was not found. Quit')
        return
    if which('mvn') is None:
        print('Error: mvn was not found. Quit')
        return
    git_retrieve('https://github.com/pdp10/simqueue.git')
    compile_simqueue()
    print('cleanup!')
    rmtree(os.path.join('.', 'simqueue'), ignore_errors=True)
Exemplo n.º 2
0
def run_copasi_model(infile):
    """
    Run a Copasi model

    :param infile: the input file
    """
    command = which("CopasiSE") + " " + infile
    run_cmd(command)
Exemplo n.º 3
0
    def __init__(self):
        __doc__ = Simul.__init__.__doc__

        Simul.__init__(self)
        self._copasi_not_found_msg = "CopasiSE not found! Please check that CopasiSE is installed and in the PATH " \
            "environmental variable."
        self._copasi = which("CopasiSE")
        if self._copasi is None:
            logger.error(self._copasi_not_found_msg)
Exemplo n.º 4
0
def run_generic_model(infile):
    """
    Run a generic model

    :param infile: the input file
    """
    command = which("python") + " " + infile + \
              " " + os.path.basename(infile)[:-4] + ".csv"
    run_cmd(command)
Exemplo n.º 5
0
 def setUpClass(cls):
     sbpipe_snake_folder = 'sbpipe_snake'
     orig_wd = os.getcwd()
     os.chdir('snakemake')
     if which('git') is None and os.path.isdir(sbpipe_snake_folder):
         cls._output = 'git was not found. SKIP snakemake tests'
         return
     print('retrieving Snakemake workflows for SBpipe')
     git_retrieve('https://github.com/pdp10/sbpipe_snake.git')
     source = os.listdir(sbpipe_snake_folder)
     destination = os.getcwd()
     for f in source:
         if f.endswith('.snake'):
             shutil.move(os.path.join(os.path.abspath(sbpipe_snake_folder), f),
                         os.path.join(destination, f))
     shutil.rmtree(sbpipe_snake_folder)
     os.chdir(orig_wd)
Exemplo n.º 6
0
 def __init__(self,
              lang=None,
              lang_err_msg="No programming language is set!",
              options=""):
     """
     A constructor for a simulator of models coded in a programming language
     :param lang: the programming language name (e.g. python, Copasi)
     :param lang_err_msg: the message to print if lang is not found.
     :param options: the options to use when invoking the command (e.g. "" for python).
     """
     __doc__ = Simul.__init__.__doc__
     Simul.__init__(self)
     self._language = which(lang)
     self._language_not_found_msg = lang_err_msg
     self._options = options
     logger.debug("Invoking simulator " + self._language +
                  " with options " + self._options)
     if self._language is None:
         logger.error(self._language_not_found_msg)
Exemplo n.º 7
0
def pdf_report(outputdir, filename):
    """
    Generate a PDF report from LaTeX report using pdflatex.
    
    :param outputdir: the output directory
    :param filename: the LaTeX file name
    """
    pdflatex = which("pdflatex")
    if pdflatex is None:
        logger.error(
            "pdflatex not found! pdflatex must be installed for pdf reports.")
        return
    currdir = os.getcwd()
    os.chdir(outputdir)
    logger.info(filename.replace('tex', 'pdf'))
    logger.debug(pdflatex + " -halt-on-error " + filename)
    # We suppress the output of pdflatex completely
    try:
        from subprocess import DEVNULL  # python3
    except ImportError:
        DEVNULL = open(os.devnull, 'wb')

    if sys.version_info > (3, ):
        with subprocess.Popen([pdflatex, "-halt-on-error", filename],
                              stdout=DEVNULL,
                              stderr=subprocess.STDOUT) as p:
            p.communicate()[0]
        with subprocess.Popen([pdflatex, "-halt-on-error", filename],
                              stdout=DEVNULL,
                              stderr=subprocess.STDOUT) as p:
            p.communicate()[0]
    else:
        p = subprocess.Popen([pdflatex, "-halt-on-error", filename],
                             stdout=DEVNULL,
                             stderr=subprocess.STDOUT)
        p = subprocess.Popen([pdflatex, "-halt-on-error", filename],
                             stdout=DEVNULL,
                             stderr=subprocess.STDOUT)
        p.communicate()[0]
    os.chdir(currdir)