Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MonoIsotopic mass for DIANN peptides with unknown AA #369

Merged
merged 8 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/multiqc_config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
report_comment: >
This report has been generated by the <a href="https://github.com/nf-core/quantms/releases/tag/1.3.0" target="_blank">nf-core/quantms</a>
This report has been generated by the <a href="https://github.com/nf-core/quantms/tree/dev" target="_blank">nf-core/quantms</a>
analysis pipeline. For information about how to interpret these results, please see the
<a href="https://nf-co.re/quantms/1.3.0/docs/output" target="_blank">documentation</a>.
<a href="https://nf-co.re/quantms/dev/docs/output" target="_blank">documentation</a>.
report_section_order:
pmultiqc:
order: 1
Expand Down
38 changes: 37 additions & 1 deletion bin/diann_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,42 @@ def get_exp_design_dfs(exp_design_file):

return s_DataFrame, f_table

def compute_mass_modified_peptide(peptide_seq: str) -> float:
"""
Function that takes a peptide sequence including modifications and compute the mass using the AASequence class from
pyopenms. The notation of a peptidoform for pyopenms is the following:

if not modifications is present:
AVQVHQDTLRTMYFAXR -> AVQVHQDTLRTMYFAX[178.995499]R
if modification is present in Methionine:
AVQVHQDTLRTM(Oxidation)YFAXR -> AVQVHQDTLRTM(Oxidation)YFAX[178.995499]R

@param peptide_seq: str, peptide sequence
@return: float, mass of the peptide
"""
peptide_parts: List[str] = []
not_mod = True
aa_mass = {
"X": "X[178.98493453312]", # 196.995499 - 17.003288 - 1.00727646688
"U": "X[132.94306553312]", # 150.95363 - 17.003288 - 1.00727646688
"O": "X[237.14773053312]", # 255.158295 - 17.003288 - 1.00727646688
}
for aa in peptide_seq:
# Check if the letter is in aminoacid
if aa == "(":
not_mod = False
elif aa == ")":
not_mod = True
# Check aminoacid letter
if aa in aa_mass and not_mod:
aa = aa_mass[aa]
elif aa not in ['G','A','V','L','I','F','M','P','W','S','C','T','Y','N','Q','D','E','K','R','H'] and not_mod and aa != ")":
logger.info(f"Unknown amino acid with mass not known:{aa}")
peptide_parts.append(aa)
new_peptide_seq = ''.join(peptide_parts)
mass = AASequence.fromString(new_peptide_seq).getMonoWeight()
logger.debug(new_peptide_seq + ":" + str(mass))
return mass

class DiannDirectory:
def __init__(self, base_path, diann_version_file):
Expand Down Expand Up @@ -348,7 +384,7 @@ def main_report_df(self, qvalue_threshold: float) -> pd.DataFrame:
logger.debug("Calculating Precursor.Mz")
# Making the map is 10x faster, and includes the mass of
# the modification. with respect to the previous implementation.
uniq_masses = {k: AASequence.fromString(k).getMonoWeight() for k in report["Modified.Sequence"].unique()}
uniq_masses = {k: compute_mass_modified_peptide(k) for k in report["Modified.Sequence"].unique()}
mass_vector = report["Modified.Sequence"].map(uniq_masses)
report["Calculate.Precursor.Mz"] = (mass_vector + (PROTON_MASS_U * report["Precursor.Charge"])) / report[
"Precursor.Charge"
Expand Down
4 changes: 2 additions & 2 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,12 @@ process {

// PROTEINQUANTIFIER
withName: '.*:TMT:PROTEINQUANT:PROTEINQUANTIFIER' {
ext.args = "-debug 0"
ext.args = "-debug $params.protein_quant_debug"
}

// MSSTATSCONVERTER
withName: '.*:TMT:PROTEINQUANT:MSSTATSCONVERTER' {
ext.args = "-debug 0"
ext.args = "-debug $params.protein_quant_debug"
}
}

Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
The typical command for running the pipeline is as follows:

```bash
nextflow run nf-core/quantms --input '/url/path/to/your/experimentX_design.tsv' --database '/url/path/to/your/proteindatabase.fasta' --outdir './results' -profile docker
nextflow run nf-core/quantms --input '/url/path/to/your/experiment_design.sdrf.tsv' --database '/url/path/to/your/proteindatabase.fasta' --outdir './results' -profile docker
```

where the experimental design file has to be one of:
Expand Down
3 changes: 2 additions & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ params {
luciphor_debug = 0
protein_inference_debug = 0
plfq_debug = 0
protein_quant_debug = 0

// decoys
decoy_string = 'DECOY_'
Expand Down Expand Up @@ -462,7 +463,7 @@ manifest {
description = """Quantitative Mass Spectrometry nf-core workflow"""
mainScript = 'main.nf'
nextflowVersion = '!>=23.04.0'
version = '1.3.0'
version = '1.3.0dev'
doi = '10.5281/zenodo.7754148'
}

Expand Down
7 changes: 7 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,13 @@
"description": "Export the results in mzTab format.",
"default": true,
"fa_icon": "fas fa-check-square"
},
"protein_quant_debug": {
"type": "integer",
"description": "Debug level for the protein quantification step. Increase for verbose logging",
"fa_icon": "fas fa-bug",
"default": 0,
"hidden": true
}
},
"fa_icon": "fas fa-braille"
Expand Down
Loading