view destinations_input_type.py @ 13:c934dd5c49a9 draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4897a06ef248e2e74e57a496dd68adbda3c828f1
author lecorguille
date Wed, 29 Nov 2017 09:45:19 -0500
parents 15646e937936
children 363cce459fff
line wrap: on
line source

from galaxy.jobs import JobDestination
import logging
import os

'''
This file must be placed in lib/galaxy/jobs/rules/
'''

def input_type(job):
    '''
    This function checks the input file format/extension and decide which destination in the job_conf.xml using
     - If it's a zip file, we will launch the job in multi-thread mode (-pe thread 8)
     - If it's an individual file (mzxml, mzml, mzdata or netcdf), the job will use for instance (-pe thread 1)
    '''
    log = logging.getLogger(__name__)
    inp_data = dict( [ ( da.name, da.dataset ) for da in job.input_datasets ] )
    inp_data.update( [ ( da.name, da.dataset ) for da in job.input_library_datasets ] )
    input_extension = inp_data[ "input" ].extension
    log.debug("The input extension is %s" % input_extension)
    if input_extension in ["mzxml","mzml","mzdata","netcdf"]:
        return 'thread1-mem_free10'
    else: # zip file
        return 'thread4-men_free10'