JavaScript API¶
- class escher.Builder(map_data, model_data, embedded_css, options)¶
A Builder object contains all the UI and logic to generate a map builder or viewer.
Arguments: - map_data (object) – The data for a map, to be passed to escher.Map.from_data(). If null, then an empty Builder is initialized
- model_data (object) – The data for a cobra model, to be passed to escher.CobraModel(). Can be null.
- embedded_css (string) – The stylesheet for the SVG elements in the Escher map.
- selection (object) – (Optional, Default: In the body element) The d3 selection of an element to place the Builder into. The selection cannot be inside an SVG element.
- options (object) –
- (Optional) An object defining any of the following
- options:
- options.unique_map_id¶
A unique ID that will be used to UI elements don’t interfere when multiple maps are in the same HTML document.
- options.primary_metabolite_radius¶
(Default: 15) The radius of primary metabolites, in px.
- options.secondary_metabolite_radius¶
(Default: 10) The radius of secondary metabolites, in px.
- options.marker_radius¶
(Default: 5) The radius of marker nodes, in px.
- options.gene_font_size¶
(Default: 18) The font size of the gene reaction rules, in px.
- options.hide_secondary_nodes¶
(Default: false) If true, then secondary nodes and segments are hidden. This is convenient for generating simplified map figures.
- options.show_gene_reaction_rules¶
(Default: false) If true, then show the gene reaction rules, even without gene data.
- options.reaction_data¶
An object with reaction ids for keys and reaction data points for values.
- options.reaction_styles¶
- options.reaction_compare_style¶
(Default: ‘diff’) How to compare to datasets. Can be either ‘fold, ‘log2_fold’, or ‘diff’.
- options.reaction_scale¶
- options.reaction_no_data_color¶
- options.reaction_no_data_size¶
- options.gene_data¶
An object with Gene ids for keys and gene data points for values.
- options.and_method_in_gene_reaction_rule¶
(Default: mean) When evaluating a gene reaction rule, use this function to evaluate AND rules. Can be ‘mean’ or ‘min’.
- options.metabolite_data¶
An object with metabolite ids for keys and metabolite data points for values.
- options.metabolite_compare_style¶
(Default: ‘diff’) How to compare to datasets. Can be either ‘fold’, ‘log2_fold’ or ‘diff’.
- options.metabolite_scale¶
- options.metabolite_no_data_color¶
- options.metabolite_no_data_size¶
View and build options
- options.identifiers_on_map¶
Either ‘bigg_id’ (default) or ‘name’.
- options.highlight_missing¶
(Default: false) If true, then highlight reactions that are not in the loaded model in red.
- options.allow_building_duplicate_reactions¶
(Default: true) If true, then building duplicate reactions is allowed. If false, then duplicate reactions are hidden in Add reaction mode.
Callbacks
- options.first_load_callback¶
A function to run after loading the Builder.
Callbacks
this.callback_manager.run('view_mode'); this.callback_manager.run('build_mode'); this.callback_manager.run('brush_mode'); this.callback_manager.run('zoom_mode'); this.callback_manager.run('rotate_mode'); this.callback_manager.run('text_mode'); this.callback_manager.run('load_model', null, model_data, should_update_data); this.callback_manager.run('update_data', null, update_model, update_map, kind, should_draw);
- load_map(map_data[, should_update_data])¶
Load a map for the loaded data. Also reloads most of the Builder content.
Arguments: - map_data – The data for a map.
- should_update_data (Boolean) – (Default: true) Whether data should be applied to the map.
- load_model(model_data[, should_update_data])¶
Load the cobra model from model data.
Arguments: - model_data – The data for a Cobra model. (Parsing in done by escher.CobraModel).
- should_update_data (Boolean) – (Default: true) Whether data should be applied to the model.
- view_mode()¶
Enter view mode.
- build_mode()¶
Enter build mode.
- brush_mode()¶
Enter brush mode.
- zoom_mode()¶
Enter zoom mode.
- rotate_mode()¶
Enter rotate mode.
- text_mode()¶
Enter text mode.
- set_reaction_data(data)¶
Arguments: - data (array) – An array of 1 or 2 objects, where each object has keys that are reaction ID’s and values that are data points (numbers).
- set_metabolite_data(data)¶
Arguments: - data (array) – An array of 1 or 2 objects, where each object has keys that are metabolite ID’s and values that are data points (numbers).
- set_gene_data(data)¶
Arguments: - data (array) – An array of 1 or 2 objects, where each object has keys that are gene ID’s and values that are data points (numbers).