Skip to content

Commit

Permalink
Merge pull request #229 from ypriverol/dev
Browse files Browse the repository at this point in the history
testing with dev version of OpenMS 2.8.0
  • Loading branch information
ypriverol authored Oct 14, 2022
2 parents 881686c + 3630390 commit 558523d
Show file tree
Hide file tree
Showing 24 changed files with 189 additions and 62 deletions.
59 changes: 59 additions & 0 deletions bin/mzml_statistics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python

from pyopenms import MzMLFile, MSExperiment
import os
import pandas as pd
import click

CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])


@click.group(context_settings=CONTEXT_SETTINGS)
def cli():
pass


@click.command("mzml_dataframe")
@click.option("--mzml_folder", "-d")
@click.pass_context
def mzml_dataframe(ctx, mzml_folder):

file_columns = ["File_Name", "SpectrumID", "MSLevel", "Charge", "MS2_peaks", "Base_Peak_Intensity"]
mzml_paths = list(i for i in os.listdir(mzml_folder) if i.endswith(".mzML"))
mzml_count = 1

def parse_mzml(file_name, file_columns):
info = []
exp = MSExperiment()
MzMLFile().load(file_name, exp)
for i in exp:
name = os.path.split(file_name)[1]
id = i.getNativeID()
MSLevel = i.getMSLevel()
if MSLevel == 2:
charge_state = i.getPrecursors()[0].getCharge()
peaks_tuple = i.get_peaks()
peak_per_ms2 = len(peaks_tuple[0])
if i.getMetaValue("base peak intensity"):
base_peak_intensity = i.getMetaValue("base peak intensity")
else:
base_peak_intensity = max(peaks_tuple[1]) if len(peaks_tuple[1]) > 0 else "null"
info_list = [name, id, 2, charge_state, peak_per_ms2, base_peak_intensity]
else:
info_list = [name, id, MSLevel, "null", "null", "null"]

info.append(info_list)

return pd.DataFrame(info, columns=file_columns)

for i in mzml_paths:
mzml_df = parse_mzml(mzml_folder + i, file_columns)
tsv_header = True if mzml_count == 1 else False
mzml_df.to_csv("mzml_info.tsv", mode="a", sep="\t", index=False, header=tsv_header)
mzml_count += 1


cli.add_command(mzml_dataframe)

if __name__ == "__main__":
cli()
6 changes: 3 additions & 3 deletions modules/local/diannconvert/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ process DIANNCONVERT {
tag "$exp_design.Name"
label 'process_low'

conda (params.enable_conda ? "conda-forge::pandas_schema conda-forge::lzstring bioconda::pmultiqc=0.0.13" : null)
conda (params.enable_conda ? "conda-forge::pandas_schema conda-forge::lzstring bioconda::pmultiqc=0.0.16" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/pmultiqc:0.0.13--pyhdfd78af_0"
container "https://depot.galaxyproject.org/singularity/pmultiqc:0.0.16--pyhdfd78af_0"
} else {
container "quay.io/biocontainers/pmultiqc:0.0.13--pyhdfd78af_0"
container "quay.io/biocontainers/pmultiqc:0.0.16--pyhdfd78af_0"
}

input:
Expand Down
34 changes: 34 additions & 0 deletions modules/local/mzmlstatistics/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
process MZMLSTATISTICS {
label 'process_medium'
// TODO could be easily parallelized
label 'process_single_thread'

conda (params.enable_conda ? "conda-forge::pandas_schema conda-forge::lzstring bioconda::pmultiqc=0.0.16" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/pmultiqc:0.0.16--pyhdfd78af_0"
} else {
container "quay.io/biocontainers/pmultiqc:0.0.16--pyhdfd78af_0"
}

input:
path("out/*")

output:
path "mzml_info.tsv", emit: mzml_statistics
path "versions.yml", emit: version
path "*.log", emit: log

script:
def args = task.ext.args ?: ''

"""
mzml_statistics.py mzml_dataframe \\
--mzml_folder "./out/" \\
|& tee mzml_statistics.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pyopenms: \$(echo "2.8.0")
END_VERSIONS
"""
}
26 changes: 26 additions & 0 deletions modules/local/mzmlstatistics/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: MZMLSTATISTICS
description: A module for mzMLs statistics
keywords:
- mzML
- statistics
tools:
- custom:
description: |
A custom module for mzMLs statistics.
homepage: https://github.com/bigbio/quantms
documentation: https://github.com/bigbio/quantms/tree/readthedocs
input:
- mzmls:
type: dir
description: mzML files directory
output:
- mzml_statistics:
type: file
description: mzMLs statistics file
pattern: "mzml_info.tsv"
- version:
type: file
description: File containing software version
pattern: "versions.yml"
authors:
- "@wanghong"
6 changes: 3 additions & 3 deletions modules/local/openms/consensusid/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ process CONSENSUSID {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
tuple val(meta), path(id_file), val(qval_score)
Expand Down Expand Up @@ -37,7 +37,7 @@ process CONSENSUSID {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ConsensusID: \$(ConsensusID 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
ConsensusID: \$(ConsensusID 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/decoydatabase/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process DECOYDATABASE {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
path(db_for_decoy)
Expand Down Expand Up @@ -33,7 +33,7 @@ process DECOYDATABASE {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
DecoyDatabase: \$(DecoyDatabase 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
DecoyDatabase: \$(DecoyDatabase 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/epifany/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ process EPIFANY {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
tuple val(meta), path(consus_file)
Expand Down Expand Up @@ -36,7 +36,7 @@ process EPIFANY {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Epifany: \$(Epifany 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
Epifany: \$(Epifany 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/extractpsmfeatures/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ process EXTRACTPSMFEATURES {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
tuple val(meta), path(id_file)
Expand All @@ -31,7 +31,7 @@ process EXTRACTPSMFEATURES {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
PSMFeatureExtractor: \$(PSMFeatureExtractor 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
PSMFeatureExtractor: \$(PSMFeatureExtractor 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/falsediscoveryrate/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ process FALSEDISCOVERYRATE {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
tuple val(meta), path(id_file)
Expand All @@ -33,7 +33,7 @@ process FALSEDISCOVERYRATE {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
FalseDiscoveryRate: \$(FalseDiscoveryRate 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
FalseDiscoveryRate: \$(FalseDiscoveryRate 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/filemerge/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ process FILEMERGE {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
file(id_map)
Expand All @@ -32,7 +32,7 @@ process FILEMERGE {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
FileMerger: \$(FileMerger 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
FileMerger: \$(FileMerger 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/idconflictresolver/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process IDCONFLICTRESOLVER {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
path consus_file
Expand All @@ -28,7 +28,7 @@ process IDCONFLICTRESOLVER {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
IDConflictResolver: \$(IDConflictResolver 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
IDConflictResolver: \$(IDConflictResolver 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/idfilter/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ process IDFILTER {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
tuple val(meta), path(id_file)
Expand All @@ -31,7 +31,7 @@ process IDFILTER {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
IDFilter: \$(IDFilter 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
IDFilter: \$(IDFilter 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/idmapper/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ process IDMAPPER {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
tuple val(meta), path(id_file), path(map_file)
Expand All @@ -32,7 +32,7 @@ process IDMAPPER {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
IDMapper: \$(IDMapper 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
IDMapper: \$(IDMapper 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/idpep/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process IDPEP {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
tuple val(meta), path(id_file)
Expand All @@ -30,7 +30,7 @@ process IDPEP {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
IDPosteriorErrorProbability: \$(IDPosteriorErrorProbability 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
IDPosteriorErrorProbability: \$(IDPosteriorErrorProbability 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/idscoreswitcher/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ process IDSCORESWITCHER {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
tuple val(meta), path(id_file), val(new_score)
Expand All @@ -31,7 +31,7 @@ process IDSCORESWITCHER {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
IDScoreSwitcher: \$(IDScoreSwitcher 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
IDScoreSwitcher: \$(IDScoreSwitcher 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/indexpeptides/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process INDEXPEPTIDES {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
tuple val(meta), path(id_file), path(database)
Expand Down Expand Up @@ -57,7 +57,7 @@ process INDEXPEPTIDES {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
PeptideIndexer: \$(PeptideIndexer 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
PeptideIndexer: \$(PeptideIndexer 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
6 changes: 3 additions & 3 deletions modules/local/openms/isobaricanalyzer/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process ISOBARICANALYZER {

conda (params.enable_conda ? "bioconda::openms=2.8.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/openms:2.8.0--h7ca0330_1' :
'quay.io/biocontainers/openms:2.8.0--h7ca0330_1' }"
'https://ftp.pride.ebi.ac.uk/pub/databases/pride/resources/tools/ghcr.io-openms-openms-executables-latest.img' :
'ghcr.io/openms/openms-executables:latest' }"

input:
tuple val(meta), path(mzml_file)
Expand Down Expand Up @@ -44,7 +44,7 @@ process ISOBARICANALYZER {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
IsobaricAnalyzer: \$(IsobaricAnalyzer --version 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g')
IsobaricAnalyzer: \$(IsobaricAnalyzer --version 2>&1 | grep -E '^Version(.*)' | sed 's/Version: //g' | cut -d ' ' -f 1)
END_VERSIONS
"""
}
Loading

0 comments on commit 558523d

Please sign in to comment.