Skip to content

Commit

Permalink
Merge pull request #55 from compomics/hotfix/fasta2speclib_fix_params
Browse files Browse the repository at this point in the history
Hotfix: fasta2speclib fix params
  • Loading branch information
RalfG authored Apr 1, 2020
2 parents 65fc0ba + 318a7f7 commit fa44847
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
29 changes: 17 additions & 12 deletions fasta2speclib/fasta2speclib.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,19 @@ def run_batches(peprec, decoy=False):
params["output_filename"] += "_decoy"

ms2pip_params = {
"model": params["ms2pip_model"],
"frag_error": 0.02,
# Modify fasta2speclib modifications dict to MS2PIP params PTMs entry
"ptm": [
"{},{},opt,{}".format(mods["name"], mods["mass_shift"], mods["amino_acid"])
if not mods["n_term"]
else "{},{},opt,N-term".format(mods["name"], mods["mass_shift"])
for mods in params["modifications"]
],
"sptm": [],
"gptm": [],
"ms2pip": {
"model": params["ms2pip_model"],
"frag_error": 0.02,
# Modify fasta2speclib modifications dict to MS2PIP params PTMs entry
"ptm": [
"{},{},opt,{}".format(mods["name"], mods["mass_shift"], mods["amino_acid"])
if not mods["n_term"]
else "{},{},opt,N-term".format(mods["name"], mods["mass_shift"])
for mods in params["modifications"]
],
"sptm": [],
"gptm": [],
}
}

# If add_retention_time, initiate DeepLC (and calibrate once)
Expand Down Expand Up @@ -400,6 +402,9 @@ def run_batches(peprec, decoy=False):
peprec_filter = pd.read_csv(params["peprec_filter"], sep=" ")
peprec_batch = remove_from_peprec_filter(peprec_batch, peprec_filter)

if params["save_peprec"]:
peprec_batch.to_csv(params["output_filename"] + "_" + str(b_count) + ".csv")

logging.info("Running MS2PIP for %d peptides", len(peprec_batch))
ms2pip = MS2PIP(
peprec_batch,
Expand Down Expand Up @@ -435,7 +440,7 @@ def run_batches(peprec, decoy=False):
spec_out = spectrum_output.SpectrumOutput(
all_preds,
peprec_batch,
ms2pip_params,
ms2pip_params["ms2pip"],
output_filename="{}".format(params["output_filename"]),
write_mode=write_mode,
)
Expand Down
1 change: 1 addition & 0 deletions fasta2speclib/fasta2speclib_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"elude_model_file":null,
"rt_predictions_file":null,
"peprec_filter":null,
"save_peprec":false,
"batch_size":10000,
"num_cpu":24
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "3.6.0"
VERSION = "3.6.1"

NAME = "ms2pip"
LICENSE = "apache-2.0"
Expand Down

0 comments on commit fa44847

Please sign in to comment.