|
| 1 | +process THERMORAWFILEPARSER { |
| 2 | + tag "$meta.mzml_id" |
| 3 | + label 'process_low' |
| 4 | + label 'process_single' |
| 5 | + label 'error_retry' |
| 6 | + |
| 7 | + conda "${moduleDir}/environment.yml" |
| 8 | + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? |
| 9 | + 'https://depot.galaxyproject.org/singularity/thermorawfileparser:1.4.5--h05cac1d_1' : |
| 10 | + 'biocontainers/thermorawfileparser:1.4.5--h05cac1d_1' }" |
| 11 | + |
| 12 | + stageInMode { |
| 13 | + if (task.attempt == 1) { |
| 14 | + if (task.executor == "awsbatch") { |
| 15 | + 'symlink' |
| 16 | + } else { |
| 17 | + 'link' |
| 18 | + } |
| 19 | + } else if (task.attempt == 2) { |
| 20 | + if (task.executor == "awsbatch") { |
| 21 | + 'copy' |
| 22 | + } else { |
| 23 | + 'symlink' |
| 24 | + } |
| 25 | + } else { |
| 26 | + 'copy' |
| 27 | + } |
| 28 | + } |
| 29 | + input: |
| 30 | + tuple val(meta), path(rawfile) |
| 31 | + |
| 32 | + output: |
| 33 | + tuple val(meta), path("*.{mzML,mgf,parquet}"), emit: convert_files |
| 34 | + path "versions.yml", emit: versions |
| 35 | + path "*.log", emit: log |
| 36 | + |
| 37 | + script: |
| 38 | + def args = task.ext.args ?: '' |
| 39 | + // Default to indexed mzML format (-f=2) if not specified in args |
| 40 | + def formatArg = args.contains('-f=') ? '' : '-f=2' |
| 41 | + |
| 42 | + """ |
| 43 | + ThermoRawFileParser.sh -i='${rawfile}' ${formatArg} ${args} -o=./ 2>&1 | tee '${rawfile.baseName}_conversion.log' |
| 44 | +
|
| 45 | + cat <<-END_VERSIONS > versions.yml |
| 46 | + "${task.process}": |
| 47 | + ThermoRawFileParser: \$(ThermoRawFileParser.sh --version) |
| 48 | + END_VERSIONS |
| 49 | + """ |
| 50 | + |
| 51 | + stub: |
| 52 | + def prefix = task.ext.prefix ?: "${meta.mzml_id}" |
| 53 | + def args = task.ext.args ?: '' |
| 54 | + // Determine output format from args, default to mzML |
| 55 | + // Format 0 = MGF, formats 1-2 = mzML, format 3 = Parquet, format 4 = None |
| 56 | + def outputExt = (args =~ /-f=0\b/).find() ? 'mgf' : 'mzML' |
| 57 | + |
| 58 | + """ |
| 59 | + touch '${prefix}.${outputExt}' |
| 60 | + touch '${prefix}_conversion.log' |
| 61 | +
|
| 62 | + cat <<-END_VERSIONS > versions.yml |
| 63 | + "${task.process}": |
| 64 | + ThermoRawFileParser: \$(ThermoRawFileParser.sh --version) |
| 65 | + END_VERSIONS |
| 66 | + """ |
| 67 | +} |
0 commit comments