annotate destinations_input_type.py @ 28:378ddb410225 draft

planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
author workflow4metabolomics
date Fri, 26 Jul 2019 10:26:24 -0400
parents b62808a2a008
children
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 import logging
28
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
2
12
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
3
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 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
6 '''
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
7
28
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
8
12
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 '''
28
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
11 This function checks the input file format/extension and decide which
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
12 destination in the job_conf.xml using
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
13 - If it's a zip file, we will launch the job in multi-thread mode
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
14 (-pe thread 8)
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
15 - If it's an individual file (mzxml, mzml, mzdata or netcdf),
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
16 the job will use for instance (-pe thread 1)
12
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
17 '''
15646e937936 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents:
diff changeset
18 log = logging.getLogger(__name__)
28
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
19 indata = dict([(da.name, da.dataset) for da in job.input_datasets])
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
20 indata.update([(da.name, da.dataset) for da in job.input_library_datasets])
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
21 input_extension = indata["input"].extension
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
22 if 'input' in indata:
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
23 input_extension = indata["input"].extension
14
363cce459fff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
lecorguille
parents: 13
diff changeset
24 log.debug("The input extension is %s" % input_extension)
28
378ddb410225 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4dc5751176d47d41fa1dec33eb443e335a1a316f
workflow4metabolomics
parents: 15
diff changeset
25 if input_extension in ["mzxml", "mzml", "mzdata", "netcdf"]:
14
363cce459fff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
lecorguille
parents: 13
diff changeset
26 return 'thread1-mem_free8'
363cce459fff planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 73791d74546087b2a872d9279df960f5bc207298
lecorguille
parents: 13
diff changeset
27 # zip file
15
b62808a2a008 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 14
diff changeset
28 return 'thread8-mem_free16'