Skip to content

Commit

Permalink
Merge pull request #273 from jonasscheid/dev
Browse files Browse the repository at this point in the history
Optimize resource allocations
  • Loading branch information
steffenlem authored Jun 29, 2023
2 parents 0401fb4 + 49e8c37 commit 42d61d1
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added OpenMS FileFilter to clean mzml after parsing to remove artifacts like empty spectra or precursors with charge 0
- Made file extension check case insensitive
- Added option to provide a default comet parameters file
- Optimize resource allocations

### `Fixed`

Expand Down
13 changes: 7 additions & 6 deletions bin/ms2pip_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ def generate_params_config(
help="List of fixed modifications",
)
@click.option("--add_pearson", is_flag=True, help="add pearson spectrum simliartity")
@click.option(
"--num_cpus",
type=int,
help="number of cpus to use",
)
def main(
input_idxml: str,
input_mzml: str,
Expand All @@ -195,6 +200,7 @@ def main(
variable_mods: str,
fixed_mods: str,
add_pearson: bool,
num_cpus: int,
):
LOG.info("Parse idXML")
protein_ids, peptide_ids = parse_idxml(input_idxml)
Expand All @@ -206,12 +212,7 @@ def main(
scan_nr_seq_to_corr = {}
for hit_idx in range(num_hits): # number of hits to consider
df_peprec, scan_nr_to_seq = peptide_ids_to_peprec_dataframe(peptide_ids, hit_idx)
ms2pip = MS2PIP(
pep_file=df_peprec,
spec_file=input_mzml,
params=params,
return_results=True,
)
ms2pip = MS2PIP(pep_file=df_peprec, spec_file=input_mzml, params=params, return_results=True, num_cpu=num_cpus)
predictions = ms2pip.run()
correlation_df = get_complete_spectrum_correlation(predictions, "pearson")

Expand Down
5 changes: 5 additions & 0 deletions conf/base.config
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,9 @@ process {
withName:CUSTOM_DUMPSOFTWAREVERSIONS {
cache = false
}
withName:TDF2MZML {
cpus = { check_max( 10 * task.attempt, 'cpus' ) }
memory = { check_max( 10.GB * task.attempt, 'memory' ) }
time = { check_max( 16.h * task.attempt, 'time' ) }
}
}
5 changes: 3 additions & 2 deletions modules/local/ms2pip.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process MS2PIP {
tag "$meta.id"
label 'process_medium'
label 'process_low'

conda "bioconda::ms2pip=3.11.0 bioconda::pyopenms=2.9.1"
container 'ghcr.io/jonasscheid/mhcquant:ms2pip'
Expand Down Expand Up @@ -28,7 +28,8 @@ process MS2PIP {
--model_name ${params.ms2pip_model_name} \\
--fragment_error $fragment_error \\
--variable_mods '${params.variable_mods}' \\
--fixed_mods '${params.fixed_mods}'
--fixed_mods '${params.fixed_mods}' \\
--num_cpus ${task.cpus}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_decoydatabase.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_DECOYDATABASE {
tag "$meta.id"
label 'process_medium'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_falsediscoveryrate.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_FALSEDISCOVERYRATE {
tag "$meta.id"
label 'process_low'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_featurelinkerunlabeledkd.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_FEATURELINKERUNLABELEDKD {
tag "$meta.id"
label 'process_low'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms-thirdparty=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_idconflictresolver.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_IDCONFLICTRESOLVER {
tag "$meta.id"
label 'process_low'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_idfilter.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_IDFILTER {
tag "$meta.id"
label 'process_medium'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_idmerger.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_IDMERGER {
tag "$meta.id"
label 'process_low'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_mapaligneridentification.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_MAPALIGNERIDENTIFICATION {
tag "$meta.id"
label 'process_low'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_maprttransformer.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_MAPRTTRANSFORMER {
tag "$meta.id"
label 'process_low'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_mztabexporter.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_MZTABEXPORTER {
tag "$meta.id"
label 'process_low'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_peptideindexer.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_PEPTIDEINDEXER {
tag "$meta.id"
label 'process_low'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_percolatoradapter.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_PERCOLATORADAPTER {
tag "$meta.id"
label 'process_high'
label 'process_low'

conda (params.enable_conda ? "bioconda::openms-thirdparty=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_rtmodel.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_RTMODEL {
tag "$meta.id"
label 'process_medium'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_rtpredict.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_RTPREDICT {
tag "$meta.id"
label 'process_low'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms-thirdparty=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/openms_textexporter.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process OPENMS_TEXTEXPORTER {
tag "$meta.id"
label 'process_low'
label 'process_single'

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down
2 changes: 1 addition & 1 deletion modules/local/tdf2mzml.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process TDF2MZML {
tag "$meta.id"
label 'process_single'
//label 'process_medium'

container "docker.io/mfreitas/tdf2mzml"

Expand Down
2 changes: 1 addition & 1 deletion modules/local/thermorawfileparser.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process THERMORAWFILEPARSER {
tag "$meta.id"
label 'process_medium'
label 'process_low'

conda (params.enable_conda ? "bioconda::thermorawfileparser=1.4.2" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
Expand Down

0 comments on commit 42d61d1

Please sign in to comment.