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
22- // Algorithm selection: ascore (default), phosphors , or lucxor
23- def algorithm = params. onsite_algorithm ?: ' ascore '
25+ // Algorithm selection: lucxor (default), ascore , or phosphors
26+ def algorithm = params. onsite_algorithm ?: ' lucxor '
2427
2528 // Common parameters for all algorithms
2629 def fragment_tolerance = params. onsite_fragment_tolerance ?: ' 0.05'
30+ def compute_all_scores = params. onsite_compute_all_scores ? ' --compute-all-scores' : ' '
2731
2832 // Set default value for add_decoys (can be overridden by setting params.onsite_add_decoys = false)
2933 def onsite_add_decoys = params. containsKey(' onsite_add_decoys' ) ? params. onsite_add_decoys : true
@@ -39,32 +43,31 @@ process ONSITE {
3943 if (algorithm == ' ascore' ) {
4044 // AScore: uses -in, -id, -out, --fragment-mass-unit
4145 fragment_unit = params. onsite_fragment_unit ?: ' Da'
46+ def optional_flags = [add_decoys, compute_all_scores, debug]. findAll { a -> a }. join(' \\\n ' )
4247 algorithm_cmd = """
4348 onsite ascore \\
4449 -in ${ mzml_file} \\
4550 -id ${ id_file} \\
46- -out ${ id_file.baseName } _ascore.idXML \\
51+ -out ${ prefix } _ascore.idXML \\
4752 --fragment-mass-tolerance ${ fragment_tolerance} \\
48- --fragment-mass-unit ${ fragment_unit} \\
49- ${ add_decoys} \\
50- ${ debug} \\
51- ${ args}
53+ --fragment-mass-unit ${ fragment_unit}${ optional_flags ? ' \\\n ' + optional_flags : ''}
5254 """
53- } else if (algorithm == ' phosphors' ) {
55+ }
56+ else if (algorithm == ' phosphors' ) {
5457 // PhosphoRS: uses -in, -id, -out, --fragment-mass-unit
5558 fragment_unit = params. onsite_fragment_unit ?: ' Da'
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} \\
62- --fragment-mass-unit ${ fragment_unit} \\
63- ${ add_decoys} \\
64- ${ debug} \\
66+ --fragment-mass-unit ${ fragment_unit}${ optional_flags ? ' \\\n ' + optional_flags : ''}
6567 ${ args}
6668 """
67- } else if (algorithm == ' lucxor' ) {
69+ }
70+ else if (algorithm == ' lucxor' ) {
6871 // LucXor: uses -in, -id, -out, --fragment-error-units (note: error-units not mass-unit)
6972 fragment_unit = params. onsite_fragment_error_units ?: ' Da'
7073 def fragment_method = params. onsite_fragment_method ?: ' CID'
@@ -74,20 +77,22 @@ process ONSITE {
7477 def max_num_perm = params. onsite_max_num_perm ?: ' 16384'
7578 def modeling_threshold = params. onsite_modeling_score_threshold ?: ' 0.95'
7679 def scoring_threshold = params. onsite_scoring_threshold ?: ' 0.0'
77- def min_num_psms = params. onsite_min_num_psms_model ?: ' 50 '
80+ def min_num_psms = params. onsite_min_num_psms_model ?: ' 5 '
7881 def rt_tolerance = params. onsite_rt_tolerance ?: ' 0.01'
82+ def disable_split_by_charge = params. onsite_disable_split_by_charge ? ' --disable-split-by-charge' : ' '
7983
8084 // Optional target modifications - default for LucXor includes decoy
8185 def target_mods = params. onsite_target_modifications ? " --target-modifications ${ params.onsite_target_modifications} " : " --target-modifications 'Phospho(S),Phospho(T),Phospho(Y),PhosphoDecoy(A)'"
8286 def neutral_losses = params. onsite_neutral_losses ? " --neutral-losses ${ params.onsite_neutral_losses} " : " --neutral-losses 'sty -H3PO4 -97.97690'"
8387 def decoy_mass = params. onsite_decoy_mass ? " --decoy-mass ${ params.onsite_decoy_mass} " : " --decoy-mass 79.966331"
8488 def decoy_losses = params. onsite_decoy_neutral_losses ? " --decoy-neutral-losses ${ params.onsite_decoy_neutral_losses} " : " --decoy-neutral-losses 'X -H3PO4 -97.97690'"
8589
90+ def optional_flags = [disable_split_by_charge, compute_all_scores, debug]. findAll { a -> a }. join(' \\\n ' )
8691 algorithm_cmd = """
8792 onsite lucxor \\
8893 -in ${ mzml_file} \\
8994 -id ${ id_file} \\
90- -out ${ id_file.baseName } _lucxor.idXML \\
95+ -out ${ prefix } _lucxor.idXML \\
9196 --fragment-method ${ fragment_method} \\
9297 --fragment-mass-tolerance ${ fragment_tolerance} \\
9398 --fragment-error-units ${ fragment_unit} \\
@@ -102,21 +107,19 @@ process ONSITE {
102107 --modeling-score-threshold ${ modeling_threshold} \\
103108 --scoring-threshold ${ scoring_threshold} \\
104109 --min-num-psms-model ${ min_num_psms} \\
105- --rt-tolerance ${ rt_tolerance} \\
106- ${ debug} \\
107- ${ args}
110+ --rt-tolerance ${ rt_tolerance}${ optional_flags ? ' \\\n ' + optional_flags : ''}
108111 """
109- } else {
110- error " Unknown onsite algorithm: ${ algorithm} . Supported algorithms: ascore, phosphors, lucxor"
112+ }
113+ else {
114+ error(" Unknown onsite algorithm: ${ algorithm} . Supported algorithms: ascore, phosphors, lucxor" )
111115 }
112116
113117 """
114- ${ algorithm_cmd} \\
115- 2>&1 | tee ${ id_file.baseName} _${ algorithm} .log
118+ ${ algorithm_cmd.trim()} 2>&1 | tee ${ prefix} _${ algorithm} .log
116119
117120 cat <<-END_VERSIONS > versions.yml
118121 "${ task.process} ":
119- 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")
120123 algorithm: ${ algorithm}
121124 END_VERSIONS
122125 """
0 commit comments