Main global portable module.
Properties:
Name | Type | Description |
---|---|---|
defineProperties |
function | |
explorePhenotypes |
function | |
loadScript |
function | |
saveFile |
function |
Namespaces
Methods
(static) addStyle()
Adds a style tag containing css for some plot elements.
(static) defineProperties(obj, m_fields, o_fieldsopt)
Adds a key-value pair as specified in m_fields
and o_fields
to obj
if the key does not already exist.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
obj |
object | An object. |
||
m_fields |
object | Mandatory fields. |
||
o_fields |
object |
<optional> |
{} | Optional fields. Same as |
(static) downloadJSON(contents, fileName) → {HTMLAnchorElement}
Saves a JSON as a .json file.
Parameters:
Name | Type | Description |
---|---|---|
contents |
object | A JS object. |
fileName |
string | The name of the file without extensions. |
Returns:
HTMLAnchorElement.
- Type
- HTMLAnchorElement
(static) explorePhenotypes(flattenopt, miniopt, graphopt, div_id, customLayoutopt, customConfigopt)
Provides a way to explore all the available phenotypes.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
flatten |
boolean |
<optional> |
false | If 'true', returns an array of objects instead of a tree. |
mini |
boolean |
<optional> |
false | If 'true', removes keys from the objects to provide a condensed view. |
graph |
boolean |
<optional> |
false | If 'true', returns a Plotly chart instead of an array of objects. |
div_id |
string | Used when graph is 'true', plots a Plotly chart at that container. |
||
customLayout |
object |
<optional> |
{} | Optional. Contains Plotly supported layout key-values pair that will overwrite the default layout. Commonly overwritten values may include height and width of the graph. See: https://plotly.com/javascript/reference/layout/ for more details. Also, set |
customConfig |
object |
<optional> |
{} | Optional. Contains Plotly supported config key-values pair that will overwrite the default config. See: https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L22-L86 for full details. |
Returns:
An array of objects.
(static) fetch(url)
Fetches the result of the url
from localForage if it exists else calls a HTTP request to the url
and stores it into
localForage.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The url will be used as the key when storing its response into IndexedDB. |
Returns:
Url HTTP response.
(static) loadScript(url, host) → {HTMLScriptElement}
Creates and attaches a new script tag to head with script src pointing at url
.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | |
host |
string |
Returns:
HTMLScriptElement
- Type
- HTMLScriptElement
(static) saveFile(url) → {HTMLAnchorElement}
TEMP work-around for the CORS issue, do NOT use in the final SDK.
Instead, fetch the blob from the API and use a blob link just like in jmat.
Modified from https://github.com/jonasalmeida/jmat.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The download link. |
Returns:
HTMLAnchorElement.
- Type
- HTMLAnchorElement