CoreMS 4.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- corems/__init__.py +63 -0
- corems/chroma_peak/__init__.py +0 -0
- corems/chroma_peak/calc/ChromaPeakCalc.py +480 -0
- corems/chroma_peak/calc/__init__.py +0 -0
- corems/chroma_peak/calc/subset.py +196 -0
- corems/chroma_peak/factory/__init__.py +0 -0
- corems/chroma_peak/factory/chroma_peak_classes.py +1178 -0
- corems/encapsulation/__init__.py +0 -0
- corems/encapsulation/constant.py +1283 -0
- corems/encapsulation/factory/__init__.py +0 -0
- corems/encapsulation/factory/parameters.py +392 -0
- corems/encapsulation/factory/processingSetting.py +1244 -0
- corems/encapsulation/input/__init__.py +0 -0
- corems/encapsulation/input/parameter_from_json.py +579 -0
- corems/encapsulation/output/__init__.py +0 -0
- corems/encapsulation/output/parameter_to_dict.py +142 -0
- corems/encapsulation/output/parameter_to_json.py +332 -0
- corems/mass_spectra/__init__.py +0 -0
- corems/mass_spectra/calc/GC_Calc.py +84 -0
- corems/mass_spectra/calc/GC_Deconvolution.py +558 -0
- corems/mass_spectra/calc/GC_RI_Calibration.py +44 -0
- corems/mass_spectra/calc/MZSearch.py +249 -0
- corems/mass_spectra/calc/SignalProcessing.py +656 -0
- corems/mass_spectra/calc/__init__.py +0 -0
- corems/mass_spectra/calc/lc_calc.py +5790 -0
- corems/mass_spectra/calc/lc_calc_operations.py +1127 -0
- corems/mass_spectra/factory/GC_Class.py +791 -0
- corems/mass_spectra/factory/__init__.py +0 -0
- corems/mass_spectra/factory/chromat_data.py +51 -0
- corems/mass_spectra/factory/lc_class.py +2721 -0
- corems/mass_spectra/input/__init__.py +0 -0
- corems/mass_spectra/input/andiNetCDF.py +200 -0
- corems/mass_spectra/input/boosterHDF5.py +216 -0
- corems/mass_spectra/input/brukerSolarix.py +153 -0
- corems/mass_spectra/input/brukerSolarix_utils.py +73 -0
- corems/mass_spectra/input/corems_hdf5.py +1710 -0
- corems/mass_spectra/input/massList.py +133 -0
- corems/mass_spectra/input/mzml.py +668 -0
- corems/mass_spectra/input/parserbase.py +239 -0
- corems/mass_spectra/input/rawFileReader.py +1839 -0
- corems/mass_spectra/output/__init__.py +0 -0
- corems/mass_spectra/output/export.py +2800 -0
- corems/mass_spectrum/__init__.py +0 -0
- corems/mass_spectrum/calc/AutoRecalibration.py +237 -0
- corems/mass_spectrum/calc/Calibration.py +602 -0
- corems/mass_spectrum/calc/CalibrationCalc.py +253 -0
- corems/mass_spectrum/calc/KendrickGroup.py +239 -0
- corems/mass_spectrum/calc/MassErrorPrediction.py +436 -0
- corems/mass_spectrum/calc/MassSpectrumCalc.py +303 -0
- corems/mass_spectrum/calc/MeanResolvingPowerFilter.py +212 -0
- corems/mass_spectrum/calc/NoiseCalc.py +371 -0
- corems/mass_spectrum/calc/NoiseCalc_Bayes.py +93 -0
- corems/mass_spectrum/calc/PeakPicking.py +994 -0
- corems/mass_spectrum/calc/__init__.py +0 -0
- corems/mass_spectrum/factory/MassSpectrumClasses.py +1753 -0
- corems/mass_spectrum/factory/__init__.py +0 -0
- corems/mass_spectrum/input/__init__.py +0 -0
- corems/mass_spectrum/input/baseClass.py +531 -0
- corems/mass_spectrum/input/boosterHDF5.py +161 -0
- corems/mass_spectrum/input/coremsHDF5.py +475 -0
- corems/mass_spectrum/input/massList.py +402 -0
- corems/mass_spectrum/input/numpyArray.py +133 -0
- corems/mass_spectrum/output/__init__.py +0 -0
- corems/mass_spectrum/output/export.py +841 -0
- corems/molecular_formula/__init__.py +0 -0
- corems/molecular_formula/calc/MolecularFormulaCalc.py +885 -0
- corems/molecular_formula/calc/__init__.py +0 -0
- corems/molecular_formula/factory/MolecularFormulaFactory.py +895 -0
- corems/molecular_formula/factory/__init__.py +0 -0
- corems/molecular_formula/input/__init__.py +0 -0
- corems/molecular_formula/input/masslist_ref.py +355 -0
- corems/molecular_id/__init__.py +0 -0
- corems/molecular_id/calc/ClusterFilter.py +251 -0
- corems/molecular_id/calc/MolecularFilter.py +122 -0
- corems/molecular_id/calc/SpectralSimilarity.py +632 -0
- corems/molecular_id/calc/__init__.py +0 -0
- corems/molecular_id/calc/math_distance.py +1637 -0
- corems/molecular_id/data/FAMES_REF.msp +980 -0
- corems/molecular_id/data/PNNLMetV20191015.msp +157267 -0
- corems/molecular_id/factory/EI_SQL.py +650 -0
- corems/molecular_id/factory/MolecularLookupTable.py +914 -0
- corems/molecular_id/factory/__init__.py +0 -0
- corems/molecular_id/factory/classification.py +884 -0
- corems/molecular_id/factory/lipid_molecular_metadata.py +50 -0
- corems/molecular_id/factory/molecularSQL.py +827 -0
- corems/molecular_id/factory/spectrum_search_results.py +119 -0
- corems/molecular_id/input/__init__.py +0 -0
- corems/molecular_id/input/nistMSI.py +148 -0
- corems/molecular_id/search/__init__.py +0 -0
- corems/molecular_id/search/compoundSearch.py +214 -0
- corems/molecular_id/search/database_interfaces.py +1527 -0
- corems/molecular_id/search/findOxygenPeaks.py +330 -0
- corems/molecular_id/search/lcms_spectral_search.py +348 -0
- corems/molecular_id/search/molecularFormulaSearch.py +1117 -0
- corems/molecular_id/search/priorityAssignment.py +723 -0
- corems/ms_peak/__init__.py +0 -0
- corems/ms_peak/calc/MSPeakCalc.py +1010 -0
- corems/ms_peak/calc/__init__.py +0 -0
- corems/ms_peak/factory/MSPeakClasses.py +542 -0
- corems/ms_peak/factory/__init__.py +0 -0
- corems/transient/__init__.py +0 -0
- corems/transient/calc/TransientCalc.py +362 -0
- corems/transient/calc/__init__.py +0 -0
- corems/transient/factory/TransientClasses.py +457 -0
- corems/transient/factory/__init__.py +0 -0
- corems/transient/input/__init__.py +0 -0
- corems/transient/input/brukerSolarix.py +461 -0
- corems/transient/input/midasDatFile.py +172 -0
- corems-4.0.0.dist-info/METADATA +475 -0
- corems-4.0.0.dist-info/RECORD +171 -0
- corems-4.0.0.dist-info/WHEEL +5 -0
- corems-4.0.0.dist-info/licenses/LICENSE +22 -0
- corems-4.0.0.dist-info/top_level.txt +4 -0
- examples/archive/scripts/CoreMS_tutorial.py +94 -0
- examples/archive/scripts/DI HR-MS Halogens Bruker.py +196 -0
- examples/archive/scripts/DI HR-MS MassList.py +385 -0
- examples/archive/scripts/GC-MS MetabRef.py +213 -0
- examples/archive/scripts/GC-MS NetCDF.py +217 -0
- examples/archive/scripts/HR-MS Thermo Raw 21T.py +136 -0
- examples/archive/scripts/LC-ICPMS_metal_peaks.py +297 -0
- examples/archive/scripts/LCMS-Thermo.py +460 -0
- examples/archive/scripts/LCMS_isotopes.py +283 -0
- examples/archive/scripts/MSParams_example.py +21 -0
- examples/archive/scripts/Molecular Formula Data Aggreation.py +84 -0
- examples/archive/scripts/Single Mz Search.py +69 -0
- examples/test_notebooks.py +145 -0
- ext_lib/ChemstationMSFileReader.dll +0 -0
- ext_lib/ChemstationMSFileReader.xml +126 -0
- ext_lib/RawFileReaderLicense.doc +0 -0
- ext_lib/ThermoFisher.CommonCore.BackgroundSubtraction.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.BackgroundSubtraction.xml +2307 -0
- ext_lib/ThermoFisher.CommonCore.Data.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.Data.xml +28974 -0
- ext_lib/ThermoFisher.CommonCore.MassPrecisionEstimator.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.MassPrecisionEstimator.xml +241 -0
- ext_lib/ThermoFisher.CommonCore.RawFileReader.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.RawFileReader.xml +31174 -0
- ext_lib/__init__.py +0 -0
- ext_lib/dotnet/OpenMcdf.Extensions.dll +0 -0
- ext_lib/dotnet/OpenMcdf.dll +0 -0
- ext_lib/dotnet/OpenMcdf.xml +1154 -0
- ext_lib/dotnet/System.IO.FileSystem.AccessControl.dll +0 -0
- ext_lib/dotnet/System.IO.FileSystem.AccessControl.xml +506 -0
- ext_lib/dotnet/System.Security.AccessControl.dll +0 -0
- ext_lib/dotnet/System.Security.AccessControl.xml +2043 -0
- ext_lib/dotnet/System.Security.Principal.Windows.dll +0 -0
- ext_lib/dotnet/System.Security.Principal.Windows.xml +1011 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.BackgroundSubtraction.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.BackgroundSubtraction.xml +2307 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.Data.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.Data.xml +29148 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.MassPrecisionEstimator.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.MassPrecisionEstimator.xml +241 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.RawFileReader.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.RawFileReader.xml +31492 -0
- ext_lib/version +18 -0
- support_code/atom_parsers/AtomsDescription.py +359 -0
- support_code/atom_parsers/CreateAtomsDescription.py +56 -0
- support_code/nmdc/filefinder.py +90 -0
- support_code/nmdc/lipidomics/lipidomics_workflow.py +748 -0
- support_code/nmdc/lipidomics/manifest_examples.py +49 -0
- support_code/nmdc/metabolomics/gcms_workflow.py +158 -0
- support_code/nmdc/metabolomics/lcms_metabolomics_targeted_search.py +59 -0
- support_code/nmdc/metabolomics/lcms_metabolomics_workflow.py +248 -0
- support_code/nmdc/metabolomics/metabolomics_collection.py +628 -0
- support_code/nmdc/metadata/dms_api.py +42 -0
- support_code/nmdc/nom/archived_scripts/nmdc_metadata_gen.py +288 -0
- support_code/nmdc/nom/archived_scripts/nom_grow_workflow.py +209 -0
- support_code/nmdc/nom/nom_workflow.py +312 -0
- support_code/windows_only_importers/BrukerCompassXtract.py +180 -0
- support_code/windows_only_importers/ThermoMSFileReader.py +405 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
__author__ = "Yuri E. Corilo"
|
|
2
|
+
__date__ = "Jun 12, 2019"
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from threading import Thread
|
|
8
|
+
import warnings
|
|
9
|
+
from corems.mass_spectrum.input.massList import ReadCoremsMasslist
|
|
10
|
+
from corems.mass_spectra.factory.lc_class import LCMSBase
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ReadCoremsMassSpectraText(ReadCoremsMasslist, Thread):
|
|
14
|
+
"""
|
|
15
|
+
Class for reading CoreMS mass spectra from a text file.
|
|
16
|
+
|
|
17
|
+
Parameters
|
|
18
|
+
----------
|
|
19
|
+
file_location : str, pathlib.Path, or s3path.S3Path
|
|
20
|
+
Path object from pathlib containing the file location
|
|
21
|
+
analyzer : str, optional
|
|
22
|
+
Name of the analyzer, by default 'Unknown'
|
|
23
|
+
instrument_label : str, optional
|
|
24
|
+
Label of the instrument, by default 'Unknown'
|
|
25
|
+
|
|
26
|
+
Attributes
|
|
27
|
+
----------
|
|
28
|
+
lcms : LCMSBase
|
|
29
|
+
LCMSBase object for storing the mass spectra data.
|
|
30
|
+
|
|
31
|
+
Methods
|
|
32
|
+
-------
|
|
33
|
+
* get_scans_filename(). Get the filenames of all the scan files associated with the CoreMS file.
|
|
34
|
+
* set_filepath_datatype_and_delimiter(file_path_obj). Set the file path, data type, and delimiter based on the file path object.
|
|
35
|
+
* import_mass_spectra(). Import the mass spectra from the scan files and add them to the LCMSBase object.
|
|
36
|
+
* run(). Run the import_mass_spectra method to create the LCMSBase object.
|
|
37
|
+
* get_lcms_obj(). Get the LCMSBase object.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def __init__(self, file_location, analyzer="Unknown", instrument_label="Unknown"):
|
|
41
|
+
if isinstance(file_location, str):
|
|
42
|
+
# if obj is a string it defaults to create a Path obj, pass the S3Path if needed
|
|
43
|
+
file_location = Path(file_location)
|
|
44
|
+
|
|
45
|
+
if not file_location.exists():
|
|
46
|
+
raise FileNotFoundError("%s not found" % file_location)
|
|
47
|
+
|
|
48
|
+
if not file_location.suffix == ".corems":
|
|
49
|
+
raise TypeError("%s is not a valid CoreMS file" % file_location)
|
|
50
|
+
|
|
51
|
+
Thread.__init__(self)
|
|
52
|
+
|
|
53
|
+
ReadCoremsMasslist.__init__(self, file_location)
|
|
54
|
+
|
|
55
|
+
self.lcms = LCMSBase(
|
|
56
|
+
self.file_location, analyzer=analyzer, instrument_label=instrument_label
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def get_scans_filename(self) -> list:
|
|
60
|
+
all_other = self.file_location.glob("*_scan*[!.json]")
|
|
61
|
+
|
|
62
|
+
scans_filepath = [
|
|
63
|
+
(file_path_obj.stem.split("scan")[1], file_path_obj)
|
|
64
|
+
for file_path_obj in all_other
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
scans_filepath.sort(key=lambda m: int(m[0]))
|
|
68
|
+
|
|
69
|
+
return scans_filepath
|
|
70
|
+
|
|
71
|
+
def set_filepath_datatype_and_delimiter(self, file_path_obj) -> None:
|
|
72
|
+
self.file_location = file_path_obj
|
|
73
|
+
|
|
74
|
+
if file_path_obj.suffix == ".pkl":
|
|
75
|
+
self.data_type == "dataframe"
|
|
76
|
+
|
|
77
|
+
else:
|
|
78
|
+
if file_path_obj.suffix == ".csv":
|
|
79
|
+
self.data_type == "txt"
|
|
80
|
+
self.delimiter = ","
|
|
81
|
+
|
|
82
|
+
elif file_path_obj.suffix == ".xlsx":
|
|
83
|
+
self.data_type == "excel"
|
|
84
|
+
self.delimiter = ","
|
|
85
|
+
|
|
86
|
+
elif file_path_obj.suffix == ".txt":
|
|
87
|
+
self.data_type == "txt"
|
|
88
|
+
self.delimiter = "\t"
|
|
89
|
+
warnings.warn("using tab as delimiter")
|
|
90
|
+
else:
|
|
91
|
+
raise NotImplementedError(
|
|
92
|
+
"%s data not yet supported " % file_path_obj.suffix
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
def import_mass_spectra(self) -> None:
|
|
96
|
+
list_rt, list_tic, list_scan = list(), list(), list()
|
|
97
|
+
|
|
98
|
+
for scan_number, file_path_obj in self.get_scans_filename():
|
|
99
|
+
self.set_filepath_datatype_and_delimiter(file_path_obj)
|
|
100
|
+
|
|
101
|
+
mass_spec = self.get_mass_spectrum(int(scan_number))
|
|
102
|
+
|
|
103
|
+
list_scan.append(int(scan_number))
|
|
104
|
+
|
|
105
|
+
list_rt.append(mass_spec.retention_time)
|
|
106
|
+
|
|
107
|
+
list_tic.append(mass_spec.tic)
|
|
108
|
+
|
|
109
|
+
self.lcms.add_mass_spectrum(mass_spec)
|
|
110
|
+
|
|
111
|
+
self.lcms.retention_time = list_rt
|
|
112
|
+
self.lcms.tic_list = list_tic # TODO: check if this is correct
|
|
113
|
+
self.lcms.scans_number = list_scan
|
|
114
|
+
|
|
115
|
+
def run(self) -> None:
|
|
116
|
+
"""Creates the LCMS object and imports mass spectra."""
|
|
117
|
+
|
|
118
|
+
self.import_mass_spectra()
|
|
119
|
+
|
|
120
|
+
def get_lcms_obj(self) -> LCMSBase:
|
|
121
|
+
"""
|
|
122
|
+
Returns the LCMSBase object associated with the massList.
|
|
123
|
+
|
|
124
|
+
If the LCMSBase object is already initialized, it is returned.
|
|
125
|
+
Otherwise, an exception is raised.
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
Exception: If the LCMSBase object is not initialized.
|
|
129
|
+
"""
|
|
130
|
+
if self.lcms:
|
|
131
|
+
return self.lcms
|
|
132
|
+
else:
|
|
133
|
+
raise Exception("returning an empty lcms class")
|