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,22 @@
|
|
|
1
|
+
Copyright Battelle Memorial Institute
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
7
|
+
list of conditions and the following disclaimer.
|
|
8
|
+
|
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
|
11
|
+
and/or other materials provided with the distribution.
|
|
12
|
+
|
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
14
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
15
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
16
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
17
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
18
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
19
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
20
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
21
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
22
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from matplotlib import pyplot
|
|
4
|
+
|
|
5
|
+
from corems.encapsulation.factory.parameters import MSParameters
|
|
6
|
+
from corems.transient.input.brukerSolarix import ReadBrukerSolarix
|
|
7
|
+
from corems.mass_spectrum.calc.Calibration import MzDomainCalibration
|
|
8
|
+
|
|
9
|
+
file_location = "tests/tests_data/ftms/ESI_NEG_SRFA.d"
|
|
10
|
+
|
|
11
|
+
MSParameters.transient.apodization_method = "Hanning"
|
|
12
|
+
MSParameters.transient.number_of_truncations = 0
|
|
13
|
+
MSParameters.transient.number_of_zero_fills = 1
|
|
14
|
+
|
|
15
|
+
MSParameters.mass_spectrum.noise_threshold_method = 'relative_abundance'
|
|
16
|
+
MSParameters.mass_spectrum.noise_threshold_min_relative_abundance = 1
|
|
17
|
+
|
|
18
|
+
#MSParameters.mass_spectrum.noise_threshold_method = 'signal_noise'
|
|
19
|
+
#MSParameters.mass_spectrum.noise_threshold_min_s2n = 50
|
|
20
|
+
|
|
21
|
+
#MSParameters.mass_spectrum.noise_threshold_method = 'log'
|
|
22
|
+
#MSParameters.mass_spectrum.noise_threshold_min_std = 32
|
|
23
|
+
|
|
24
|
+
MSParameters.ms_peak.peak_min_prominence_percent = 1
|
|
25
|
+
|
|
26
|
+
def import_transient():
|
|
27
|
+
|
|
28
|
+
with ReadBrukerSolarix(file_location) as bruker_transient:
|
|
29
|
+
|
|
30
|
+
mass_spectrum = bruker_transient.get_mass_spectrum(plot_result=True, auto_process=True)
|
|
31
|
+
|
|
32
|
+
mass_spectrum.plot_profile_and_noise_threshold()
|
|
33
|
+
|
|
34
|
+
print("m/z count", len(mass_spectrum))
|
|
35
|
+
|
|
36
|
+
print('first m/z', mass_spectrum.mspeaks[0].mz_exp, 'final m/z', mass_spectrum.mspeaks[-1].mz_exp)
|
|
37
|
+
|
|
38
|
+
return mass_spectrum
|
|
39
|
+
|
|
40
|
+
mass_spectrum = import_transient()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
MSParameters.mass_spectrum.min_calib_ppm_error = -5
|
|
44
|
+
MSParameters.mass_spectrum.max_calib_ppm_error = 5
|
|
45
|
+
|
|
46
|
+
mass_spectrum = import_transient()
|
|
47
|
+
|
|
48
|
+
ref_file_location = 'tests/tests_data/ftms/SRFA.ref'
|
|
49
|
+
|
|
50
|
+
MzDomainCalibration(mass_spectrum, ref_file_location).run()
|
|
51
|
+
|
|
52
|
+
from corems.molecular_id.search.molecularFormulaSearch import SearchMolecularFormulas
|
|
53
|
+
from corems.molecular_id.factory.classification import HeteroatomsClassification
|
|
54
|
+
|
|
55
|
+
mass_spectrum.molecular_search_settings.url_database = "postgresql+psycopg2://coremsappdb:coremsapppnnl@localhost:5432/coremsapp"
|
|
56
|
+
|
|
57
|
+
mass_spectrum.molecular_search_settings.error_method = 'None'
|
|
58
|
+
mass_spectrum.molecular_search_settings.min_ppm_error = -1
|
|
59
|
+
mass_spectrum.molecular_search_settings.max_ppm_error = 1
|
|
60
|
+
|
|
61
|
+
mass_spectrum.molecular_search_settings.min_dbe = 0
|
|
62
|
+
mass_spectrum.molecular_search_settings.max_dbe = 50
|
|
63
|
+
|
|
64
|
+
mass_spectrum.molecular_search_settings.isProtonated = True
|
|
65
|
+
mass_spectrum.molecular_search_settings.isRadical= False
|
|
66
|
+
mass_spectrum.molecular_search_settings.isadduct = True
|
|
67
|
+
|
|
68
|
+
mass_spectrum.molecular_search_settings.usedAtoms['C'] = (1,90)
|
|
69
|
+
mass_spectrum.molecular_search_settings.usedAtoms['H'] = (4,200)
|
|
70
|
+
mass_spectrum.molecular_search_settings.usedAtoms['O'] = (1,20)
|
|
71
|
+
mass_spectrum.molecular_search_settings.usedAtoms['N'] = (0,0)
|
|
72
|
+
mass_spectrum.molecular_search_settings.usedAtoms['S'] = (0,0)
|
|
73
|
+
|
|
74
|
+
SearchMolecularFormulas(mass_spectrum, first_hit=True).run_worker_mass_spectrum()
|
|
75
|
+
mass_spectrum.percentile_assigned(report_error=True)
|
|
76
|
+
|
|
77
|
+
mass_spectrum_by_classes = HeteroatomsClassification(mass_spectrum, choose_molecular_formula=True)
|
|
78
|
+
mass_spectrum_by_classes.plot_ms_assigned_unassigned()
|
|
79
|
+
|
|
80
|
+
for mspeaks in mass_spectrum.sort_by_abundance():
|
|
81
|
+
if mspeaks: #or just if mspeak:
|
|
82
|
+
for mf in mspeaks:
|
|
83
|
+
print(mf.mz_calc, mf.dbe, mf.class_label, mf.string_formated)
|
|
84
|
+
|
|
85
|
+
#exporting data
|
|
86
|
+
mass_spectrum.to_csv("test")
|
|
87
|
+
|
|
88
|
+
# save pandas Datarame to pickle
|
|
89
|
+
mass_spectrum.to_pandas("test")
|
|
90
|
+
|
|
91
|
+
# get pandas Dataframe
|
|
92
|
+
df = mass_spectrum.to_dataframe()
|
|
93
|
+
|
|
94
|
+
df.head()
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
sys.path.append("./")
|
|
3
|
+
|
|
4
|
+
import warnings
|
|
5
|
+
warnings.filterwarnings("ignore")
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import matplotlib.pyplot as plt
|
|
10
|
+
from numpy import unique
|
|
11
|
+
|
|
12
|
+
from corems import SuppressPrints, get_dirnames
|
|
13
|
+
from corems.molecular_id.factory.classification import HeteroatomsClassification, Labels
|
|
14
|
+
from corems.molecular_id.search.priorityAssignment import OxygenPriorityAssignment
|
|
15
|
+
from corems.transient.input.brukerSolarix import ReadBrukerSolarix
|
|
16
|
+
from corems.molecular_id.search.molecularFormulaSearch import SearchMolecularFormulas
|
|
17
|
+
from corems.mass_spectrum.calc.MassErrorPrediction import MassErrorPrediction
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_mass_spectrum(file_location):
|
|
21
|
+
|
|
22
|
+
bruker_reader = ReadBrukerSolarix(file_location)
|
|
23
|
+
|
|
24
|
+
bruker_transient = bruker_reader.get_transient()
|
|
25
|
+
|
|
26
|
+
return bruker_transient.get_mass_spectrum(plot_result=False, auto_process=True)
|
|
27
|
+
|
|
28
|
+
def export(list_dict, export_name):
|
|
29
|
+
|
|
30
|
+
import pandas as pd
|
|
31
|
+
|
|
32
|
+
columns = [ "Sample Name",
|
|
33
|
+
"Calculated m/z",
|
|
34
|
+
"Experimental m/z",
|
|
35
|
+
"Error m/z",
|
|
36
|
+
"Peak Height",
|
|
37
|
+
"Signal Noise Ratio",
|
|
38
|
+
"Peak Datapoint Count",
|
|
39
|
+
"Resolving Power",
|
|
40
|
+
"Molecular Formula",
|
|
41
|
+
"Peak Area",
|
|
42
|
+
"Area Ratio Error",
|
|
43
|
+
"Probability Ratio",
|
|
44
|
+
"Abundance Error"
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
df = pd.DataFrame(list_dict, columns=columns)
|
|
48
|
+
df.to_pickle(export_name + ".pkl")
|
|
49
|
+
df.to_csv(export_name + ".csv", index=False)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def set_settings_for_bromothymol_blue(mass_spectrum):
|
|
53
|
+
|
|
54
|
+
mass_spectrum.molecular_search_settings.min_ppm_error = -2
|
|
55
|
+
mass_spectrum.molecular_search_settings.max_ppm_error = 5
|
|
56
|
+
|
|
57
|
+
mass_spectrum.molecular_search_settings.usedAtoms['C'] = (1, 90)
|
|
58
|
+
mass_spectrum.molecular_search_settings.usedAtoms['H'] = (4, 200)
|
|
59
|
+
mass_spectrum.molecular_search_settings.usedAtoms['O'] = (5, 5)
|
|
60
|
+
mass_spectrum.molecular_search_settings.usedAtoms['N'] = (0, 0)
|
|
61
|
+
mass_spectrum.molecular_search_settings.usedAtoms['S'] = (1, 1)
|
|
62
|
+
mass_spectrum.molecular_search_settings.usedAtoms['Br'] = (2, 2)
|
|
63
|
+
|
|
64
|
+
#enables the search for Br compounds
|
|
65
|
+
mass_spectrum.molecular_search_settings.adduct_atoms_neg = ['Cl', 'F']
|
|
66
|
+
|
|
67
|
+
mass_spectrum.molecular_search_settings.isProtonated = True
|
|
68
|
+
mass_spectrum.molecular_search_settings.isRadical = False
|
|
69
|
+
mass_spectrum.molecular_search_settings.isAdduct = False
|
|
70
|
+
|
|
71
|
+
mass_spectrum.molecular_search_settings.use_min_peaks_filter = False
|
|
72
|
+
|
|
73
|
+
def set_settings_for_chlorophenol_red(mass_spectrum):
|
|
74
|
+
#Chlorophenol Red – C19H12Cl2O5S - 421.978241
|
|
75
|
+
|
|
76
|
+
mass_spectrum.molecular_search_settings.min_ppm_error = -2
|
|
77
|
+
mass_spectrum.molecular_search_settings.max_ppm_error = 5
|
|
78
|
+
|
|
79
|
+
mass_spectrum.molecular_search_settings.usedAtoms['C'] = (1,90)
|
|
80
|
+
mass_spectrum.molecular_search_settings.usedAtoms['H'] = (4,200)
|
|
81
|
+
mass_spectrum.molecular_search_settings.usedAtoms['O'] = (5,5)
|
|
82
|
+
mass_spectrum.molecular_search_settings.usedAtoms['N'] = (0,0)
|
|
83
|
+
mass_spectrum.molecular_search_settings.usedAtoms['S'] = (1,1)
|
|
84
|
+
mass_spectrum.molecular_search_settings.usedAtoms['Cl'] = (2,2)
|
|
85
|
+
|
|
86
|
+
#enables the search for Cl compounds
|
|
87
|
+
mass_spectrum.molecular_search_settings.adduct_atoms_neg = ['Br', 'F']
|
|
88
|
+
|
|
89
|
+
mass_spectrum.molecular_search_settings.isProtonated = True
|
|
90
|
+
mass_spectrum.molecular_search_settings.isRadical= False
|
|
91
|
+
mass_spectrum.molecular_search_settings.isAdduct = False
|
|
92
|
+
|
|
93
|
+
mass_spectrum.molecular_search_settings.use_min_peaks_filter = False
|
|
94
|
+
|
|
95
|
+
if __name__ == "__main__":
|
|
96
|
+
|
|
97
|
+
list_dict = []
|
|
98
|
+
|
|
99
|
+
dirnames = get_dirnames()
|
|
100
|
+
|
|
101
|
+
if dirnames:
|
|
102
|
+
|
|
103
|
+
for file_location in dirnames:
|
|
104
|
+
|
|
105
|
+
print(file_location)
|
|
106
|
+
|
|
107
|
+
mass_spectrum = get_mass_spectrum(file_location)
|
|
108
|
+
|
|
109
|
+
set_settings_for_bromothymol_blue(mass_spectrum)
|
|
110
|
+
#set_settings_for_chlorophenol_red(mass_spectrum)
|
|
111
|
+
|
|
112
|
+
SearchMolecularFormulas(mass_spectrum, first_hit=True).run_worker_mass_spectrum()
|
|
113
|
+
|
|
114
|
+
#mass_error_prediction = MassErrorPrediction(mass_spectrum)
|
|
115
|
+
|
|
116
|
+
#mass_error_prediction.get_results()
|
|
117
|
+
|
|
118
|
+
ax = mass_spectrum.plot_mz_domain_profile()
|
|
119
|
+
#plt.show()
|
|
120
|
+
|
|
121
|
+
for mspeak in mass_spectrum:
|
|
122
|
+
|
|
123
|
+
if mspeak:
|
|
124
|
+
|
|
125
|
+
for mf in mspeak:
|
|
126
|
+
|
|
127
|
+
ax.plot(mspeak.mz_exp,mspeak.abundance, color='black', linewidth=0, marker='s', markersize = 8, label='Assigned')
|
|
128
|
+
|
|
129
|
+
if mf.is_isotopologue:
|
|
130
|
+
|
|
131
|
+
ax.annotate(round(mf.abundance_error,1), (mspeak.mz_exp+0.2, mspeak.abundance), label="Error (%)")
|
|
132
|
+
list_dict.append( {
|
|
133
|
+
|
|
134
|
+
"Sample Name" : mass_spectrum.sample_name,
|
|
135
|
+
"Resolving Power" : mspeak.resolving_power,
|
|
136
|
+
"Peak Height" : mspeak.abundance,
|
|
137
|
+
"Signal Noise Ratio" : mspeak.signal_to_noise,
|
|
138
|
+
"Calculated m/z" : mf.mz_calc,
|
|
139
|
+
"Experimental m/z" : mspeak.mz_exp,
|
|
140
|
+
"Error m/z" : mf.mz_error,
|
|
141
|
+
"Peak Area": mspeak.area,
|
|
142
|
+
"Molecular Formula" : mf.string,
|
|
143
|
+
"Probability Ratio": mf.prob_ratio,
|
|
144
|
+
"Area Ratio Error": mf.area_error,
|
|
145
|
+
"Abundance Error": mf.abundance_error,
|
|
146
|
+
"Peak Datapoint Count" : mspeak.final_index-mspeak.start_index
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
else:
|
|
150
|
+
print(mf.confidence_score)
|
|
151
|
+
print( mf.string, mf.mz_calc, mf.mz_error)
|
|
152
|
+
|
|
153
|
+
list_dict.append( {
|
|
154
|
+
|
|
155
|
+
"Sample Name" : mass_spectrum.sample_name,
|
|
156
|
+
"Resolving Power" : mspeak.resolving_power,
|
|
157
|
+
"Peak Height" : mspeak.abundance,
|
|
158
|
+
"Signal Noise Ratio" : mspeak.signal_to_noise,
|
|
159
|
+
"Calculated m/z" : mf.mz_calc,
|
|
160
|
+
"Experimental m/z" : mspeak.mz_exp,
|
|
161
|
+
"Error m/z" : mf.mz_error,
|
|
162
|
+
"Peak Area": mspeak.area,
|
|
163
|
+
"Molecular Formula" : mf.string,
|
|
164
|
+
"Peak Datapoint Count" : mspeak.final_index-mspeak.start_index
|
|
165
|
+
})
|
|
166
|
+
#ax.annotate(mspeak.mz_exp, (mspeak.mz_exp, mspeak.abundance))
|
|
167
|
+
|
|
168
|
+
for imf in mf.expected_isotopologues:
|
|
169
|
+
|
|
170
|
+
ax.plot(imf.mz_calc, imf.abundance_calc, color='red', linewidth=0, marker='v', markersize = 8, label='Calculated')
|
|
171
|
+
|
|
172
|
+
#ax.annotate(imf.string, (imf.mz_calc, imf.abundance_calc))
|
|
173
|
+
|
|
174
|
+
hand, labl = ax.get_legend_handles_labels()
|
|
175
|
+
handout=[]
|
|
176
|
+
lablout=[]
|
|
177
|
+
for h,l in zip(hand,labl):
|
|
178
|
+
if l not in lablout:
|
|
179
|
+
lablout.append(l)
|
|
180
|
+
handout.append(h)
|
|
181
|
+
|
|
182
|
+
plt.legend(handout, lablout)
|
|
183
|
+
plt.xlim(620,630)
|
|
184
|
+
# plt.show()
|
|
185
|
+
#plt.savefig(mass_spectrum.sample_name+"_area"+".png")
|
|
186
|
+
plt.cla()
|
|
187
|
+
|
|
188
|
+
export(list_dict, "Chlorophenol Red C19 H12 Cl2 O5 S1")
|
|
189
|
+
#export(list_dict, "Chlorophenol Red C19 H12 Cl2 O5 S1")
|
|
190
|
+
|
|
191
|
+
# Bromothymol Blue – C27H28Br2O5S - 622.002380
|
|
192
|
+
# Bromocresol Green – C21H14Br4O5S - 693.729492
|
|
193
|
+
# Chlorophenol Red – C19H12Cl2O5S - 421.978241
|
|
194
|
+
# Bromphenol Blue – C19H10Br4O5S(Na) - 665.698242
|
|
195
|
+
|
|
196
|
+
|