Skip to content

Commit

Permalink
#53 ADD docs viz.xic_plot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jalew188 committed Jun 15, 2024
1 parent 1e61737 commit 65b1d36
Showing 1 changed file with 64 additions and 21 deletions.
85 changes: 64 additions & 21 deletions alpharaw/viz/xic_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,36 @@ def plot(
create_new_fig=True,
plot_rows=1,
ith_plot_row=0,
):
)->go.Figure:
"""
_summary_
Main entry of `XIC_Plot`.
Parameters
----------
spectrum_df : pd.DataFrame
_description_
The spectrum dataframe in alpharaw format
peak_df : pd.DataFrame
_description_
The peak dataframe in alpharaw format
query_df : pd.DataFrame
_description_
The query dataframe generated by:
:func:`alpharaw.viz.df_utils.make_query_df_for_peptide`, or
:func:`alpharaw.viz.df_utils.make_query_df`
title : str, optional
_description_, by default ""
Plot title, by default ""
add_peak_area : bool, optional
_description_, by default False
If add peak area in the hover text, by default False
create_new_fig : bool, optional
_description_, by default True
If create a new figure, otherwise plot in `self.fig`, by default True
plot_rows : int, optional
_description_, by default 1
If create_new_fig, how many rows (subplots) to create, by default 1
ith_plot_row : int, optional
_description_, by default 0
If not create_new_fig, this parameter refers to the row number
in `self.fig`, by default 0
Returns
-------
_type_
_description_
go.Figure
XIC plot figure
"""
if "rt_sec" in query_df.columns:
rt_sec = query_df.rt_sec.values[0]
Expand Down Expand Up @@ -208,7 +211,47 @@ def plot_query_masses(
create_new_fig=True,
plot_rows=1,
ith_plot_row=0,
):
)->go.Figure:
"""
The other entry of `XIC_Plot`
Parameters
----------
spectrum_df : pd.DataFrame
The spectrum dataframe in alpharaw format
peak_df : pd.DataFrame
The peak dataframe in alpharaw format
query_masses : np.ndarray
The query m/z values to extract XIC profiles
query_ion_names : typing.List[str]
The query ion names
query_rt_sec : float
RT in seconds
precursor_left_mz : float
Left m/z of precursor window for given queries to extract XIC
precursor_right_mz : float
Right m/z of precursor window for given queries to extract XIC
marker_colors : list, optional
Colors of each XIC profile, by default None
other_plot_infos : typing.List[str], optional
Other plot information for hover text, by default None
query_intensities : np.ndarray, optional
Query intensities for mirror plot, by default None
title : str, optional
Plot title, by default ""
create_new_fig : bool, optional
If create a new figure, otherwise plot in `self.fig`, by default True
plot_rows : int, optional
If create_new_fig, how many rows (subplots) to create, by default 1
ith_plot_row : int, optional
If not create_new_fig, this parameter refers to the row number
in `self.fig`, by default 0
Returns
-------
go.Figure
XIC plot figure
"""
if create_new_fig:
self._init_plot(rows=plot_rows)
mass_tols = (
Expand Down Expand Up @@ -422,7 +465,7 @@ def get_peak_area(
precursor_right_mz: float = -1.0,
) -> np.ndarray:
"""
Get peak area values for each of the `query_masses`
Get peak area values for each of query in `query_masses`
Parameters
----------
Expand All @@ -435,18 +478,18 @@ def get_peak_area(
mass_tols : np.ndarray
The query m/z tolerance in Da
query_start_rt_sec : float
_description_
Start RT in seconds
query_stop_rt_sec : float
_description_
precursor_left_mz : float, optional
_description_, by default -1.0
precursor_right_mz : float, optional
_description_, by default -1.0
Stop RT in seconds
precursor_left_mz : float
Left m/z of precursor window for given queries to extract XIC
precursor_right_mz : float
Right m/z of precursor window for given queries to extract XIC
Returns
-------
np.ndarray
_description_
peak area values for each of query
"""
spec_idxes = get_spec_idxes_from_df(
spectrum_df,
Expand Down

0 comments on commit 65b1d36

Please sign in to comment.