annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
1 from galaxy.jobs import JobDestination
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
2 import logging
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
3 import os
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
4
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
5 '''
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
6 This file must be placed in lib/galaxy/jobs/rules/
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
7 '''
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
8
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
9 def input_type(job):
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
10 '''
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
11 This function checks the input file format/extension and decide which destination in the job_conf.xml using
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
12 - If it's a zip file, we will launch the job in multi-thread mode (-pe thread 8)
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
13 - If it's an individual file (mzxml, mzml, mzdata or netcdf), the job will use for instance (-pe thread 1)
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
14 '''
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
15 log = logging.getLogger(__name__)
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
16 inp_data = dict( [ ( da.name, da.dataset ) for da in job.input_datasets ] )
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
17 inp_data.update( [ ( da.name, da.dataset ) for da in job.input_library_datasets ] )
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
18 input_extension = inp_data[ "input" ].extension
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
19 log.debug("The input extension is %s" % input_extension)
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
20 if input_extension in ["mzxml","mzml","mzdata","netcdf"]:
13
c934dd5c49a9 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4897a06ef248e2e74e57a496dd68adbda3c828f1
lecorguille
parents: 12
diff changeset
21 return 'thread1-mem_free10'
12
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
22 else: # zip file
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
23 return 'thread4-men_free10'