metbit.ui_stocsy
Visualization and apps module in metbit 8.7.5.
import metbit.ui_stocsyClasses
STOCSY_app
A Dash application for visualizing NMR spectra and performing STOCSY analysis.
Parameters:
spectrapd.DataFrameDataFrame containing the NMR spectra data.
ppmlistList of PPM (parts per million) values corresponding to the spectra.
Methods:
run_ui() -> dash.Dash: Sets up the Dash UI layout, initializes the application callbacks, and returns the app instance.
Example:
# Load your NMR spectra data df = pd.read_csv("https://raw.githubusercontent.com/aeiwz/example_data/main/dataset/Example_NMR_data.csv") spectra = df.iloc[:,1:] ppm = spectra.columns.astype(float).to_list()
# Create instance of the class with spectra and ppm data stocsy_app = STOCSY_app(spectra, ppm)
# Get the app instance app = stocsy_app.run_ui()
# Run the app app.run_server(debug=True, port=8051)
Methods
__init__(self, spectra: pd.DataFrame, ppm: list)
Initializes the STOCSY_app with NMR spectra and corresponding PPM values.
Parameters:
spectrapd.DataFrameA DataFrame containing the NMR spectra data, where each row represents a sample.
ppmlistA list of PPM values corresponding to the spectral data columns.
cached_stocsy(self, x_peak, pvalue_threshold)
Cache the STOCSY analysis results to avoid redundant computation.