API Documentation


This module is a flask backend providing a REST api to add interactivity to the report.

The backend needs to be able to restore the phenotype database functionality and be able to generate plots.

These methods will return json to the report. Alternatively, they will return the native python objects. This way, the functionality will all be here and everything that’s related to the report’s content and formatting will be in the report module.

class forward.backend.Backend(experiment_name)[source]

Class that provides all api functionality to be used for both report creation and the rest api.

get_bonferonni(task_name, alpha)[source]

Get the Bonferonni adjusted alpha for a given task.


Return the YAML configuration file.

get_outcome_vector(variable, transformation=None, nan=True)[source]

Get an outcome vector (y).

  • variable (Numpy-like array) – The variable to query.
  • transformation (str) – The name of the transformation to apply (e.g. log)
  • nan (bool) – If False, the returned vector will be stripped of NaN values.


This is parsed from the hdf5 file that is automatically created.

Get information on the exclusions based on phenotype correlation.

get_results(task, filters=[], order_by=None, ascending=True)[source]

Get the results for a specific analysis.


Get the serialized information associated with a task.


Get a list of task names that were conducted in this experiment.


Get the correlation matrix and the row/column names.

get_variable_histogram(variable, transformation=None, **kwargs)[source]

Get the bin counts for a given variable.

This returns the numpy histogram’s function values.

get_variable_normal_qqplot(variable, transformation=None)[source]

Get scatter values for a normal QQ plot associated with a variable.

get_variables(var_type=None, order_by=None, ascending=True)[source]

Get the variables that were analysed in the experiment.

  • var_type (str) – Restrict to “discrete” or “continuous” variables (optional, default is None).
  • order_by – Key of the Variable instance for results ordering.
  • ascending (bool) – Flag to determine sorting order.

Get a list of variants and related fields.


Return the scatter data and confidence bands.

This is assuming we’re expecting a uniform distribution. We also take a log transform to accentuate small differences.

out = {
    "ci": [(ci_low, ci_high)],
    "outcomes": ["phen1", "phen2", ...],
    "expected": [exp1, exp2, ...],
    "lines": {
        "phen1": [obs1, obs2, ...],
        "phen2": [obs1, obs2, ...],

Returns a pygmentized version of the configuration file.


Initialize database connection and bind to the application context.