Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
modfile2,
PTMmap,
model,
fragerror,
tableau,
):
"""
Function for each worker to process a list of spectra. Each peptide's
sequence is extracted from the mgf file. Then models are chosen based on
model. PTMmap, Ntermmap and Ctermmap determine the modifications
applied to each peptide sequence and the spectrum is predicted. Then either
the feature vectors are returned, or a DataFrame with the predicted and
empirical intensities.
"""
ms2pip_pyx.ms2pip_init(
bytearray(afile.encode()),
bytearray(modfile.encode()),
bytearray(modfile2.encode()),
)
# transform pandas datastructure into dictionary for easy access
if "ce" in data.columns:
specdict = (
data[["spec_id", "peptide", "modifications", "ce"]]
.set_index("spec_id")
.to_dict()
)
ces = specdict["ce"]
else:
specdict = (
data[["spec_id", "peptide", "modifications"]].set_index("spec_id").to_dict()