Reference¶
dataprep.py
¶
- class isoplot.main.dataprep.IsoplotData(datapath, verbose=False)¶
Bases:
object
Class to prepare Isoplot Data for plotting
- Parameters
datapath (str) – Path to .csv file containing Isocor output data
- generate_template()¶
Generate .xlsx template that user must fill
- get_data()¶
Read data from tsv file and store in object data attribute.
- get_template(path)¶
Read user-filled template and catch any encoding errors
- static load_isocor_data(path)¶
Function to read incoming data
- static load_template(template_input, excel_sheet=0)¶
Function to read incoming template data
- merge_data()¶
Merge template and data into pandas dataframe
- prepare_data(export=True)¶
Final cleaning of data and export
plots.py
¶
Module containing the plotting classes. The methods correspond to different types of plots to create
- class isoplot.main.plots.InteractivePlot(stack, value, data, name, metabolite, condition, time, display, rtrn)¶
Bases:
isoplot.main.plots.Plot
Class to generate the different interactive plots
- mean_enrichment_meanplot()¶
Generate interactive mean_enrichment plots with meaned replicates
- mean_enrichment_plot()¶
Generate interactive mean_enrichment plots
- stacked_areaplot()¶
Generate interactive stacked areaplots
- stacked_barplot()¶
Generate interactive stacked barplots
- stacked_meanplot()¶
Generate interactive stacked barplots with meaned replicates
- unstacked_barplot()¶
Generate interactive unstacked barplots
- unstacked_meanplot()¶
Generate interactive unstacked barplots with meaned replicates
- class isoplot.main.plots.Map(data, name, annot, fmt, display=False, rtrn=False)¶
Bases:
object
Class to create maps from Isocor output (MS data from C13 labelling experiments)
- Parameters
annot (Bool) – Should annotations be apparent on map or not
- build_clustermap()¶
Create a clustermap of mean_enrichment data across all conditions & times & metabolites
- build_heatmap()¶
Create a heatmap of mean_enrichment data across all conditions & times & metabolites
- build_interactive_heatmap()¶
Create an interactive heatmap of mean_enrichment data across all conditions & times & metabolites
- class isoplot.main.plots.Plot(stack, value, data, name, metabolite, condition, time, display, rtrn=False)¶
Bases:
object
Plot objects Master Class from which the rest inherit
- Parameters
stack (Bool) – Value to denote if barplots should stack
value (str) – Data to be plotted. Can be ‘isotopologue_fraction’, ‘corrected area’ or ‘mean_enrichment’
data (Pandas Dataframe) – IsoplotData object containing clean data
name (str) – Name for generated file directory where plots will go
metabolite (str) – metabolite to be plotted
condition (list) – List of conditions to be plotted
time (list) – List of times to be plotted
display (Bool) – Should plots be displayed when created
rtrn (Bool) – Should figure object be returned or not
- HEIGHT = 640¶
- WIDTH = 1080¶
- static split_ids(ids)¶
Function to split IDs and get back lists of conditions, times and replicates in order
- Parameters
ids (list) – IDs generated by IsoplotData Object
- Returns
lists containing conditions, times and replicates
- Return type
lists
- class isoplot.main.plots.StaticPlot(stack, value, data, name, metabolite, condition, time, fmt, display, rtrn)¶
Bases:
isoplot.main.plots.Plot
Class to generate the different static plots.
- Parameters
fmt (str) – Output format of static plots (pdf, svg, png or jpeg)
display (Bool) – Should plots be displayed when created
- barplot()¶
Creation of barplots
- mean_barplot()¶
Creation of meaned barplots (on replicates)
- mean_enrichment_meanplot()¶
Generate static mean_enrichment plots with meaned replicates
- mean_enrichment_plot()¶
Generate static mean_enrichment plots
- stacked_areaplot()¶
Creation of area stackplot (for cinetic data)
isoplotcli.py
¶
Module containing the CLI class that will be used during the cli process to get arguments from user and generate the desired plots
- class isoplot.ui.isoplotcli.IsoplotCli(home=None, run_home=None, static_plot=None, int_plot=None, maps=None, args=None)¶
Bases:
object
- dir_init(plot_type)¶
Initialize directory for plot
- static get_cli_input(arg, param, data_object)¶
Function to get input from user and check for errors in spelling. If an error is detected input is asked once more. This function is used for galaxy implementation
- Parameters
arg – list from which strings must be parsed
param (str) – name of what we are looking for
data_object (class: 'isoplot.dataprep.IsoplotData') – IsoplotData object containing final clean dataframe
- Returns
Desired string after parsing
- Return type
list
- go_home()¶
Exit after work is done
- initialize_cli()¶
Launch argument parsing and perform checks
- plot_figs(metabolite_list, data_object, build_zip=False)¶
Function to control which plot methods are called depending on the arguments that were parsed
- Parameters
metabolite_list (list of str) – metabolites to be plotted
data_object (class: 'isoplot.main.dataprep.IsoplotData') – object containing the prepared data
build_zip (bool) – should figures be returned and exported in zip
- zip_export(figures, zip_file_name)¶
Function to save figures in figure list to zip file (taken from https://stackoverflow.com/questions/55616877/save-multiple-objects-to-zip-directly-from-memory-in-python)
- Parameters
figures (list of tuples) – storage of figures and their respective file names in tuples: (name, fig)
zip_file_name (str) – name of the exported zip file
- isoplot.ui.isoplotcli.parse_args()¶
Parse arguments from user input.
- Returns
Argument Parser object
- Return type
class: argparse.ArgumentParser
cli_process.py
¶
Process that runs during Command-Line Interface usage
- isoplot.main.cli_process.main()¶
isoplot_notebook.py
¶
- isoplot.ui.isoplot_notebook.build_map(data, name, map_select, annot, fmt, display)¶
- isoplot.ui.isoplot_notebook.check_version(name)¶
- isoplot.ui.isoplot_notebook.dataprep_eventhandler(event)¶
- isoplot.ui.isoplot_notebook.indibokplot(stack, value, data, name, metabolites, conditions, times, display, stackplot=False)¶
- isoplot.ui.isoplot_notebook.indiplot(stack, value, data, name, metabolites, conditions, times, fmt, display, stackplot=False)¶
- isoplot.ui.isoplot_notebook.make_mduploader()¶
- isoplot.ui.isoplot_notebook.make_uploader()¶
- isoplot.ui.isoplot_notebook.meanbokplot(stack, value, data, name, metabolites, conditions, times, display)¶
- isoplot.ui.isoplot_notebook.meanplot(stack, value, data, name, metabolites, conditions, times, fmt, display)¶
- isoplot.ui.isoplot_notebook.metadatabtn_eventhandler(event)¶