Skip to content

Commit 2b2a97a

Browse files
author
Ciesielski, Danielle K
committed
change mass feature language
1 parent a0fee07 commit 2b2a97a

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

corems/mass_spectra/factory/lc_class.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -913,20 +913,20 @@ def mass_features_ms2_annot_to_df(self, molecular_metadata=None):
913913

914914
return annot_ms2_df_full
915915

916-
def plot_composite_mass_features(self, binsize = 1e-4, mf_plot = True, ms2_plot = True, return_fig = False):
916+
def plot_composite_features(self, binsize = 1e-4, mf_plot = True, ms2_plot = True, return_fig = False):
917917
"""Returns a figure displaying
918918
(1) thresholded, unprocessed data
919-
(2) the mass features
920-
(3) which mass features are associated with MS2 spectra
919+
(2) the m/z features
920+
(3) which m/z features are associated with MS2 spectra
921921
922922
Parameters
923923
-----------
924924
binsize : float
925925
Desired binsize for the m/z axis of the composite feature map. Defaults to 1e-4.
926926
mf_plot : boolean
927-
Indicates whether to plot the mass features. Defaults to True.
927+
Indicates whether to plot the m/z features. Defaults to True.
928928
ms2_plot : boolean
929-
Indicates whether to identify mass features with associated MS2 spectra. Defaults to True.
929+
Indicates whether to identify m/z features with associated MS2 spectra. Defaults to True.
930930
return_fig : boolean
931931
Indicates whether to plot composite feature map (False) or return figure object (True). Defaults to False.
932932
@@ -935,15 +935,15 @@ def plot_composite_mass_features(self, binsize = 1e-4, mf_plot = True, ms2_plot
935935
matplotlib.pyplot.Figure
936936
A figure with the thresholded, unprocessed data on an axis of m/z value with respect to
937937
scan time. Unprocessed data is displayed in gray scale with darker colors indicating
938-
higher intensities. If mass features are plotted, they are displayed in cyan. If mass
938+
higher intensities. If m/z features are plotted, they are displayed in cyan. If m/z
939939
features with associated with MS2 spectra are plotted, they are displayed in red.
940940
941941
Raises
942942
------
943943
Warning
944-
If mass features are set to be plot but aren't in the dataset.
945-
If mass features with associated MS2 data are set to be plot but no MS2 annotations
946-
were found for the mass features in the dataset.
944+
If m/z features are set to be plot but aren't in the dataset.
945+
If m/z features with associated MS2 data are set to be plot but no MS2 annotations
946+
were found for the m/z features in the dataset.
947947
"""
948948
if mf_plot:
949949
# Check if mass_features is set, raise error if not
@@ -962,7 +962,7 @@ def plot_composite_mass_features(self, binsize = 1e-4, mf_plot = True, ms2_plot
962962
"mass_features not set, must run find_mass_features() first"
963963
)
964964

965-
## call mass feature data
965+
## call m/z feature data
966966
mf_df = self.mass_features_to_df()
967967

968968
# Check if ms2_spectrum is set, raise error if not
@@ -975,7 +975,7 @@ def plot_composite_mass_features(self, binsize = 1e-4, mf_plot = True, ms2_plot
975975
df = self._ms_unprocessed[1].copy()
976976
df = df.dropna(subset=['intensity']).reset_index(drop = True)
977977
threshold = self.parameters.lc_ms.ph_inten_min_rel * df.intensity.max()
978-
df_thres = df[df["intensity"] > threshold].reset_index(drop=True).copy()
978+
df_thres = df[df["intensity"] > threshold].reset_index(drop = True).copy()
979979
df = self.grid_data(df_thres)
980980

981981
## format unprocessed data for plotting
@@ -1004,15 +1004,15 @@ def plot_composite_mass_features(self, binsize = 1e-4, mf_plot = True, ms2_plot
10041004
mf_df[mf_df.ms2_spectrum.isna()].mz,
10051005
c = 'c',
10061006
s = 4,
1007-
label = 'Mass features without MS2'
1007+
label = 'M/Z features without MS2'
10081008
)
10091009
else:
10101010
plt.scatter(
10111011
mf_df.scan_time,
10121012
mf_df.mz,
10131013
c = 'c',
10141014
s = 4,
1015-
label = 'Mass features'
1015+
label = 'M/Z features'
10161016
)
10171017

10181018
if ms2_plot:
@@ -1021,7 +1021,7 @@ def plot_composite_mass_features(self, binsize = 1e-4, mf_plot = True, ms2_plot
10211021
mf_df[~mf_df.ms2_spectrum.isna()].mz,
10221022
c = 'r',
10231023
s = 2,
1024-
label = 'Mass features with MS2'
1024+
label = 'M/Z features with MS2'
10251025
)
10261026

10271027
plt.legend(loc = 'lower center', bbox_to_anchor = (0.5, -0.25), ncol = 2)

tests/test_wf_lipidomics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_lipidomics_workflow():
147147
myLCMSobj.add_associated_ms2_dda(spectrum_mode="centroid", ms_params_key="ms2_cid", scan_filter="cid")
148148
assert len(myLCMSobj._ms) > og_ms_len
149149

150-
myLCMSobj.plot_composite_mass_features()
150+
myLCMSobj.plot_composite_features()
151151

152152
# Export the mass features to a pandas dataframe
153153
df = myLCMSobj.mass_features_to_df()

0 commit comments

Comments
 (0)