annotate destinations_input_type.py @ 24:9a0ca3f3a847 draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 8ed93601e09e1db2fbaef5af29d58464b639f2a8
author lecorguille
date Tue, 09 Apr 2019 12:12:48 -0400
parents b62808a2a008
children 378ddb410225
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
14
363cce459fff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
lecorguille
parents: 13
diff changeset
19 if 'input' in inp_data:
363cce459fff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
lecorguille
parents: 13
diff changeset
20 input_extension = inp_data[ "input" ].extension
363cce459fff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
lecorguille
parents: 13
diff changeset
21 log.debug("The input extension is %s" % input_extension)
363cce459fff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
lecorguille
parents: 13
diff changeset
22 if input_extension in ["mzxml","mzml","mzdata","netcdf"]:
363cce459fff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
lecorguille
parents: 13
diff changeset
23 return 'thread1-mem_free8'
363cce459fff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
lecorguille
parents: 13
diff changeset
24 # zip file
15
b62808a2a008 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 14
diff changeset
25 return 'thread8-mem_free16'