How to use the ms2pip.cython_modules.ms2pip_pyx.ms2pip_init function in ms2pip

To help you get started, we’ve selected a few ms2pip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github compomics / ms2pip_c / ms2pip / ms2pipC.py View on Github external
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()