11process ONSITE {
2- tag " $meta . mzml_id "
2+ tag " ${ meta.id } "
33 label ' process_medium'
44 label ' onsite'
55
6- container " ${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
7- 'https://depot.galaxyproject.org/singularity/pyonsite:0.0.2--pyhdfd78af_0' :
8- 'quay.io/ biocontainers/pyonsite:0.0.2--pyhdfd78af_0' } "
6+ container " ${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
7+ ? 'https://depot.galaxyproject.org/singularity/pyonsite:0.0.2--pyhdfd78af_0'
8+ : ' biocontainers/pyonsite:0.0.2--pyhdfd78af_0'} "
99
1010 input:
1111 tuple val(meta), path(mzml_file), path(id_file)
1212
1313 output:
14- tuple val(meta), path(" ${ id_file.baseName } _*.idXML" ), emit: ptm_in_id_onsite
14+ tuple val(meta), path(" ${ prefix } _*.idXML" ), emit: ptm_in_id_onsite
1515 path " versions.yml" , emit: versions
1616 path " *.log" , emit: log
1717
18+ when:
19+ task. ext. when == null || task. ext. when
20+
1821 script:
1922 def args = task. ext. args ?: ' '
20- def prefix = task. ext. prefix ?: " ${ meta.mzml_id } "
23+ prefix = task. ext. prefix ?: " ${ meta.id } "
2124
2225 // Algorithm selection: lucxor (default), ascore, or phosphors
2326 def algorithm = params. onsite_algorithm ?: ' lucxor'
@@ -40,28 +43,31 @@ process ONSITE {
4043 if (algorithm == ' ascore' ) {
4144 // AScore: uses -in, -id, -out, --fragment-mass-unit
4245 fragment_unit = params. onsite_fragment_unit ?: ' Da'
43- def optional_flags = [add_decoys, compute_all_scores, debug]. findAll { it }. join(' \\\n ' )
46+ def optional_flags = [add_decoys, compute_all_scores, debug]. findAll { a -> a }. join(' \\\n ' )
4447 algorithm_cmd = """
4548 onsite ascore \\
4649 -in ${ mzml_file} \\
4750 -id ${ id_file} \\
48- -out ${ id_file.baseName } _ascore.idXML \\
51+ -out ${ prefix } _ascore.idXML \\
4952 --fragment-mass-tolerance ${ fragment_tolerance} \\
5053 --fragment-mass-unit ${ fragment_unit}${ optional_flags ? ' \\\n ' + optional_flags : ''}
5154 """
52- } else if (algorithm == ' phosphors' ) {
55+ }
56+ else if (algorithm == ' phosphors' ) {
5357 // PhosphoRS: uses -in, -id, -out, --fragment-mass-unit
5458 fragment_unit = params. onsite_fragment_unit ?: ' Da'
55- def optional_flags = [add_decoys, compute_all_scores, debug]. findAll { it }. join(' \\\n ' )
59+ def optional_flags = [add_decoys, compute_all_scores, debug]. findAll { a -> a }. join(' \\\n ' )
5660 algorithm_cmd = """
5761 onsite phosphors \\
5862 -in ${ mzml_file} \\
5963 -id ${ id_file} \\
60- -out ${ id_file.baseName } _phosphors.idXML \\
64+ -out ${ prefix } _phosphors.idXML \\
6165 --fragment-mass-tolerance ${ fragment_tolerance} \\
6266 --fragment-mass-unit ${ fragment_unit}${ optional_flags ? ' \\\n ' + optional_flags : ''}
67+ ${ args}
6368 """
64- } else if (algorithm == ' lucxor' ) {
69+ }
70+ else if (algorithm == ' lucxor' ) {
6571 // LucXor: uses -in, -id, -out, --fragment-error-units (note: error-units not mass-unit)
6672 fragment_unit = params. onsite_fragment_error_units ?: ' Da'
6773 def fragment_method = params. onsite_fragment_method ?: ' CID'
@@ -81,12 +87,12 @@ process ONSITE {
8187 def decoy_mass = params. onsite_decoy_mass ? " --decoy-mass ${ params.onsite_decoy_mass} " : " --decoy-mass 79.966331"
8288 def decoy_losses = params. onsite_decoy_neutral_losses ? " --decoy-neutral-losses ${ params.onsite_decoy_neutral_losses} " : " --decoy-neutral-losses 'X -H3PO4 -97.97690'"
8389
84- def optional_flags = [disable_split_by_charge, compute_all_scores, debug]. findAll { it }. join(' \\\n ' )
90+ def optional_flags = [disable_split_by_charge, compute_all_scores, debug]. findAll { a -> a }. join(' \\\n ' )
8591 algorithm_cmd = """
8692 onsite lucxor \\
8793 -in ${ mzml_file} \\
8894 -id ${ id_file} \\
89- -out ${ id_file.baseName } _lucxor.idXML \\
95+ -out ${ prefix } _lucxor.idXML \\
9096 --fragment-method ${ fragment_method} \\
9197 --fragment-mass-tolerance ${ fragment_tolerance} \\
9298 --fragment-error-units ${ fragment_unit} \\
@@ -103,16 +109,17 @@ process ONSITE {
103109 --min-num-psms-model ${ min_num_psms} \\
104110 --rt-tolerance ${ rt_tolerance}${ optional_flags ? ' \\\n ' + optional_flags : ''}
105111 """
106- } else {
107- error " Unknown onsite algorithm: ${ algorithm} . Supported algorithms: ascore, phosphors, lucxor"
112+ }
113+ else {
114+ error(" Unknown onsite algorithm: ${ algorithm} . Supported algorithms: ascore, phosphors, lucxor" )
108115 }
109116
110117 """
111- ${ algorithm_cmd.trim()} 2>&1 | tee ${ id_file.baseName } _${ algorithm} .log
118+ ${ algorithm_cmd.trim()} 2>&1 | tee ${ prefix } _${ algorithm} .log
112119
113120 cat <<-END_VERSIONS > versions.yml
114121 "${ task.process} ":
115- onsite: \$ (onsite --version 2>&1 | grep -oP 'version \\ K[0-9.]+' || echo "unknown")
122+ onsite: \$ (onsite --version 2>&1 | grep -oE 'version \\ K[0-9.]+' || echo "unknown")
116123 algorithm: ${ algorithm}
117124 END_VERSIONS
118125 """
0 commit comments