Skip to content

Commit

Permalink
changes for mumble implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurDeclercq committed Nov 21, 2024
1 parent c51cd34 commit 295e37f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 45 deletions.
38 changes: 0 additions & 38 deletions ms2rescore/feature_generators/ms2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

FRAGMENTATION_MODELS = {
"cidhcd": FragmentationModel.CidHcd,
"etcid": FragmentationModel.Etcid,
"etd": FragmentationModel.Etd,
"ethcd": FragmentationModel.Ethcd,
"all": FragmentationModel.All,
Expand Down Expand Up @@ -148,28 +147,6 @@ def _calculate_features(self, psm_list: PSMList, spectrum_file: str) -> List:

else:
psm.rescoring_features.update({"hyperscore": np.nan})
# with multiprocessing.Pool(self.processes) as pool:
# counts_failed = 0
# for psm, features in zip(
# psm_list,
# track(
# pool.imap(
# self._calculate_spectrum_features_wrapper,
# zip(psm_list, annotated_spectra),
# chunksize=1000,
# ),
# total=len(psm_list),
# description="Calculating MS2 features...",
# transient=True,
# ),
# ):
# if features:
# psm.rescoring_features.update(features)

# else:
# counts_failed += 1
# if counts_failed > 0:
# logger.warning(f"Failed to calculate features for {counts_failed} PSMs")

@staticmethod
def _read_spectrum_file(spectrum_filepath: str) -> Union[mzml.PreIndexedMzML, mgf.IndexedMGF]:
Expand Down Expand Up @@ -246,10 +223,6 @@ def _calculate_spectrum_features(self, psm, annotated_spectrum):
/ (len(b_ions_matched) + len(y_ions_matched)),
}

def _calculate_spectrum_features_wrapper(self, psm_spectrum_tuple):
psm, spectrum = psm_spectrum_tuple
return self._calculate_spectrum_features(psm, spectrum)

def _annotate_spectrum(self, psm, pyteomics_spectrum):

spectrum = RawSpectrum(
Expand All @@ -272,17 +245,6 @@ def _annotate_spectrum(self, psm, pyteomics_spectrum):

return annotated_spectrum.spectrum

def _calculate_hyperscore(self, psm, spectrum):
pass

def _calculate_fragmentation_features(self, psm, annotated_spectrum):
pass


# TODO: keep this here?
def modification_evidence():
return


def _annotated_spectrum_to_mzint(annotated_spectrum, ion_types=["b", "y"]):

Expand Down
8 changes: 2 additions & 6 deletions ms2rescore/parse_psms.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,9 @@ def parse_psms(config: Dict, psm_list: Union[PSMList, None]) -> PSMList:
psm.rescoring_features = {}

psm_handler = PSMHandler(
**mumble_config, # TODO how do we store config for mumble?
**mumble_config,
)
psm_list = psm_handler.add_modified_psms(
psm_list, generate_modified_decoys=True, keep_original=True
)
if mumble_config["output_file"]:
psm_handler.write_modified_psm_list(psm_list, mumble_config["output_file"])
psm_list = psm_handler.add_modified_psms(psm_list)

return psm_list

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ dependencies = [
"pyteomics>=4.7.2",
"rich>=12",
"tomli>=2; python_version < '3.11'",
"mumble"
]

[project.optional-dependencies]
Expand Down

0 comments on commit 295e37f

Please sign in to comment.