Read MS data¶
This function is implemented in the MSData
class to read the raw MS data.
mzML and mzXML files are supported. This function is achieved by using the pyopenms
module.
- readRawData(self, fileName)¶
Function to read the raw LCMS data to Function to read the raw LCMS data to
MSExperiment
object (supported bypyopenms
).- Parameters:
fileName – str. The name of the file to be read (end with .mzML or .mzXML).
The loaded data is stored in the MSData
object as MSExperiment
object.
Two more functions are implemented to get the MS1 and MS2 spectra from the MSExperiment
object.
- extractMS1(self, rtRange=None)¶
Function to extract all MS1 scans and convert them to
ms1Spectrum
objects (supported by bago).- Parameters:
rtRange – list. The retention time range to be extracted (in minute). If None, all MS1 scans will be extracted.
It generate an attribute ms1Data
in the MSData
object to store the extracted MS1 spectra.
- extractMS2(self, rtRange=None)¶
Function to extract all MS2 scans and convert them to
ms2Spectrum
objects (supported by bago).- Parameters:
rtRange – list. The retention time range to be extracted (in minute). If None, all MS2 scans will be extracted.
It generate an attribute ms1Data
in the MSData
object to store the extracted MS1 spectra.
To load the raw data and extract the MS1 and MS2 spectra, you can use the following code:
from bago import rawDataHelper
fileName = 'data.mzML'
msData = rawDataHelper.MSData()
msData.readRawData(fileName)
msData.extractMS1()
msData.extractMS2()