Data Handling and Manipulation#

API symbols for the data transform implementation.

Data Transform API#

Defines

VRNA_TRANSFORM_ENFORCE_DOMAIN_SOURCE#

Options flag for transforming linear data to enforce source domain limits.

#include <ViennaRNA/data/transform.h>

VRNA_TRANSFORM_ENFORCE_DOMAIN_TARGET#

Options flag for transforming linear data to enforce target domain limits.

#include <ViennaRNA/data/transform.h>

VRNA_TRANSFORM_ENFORCE_DOMAINS#

Options flag for transforming linear data to enforce source and target domain limits.

#include <ViennaRNA/data/transform.h>

VRNA_TRANSFORM_MAP_SOURCE_LOW#

Options flag for transforming linear data to map source values below the domain limit to the lower domain limit.

#include <ViennaRNA/data/transform.h>

VRNA_TRANSFORM_MAP_SOURCE_HIGH#

Options flag for transforming linear data to map source values above the domain limit to the upper domain limit.

#include <ViennaRNA/data/transform.h>

VRNA_TRANSFORM_MAP_SOURCE#

Options flag for transforming linear data to map source values below and above the domain limits to the domain limits.

#include <ViennaRNA/data/transform.h>

VRNA_TRANSFORM_MAP_TARGET_LOW#

Options flag for transforming linear data to map target values below the domain limit to the lower domain limit.

#include <ViennaRNA/data/transform.h>

VRNA_TRANSFORM_MAP_TARGET_HIGH#

Options flag for transforming linear data to map target values above the domain limit to the upper domain limit.

#include <ViennaRNA/data/transform.h>

VRNA_TRANSFORM_MAP_TARGET#

Options flag for transforming linear data to map target values below and above the domain limits to the domain limits.

#include <ViennaRNA/data/transform.h>

VRNA_TRANSFORM_MAP#

Options flag for transforming linear data to map source and target values below and above the domain limits to the respective domain limits.

#include <ViennaRNA/data/transform.h>

VRNA_TRANSFORM_DEFAULT#

Options flag for transforming linear data that indicates default settings.

#include <ViennaRNA/data/transform.h>

Functions

double *vrna_data_lin_transform(const double *data, size_t data_size, vrna_math_fun_dbl_f transform_cb, vrna_math_fun_dbl_opt_t transform_opt, double domain[4], double oob_value, unsigned int options)#

Transform an array of linear data.

#include <ViennaRNA/data/transform.h>

This function transforms an array of linear data (source) into another array of linear data of the same size (target). For that purpose, it utilizes a callback mechanism that transforms each single value.

During data transform, the callback function (transform_cb) will be executed for each value of the linear data (data) and is responsible to actually transform the data value. The transform_opt parameter will be simply passed-through to the callback function as second argument. The callback function has to return the transformed value.

This transformation function may enforce source and target domain limits if the corresponding flag (VRNA_TRANSFORM_ENFORCE_DOMAINS) is provided to the options argument. This means that one has complete control over the accepted values of the source and target domains. The limits can be provided to this function through the domain argument. Here, the order of the limits follows:

\[ x_\text{min}, x_\text{max}, y_\text{min}, y_\text{max}. \]

If NULL is passed instead of an actual domain array, domain enforcement is deactivated and any value will pass. In case a domain enforcing is active and a source or target value doesn’t meet the respective limits, the function assigns it the out-of-bounds value oob_value. This behavior can be changed to a mapping of out-of-bounds values to the respetive domain limits. For that purpose, the options argument requires the flag VRNA_TRANSFORM_MAP.

Note

Individual control for mapping out-of-bounds values to the four domain limits, i.e. low and high values of source and target can be gained by providing the options argument the VRNA_TRANSFORM_MAP_SOURCE_LOW, VRNA_TRANSFORM_MAP_SOURCE_HIGH, VRNA_TRANSFORM_MAP_TARGET_LOW, and VRNA_TRANSFORM_MAP_TARGET_HIGH flags.

Note

When data is NULL or data_size equals 0, the function returns NULL. Moreover, the function simply provides a copy of the linear data if the transformation callback transform_cb is not provided, i.e. if it is NULL. In this case, domain limits will still be enforced if the corresponding options are set.

Parameters:
  • data – A pointer to an array of linear data

  • data_size – The size of the array data is pointing to

  • transform_cb – The data transformation callback (maybe NULL)

  • transform_opt – The options that need to be passed through to the transformation callback transform_cb (maybe NULL)

  • domain – The domain limits (maybe NULL)

  • oob_value – Out-of-bound value

  • options – Additional options that change the behavior of the transformation function

Returns:

A pointer to an array of transformed linear data (or NULL on any error)