Skip to content

Commit

Permalink
Merge branch 'main' into use-metadata-params-for-submission
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbinBouwmeester authored Dec 11, 2023
2 parents 48a45e9 + 5da5268 commit cf46a24
Show file tree
Hide file tree
Showing 10 changed files with 940 additions and 4 deletions.
49 changes: 49 additions & 0 deletions proteobench/io/params/alphapept.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""Alphapept uses the yaml format to save configuration."""
import pathlib

import pandas as pd
import yaml

from proteobench.io.params import ProteoBenchParameters


def extract_params(fname) -> ProteoBenchParameters:
with open(fname) as f:
record = yaml.safe_load(f)
summary = record["summary"]
params = ProteoBenchParameters()
params.software_name = "AlphaPept"
params.software_version = summary["version"]
params.search_engine = params.software_name
params.search_engine_version = params.software_version
fasta = record["fasta"]
params.enzyme = fasta["protease"]
params.allowed_miscleavages = fasta["n_missed_cleavages"]
params.fixed_mods = ",".join(fasta["mods_fixed"])
params.variable_mods = ",".join(fasta["mods_variable"])
params.max_mods = fasta["n_modifications_max"]
params.min_peptide_length = fasta["pep_length_min"]
params.max_peptide_length = fasta["pep_length_max"]
search = record["search"]
params.precursor_mass_tolerance = search["prec_tol"]
params.fragment_mass_tolerance = search["frag_tol"]
params.ident_fdr_protein = search["protein_fdr"]
params.ident_fdr_peptide = search["peptide_fdr"]
# params.ident_fdr_psm = search
params.min_precursor_charge = record["features"]["iso_charge_min"]
params.max_precursor_charge = record["features"]["iso_charge_max"]
params.enable_match_between_runs = record["workflow"]["match"] # ! check

return params


if __name__ == "__main__":
for fname in [
"../../../test/params/alphapept_0.4.9.yaml",
"../../../test/params/alphapept_0.4.9_unnormalized.yaml",
]:
file = pathlib.Path(fname)
params = extract_params(file)
data_dict = params.__dict__
series = pd.Series(data_dict)
series.to_csv(file.with_suffix(".csv"))
10 changes: 9 additions & 1 deletion proteobench/io/params/proline.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,15 @@ def extract_params(fname) -> ProteoBenchParameters:


if __name__ == "__main__":
file = pathlib.Path("test/params/Proline_example_w_Mascot_wo_proteinSets.xlsx")
file = pathlib.Path(
"../../../test/params/Proline_example_w_Mascot_wo_proteinSets.xlsx"
)
params = extract_params(file)
data_dict = params.__dict__
series = pd.Series(data_dict)
series.to_csv(file.with_suffix(".csv"))

file = pathlib.Path("../../../test/params/Proline_example_2.xlsx")
params = extract_params(file)
data_dict = params.__dict__
series = pd.Series(data_dict)
Expand Down
20 changes: 20 additions & 0 deletions test/params/Proline_example_2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
,0
software_name,Proline
software_version,X! Tandem Vengeance (2015.12.15.2)
search_engine,XTandem
search_engine_version,
ident_fdr_psm,1
ident_fdr_peptide,
ident_fdr_protein,
enable_match_between_runs,False
precursor_mass_tolerance,10.0 ppm
fragment_mass_tolerance,0.02 Da
enzyme,Trypsin
allowed_miscleavages,2
min_peptide_length,7
max_peptide_length,
fixed_mods,Carbamidomethyl (C)
variable_mods,Acetyl (Protein N-term); Gln->pyro-Glu (Any N-term Q); Ammonia-loss (Any N-term C); Glu->pyro-Glu (Any N-term E); Oxidation (M)
max_mods,
min_precursor_charge,
max_precursor_charge,
Binary file added test/params/Proline_example_2.xlsx
Binary file not shown.
20 changes: 20 additions & 0 deletions test/params/alphapept_0.4.9.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
,0
software_name,AlphaPept
software_version,0.4.9
search_engine,AlphaPept
search_engine_version,0.4.9
ident_fdr_psm,
ident_fdr_peptide,0.01
ident_fdr_protein,0.01
enable_match_between_runs,False
precursor_mass_tolerance,20
fragment_mass_tolerance,50
enzyme,trypsin
allowed_miscleavages,2
min_peptide_length,7
max_peptide_length,27
fixed_mods,cC
variable_mods,oxM
max_mods,3
min_precursor_charge,1
max_precursor_charge,6
Loading

0 comments on commit cf46a24

Please sign in to comment.