Skip to content

Commit 20ed8e5

Browse files
committed
Generalize MS_Spectrum class to MsData
1 parent bbad0d3 commit 20ed8e5

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

docs/source/pymzml_spec.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Chromatogram
3030
:exclude-members: __repr__, __str__
3131

3232

33-
MS_Spectrum
33+
MsData
3434
-----------
3535

36-
.. autoclass:: pymzml.spec.MS_Spectrum
36+
.. autoclass:: pymzml.msdata.MsData
3737
:members:

pymzml/chromatogram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535

3636
import re
3737
import numpy as np
38-
from .ms_spectrum import MS_Spectrum
38+
from .msdata import MsData
3939
from .obo import OboTranslator
4040

4141

42-
class Chromatogram(MS_Spectrum):
42+
class Chromatogram(MsData):
4343
"""
4444
Class for Chromatogram access and handling.
4545
"""

pymzml/ms_spectrum.py renamed to pymzml/msdata.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: latin-1 -*-
33
"""
4-
The MS_Spectrum class offers a base class for mass spectrometry data.
4+
The MsData class offers a base class for mass spectrometry data.
55
It provides common functionality for both Spectrum and Chromatogram classes.
66
"""
77

@@ -42,9 +42,10 @@
4242
from .obo import OboTranslator
4343

4444

45-
class MS_Spectrum(object):
45+
class MsData(object):
4646
"""
47-
General spectrum class for data handling.
47+
General base class for mass spectrometry data handling.
48+
Provides common functionality for both Spectrum and Chromatogram classes.
4849
"""
4950

5051
def _read_accessions(self):

pymzml/spec.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@
7070
ISOTOPE_AVERAGE_DIFFERENCE = 1.002
7171

7272
# Import Chromatogram from chromatogram.py for backward compatibility
73-
# Import MS_Spectrum from ms_spectrum.py
74-
from .ms_spectrum import MS_Spectrum
73+
# Import MsData from msdata.py
74+
from .msdata import MsData
7575

7676

77-
class MS_Spectrum(object):
77+
class MS_Spectrum(MsData):
7878
"""
7979
General spectrum class for data handling.
80+
This class is kept for backward compatibility.
8081
"""
8182

8283
def _read_accessions(self):
@@ -396,7 +397,7 @@ def to_string(self, encoding="latin-1", method="xml"):
396397
return ElementTree.tostring(self.element, encoding=encoding, method=method)
397398

398399

399-
class Spectrum(MS_Spectrum):
400+
class Spectrum(MsData):
400401
"""
401402
Spectrum class which inherits from class :py:attr:`pymzml.spec.MS_Spectrum`
402403
@@ -1737,7 +1738,7 @@ def centroidedPeaks(self):
17371738
return self.peaks("centroided")
17381739

17391740

1740-
class Chromatogram(MS_Spectrum):
1741+
class Chromatogram(MsData):
17411742
"""
17421743
Class for Chromatogram access and handling.
17431744
"""

0 commit comments

Comments
 (0)