Top Banner
1 GLUTRAN: a Matlab toolbox for glucose tracer analysis Andrea Mari, 22 March 2009 Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis) is a collection of Matlab functions for the calculation of glucose fluxes in non-steady state from tracer data. GLUTRAN is based on the circulatory model for glucose kinetics described by Mari et al. (1; 2). Each function of the toolbox performs a specific task in the analysis of the tracer data; the collection of these functions allows the user to solve a variety of tracer problems. Matlab is required to perform the calculations (details on Matlab requirements and GLUTRAN installation are given in Appendix 1). The Matlab interface is a command window; the functions are thus executed as commands and not using a graphical interface (see Appendix 2 for a quick outline of the Matlab command interface). The functions used to solve a specific problem (e.g. calculation of glucose absorption and production during an oral glucose load) are typically grouped in a Matlab script and executed in sequence. Tracer analysis steps With GLUTRAN, the data analysis procedure follows the steps described below. Each step involves a few Matlab commands, depending on the problem and the user’s needs. 1. Data must be first made available to Matlab, i.e., must be loaded in the Matlab workspace. Matlab basically stores the data as arrays. The procedures for importing data (e.g. reading data from Excel files) are provided by Matlab. Because the original data may be in very different formats, GLUTRAN does not provide utilities for this purpose. 2. A basic requirement for non-steady state tracer analysis is to specify the model of glucose kinetics and its parameters. Even in the simplest non-steady state tracer approach, Steele’s equation (3), the effective glucose distribution volume must be specified. GLUTRAN, which is based on a more accurate model of glucose kinetics (1; 2), offers the following options: a. The model parameters are assumed to be the same in all analyzed cases and taken from the literature. Currently, parameters are available for human subjects and anesthetized rats (1; 2). The use of fixed parameters is the simplest procedure, though possibly less accurate. b. The model parameters can be individually estimated from steady-state tracer data. For instance, the experiment may include a tracer equilibration period following a primed-continuous tracer infusion. If tracer concentration is frequently measured in this period, individual model parameters can be obtained. GLUTRAN contains all the necessary functions to perform this preliminary step (see the next sections). 3. Once the model parameters are set, GLUTRAN determines from the intravenous infusion of the tracer and tracer concentration the time course of glucose clearance. This step also completely determines glucose kinetics in non-steady state in the specific experiment and allows successive calculation of the glucose fluxes. The time- varying glucose clearance is determined by fitting the non-steady-state model to the
21

GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

Jun 14, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

1

GLUTRAN: a Matlab toolbox for glucose tracer analysis Andrea Mari, 22 March 2009 Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis) is a collection of Matlab functions for the calculation of glucose fluxes in non-steady state from tracer data. GLUTRAN is based on the circulatory model for glucose kinetics described by Mari et al. (1; 2). Each function of the toolbox performs a specific task in the analysis of the tracer data; the collection of these functions allows the user to solve a variety of tracer problems. Matlab is required to perform the calculations (details on Matlab requirements and GLUTRAN installation are given in Appendix 1). The Matlab interface is a command window; the functions are thus executed as commands and not using a graphical interface (see Appendix 2 for a quick outline of the Matlab command interface). The functions used to solve a specific problem (e.g. calculation of glucose absorption and production during an oral glucose load) are typically grouped in a Matlab script and executed in sequence. Tracer analysis steps With GLUTRAN, the data analysis procedure follows the steps described below. Each step involves a few Matlab commands, depending on the problem and the user’s needs.

1. Data must be first made available to Matlab, i.e., must be loaded in the Matlab workspace. Matlab basically stores the data as arrays. The procedures for importing data (e.g. reading data from Excel files) are provided by Matlab. Because the original data may be in very different formats, GLUTRAN does not provide utilities for this purpose.

2. A basic requirement for non-steady state tracer analysis is to specify the model of glucose kinetics and its parameters. Even in the simplest non-steady state tracer approach, Steele’s equation (3), the effective glucose distribution volume must be specified. GLUTRAN, which is based on a more accurate model of glucose kinetics (1; 2), offers the following options:

a. The model parameters are assumed to be the same in all analyzed cases and taken from the literature. Currently, parameters are available for human subjects and anesthetized rats (1; 2). The use of fixed parameters is the simplest procedure, though possibly less accurate.

b. The model parameters can be individually estimated from steady-state tracer data. For instance, the experiment may include a tracer equilibration period following a primed-continuous tracer infusion. If tracer concentration is frequently measured in this period, individual model parameters can be obtained. GLUTRAN contains all the necessary functions to perform this preliminary step (see the next sections).

3. Once the model parameters are set, GLUTRAN determines from the intravenous infusion of the tracer and tracer concentration the time course of glucose clearance. This step also completely determines glucose kinetics in non-steady state in the specific experiment and allows successive calculation of the glucose fluxes. The time-varying glucose clearance is determined by fitting the non-steady-state model to the

Page 2: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

2

tracer data. This procedure requires some iterative steps, as the degree of accuracy of the fit (i.e., the differenced between the measured and the model-predicted tracer concentration) depends on a user-defined parameter. This user-defined parameter controls the smoothness of the glucose clearance and must be set to a value that gives a reasonable compromise between smoothness of the glucose clearance and accuracy of the fit. Overfitting produces high unphysiological clearance fluctuations; excessive clearance smoothing gives a poor data fit.

4. From the model, glucose clearance and glucose concentration, the glucose rate of appearance is calculated. GLUTRAN performs this step with procedures that are analogous to deconvolution. In these procedures, as in the determination of glucose clearance (step above), it is necessary to choose iteratively a smoothing factor for the rate of glucose appearance.

5. For tracer experiments involving two tracers, such as the double-tracer method for determining glucose absorption and production during an oral glucose load, the appearance of oral and endogenous glucose are calculated separately using the concentration components due to oral and endogenous glucose, determined directly from the tracer data. With GLUTRAN, no subtraction of an oral rate of appearance from a total rate of appearance is needed as in more classical methods. Similarly, calculation of glucose production during a glucose clamp (either with the constant tracer infusion rate or with the tracer added to the clamp infusate) can be performed without subtracting two rates of appearance.

6. In the last step, the calculated data are saved in a format suitable for plotting or successive analysis. Some calculations, such as the integrals of the rates of appearance are very easily calculated with Matlab.

In GLUTRAN, the commands for each step are available in a template script and illustrated with comments (see Appendix 3). These commands can be adapted to the user’s needs. GLUTRAN vs more traditional approaches There are two main reasons why GLUTRAN has been developed. First, previous approaches (such as Smart (4; 5)) were impossible to maintain because were written in a programming language (Excel macro language) subject to radical changes. Second, GLUTRAN uses state-of-the art modeling and computational methods and is therefore much more powerful, flexible and numerically stable than the previous approaches. Unfortunately this has sacrificed the graphical interface and requires somewhat more complex decisions by the user. In addition, GLUTRAN requires a Matlab license. However, a Matlab demo script is provided with a complete analysis session, which can be customized according to the user’s needs (the demo script is illustrated in the following sections and reported in Appendix 3). The commands in the scripts are easily executed step by step (using the right-click menu in Windows). Stable vs radioactive tracers GLUTRAN handles stable and radioactive tracers in the same way, as it uses concentrations and not specific activity or the tracer to tracee ratio. To use GLUTRAN correctly, tracer data must be first transformed in concentrations using the appropriate equations, which differ between stable and radioactive tracers. No tool for conversion of stable isotope data is

Page 3: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

3

provided, as the appropriate method may be dependent on the mass-spec procedures. Users should refer to the mass-spec experts and to the literature in the field. Units The units of the results obtained with GLUTRAN depend on the units of the data and the option used to set some constants of the circulatory model. A fundamental constant is cardiac output, which can be expressed e.g. in ml/min/kg of body weight or in ml/min/m2 body surface area. The glucose clearance is expressed in the same units of cardiac output; therefore, the units for tracer concentration and infusion must be consistent with the units for clearance. For example, if the cardiac output units are ml/min/kg and tracer concentration is measured in dpm/ml, the tracer infusion rate must be expressed in dpm/min/kg, so that the units for clearance are indeed (dpm/min/kg)/(dpm/ml)=ml/min/kg. The units for the glucose fluxes inherit the units of glucose clearance and glucose concentration. For instance, if clearance is expressed in ml/min/kg and glucose concentration is in mmol/l, the glucose rate of appearance is in (mmol/l)*(ml/min/kg)=µmol/min/kg. GLUTRAN toolboxes and functions GLUTRAN is composed of 4 toolboxes: Data objects, Circulatory model, ODE models and Deconvolution. The Circulatory model toolbox is the core of GLUTRAN: it contains the functions to run the circulatory model for steady and non-steady-state glucose kinetics. The ODE models toolbox contains functions for model simulation. The Deconvolution toolbox contains functions used in the calculation of the glucose rate of appearance. The Data objects toolbox is an auxiliary toolbox designed to work with data representing time series. Typical time series in the context of tracer analysis are the concentration values and the rates of infusion. With the Data objects toolbox, these data are handled in a very simple and effective way. The toolbox functions have a help section describing their purpose and the input and output arguments. Often functions offer many options and may have a complex calling syntax. The procedure for performing tracer analysis outlined above is illustrated in greater detail in the following sections. The demo script demoogtt.m in the Circulatory model toolbox is a template for the analysis; it refers to a double tracer OGTT experiment (see Appendix 3). References 1. Mari A, Stojanovska L, Proietto J, Thorburn AW: A circulatory model for calculating non-steady-state glucose fluxes. Validation and comparison with compartmental models. Comput Methods Programs Biomed 71:269-281, 2003 2. Natali A, Gastaldelli A, Camastra S, Sironi AM, Toschi E, Masoni A, Ferrannini E, Mari A: Dose-response characteristics of insulin action on glucose metabolism: a non-steady-state approach. Am. J. Physiol. 278:E794-E801, 2000 3. Steele R: Influences of glucose loading and of injected insulin on hepatic glucose output. Ann. NY Acad. Sci. 82:420-430, 1959

Page 4: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

4

4. Mari A: Estimation of the rate of appearance in the non-steady state with a two-compartment model. Am. J. Physiol. 263:E400-E415, 1992 5. Mari A: SMART Reference Manual. Padova, LADSEB-CNR, 1992 Short user guide This section illustrates in more detail the procedures for performing the analysis. First, the methods used to handle the data are described (Data objects, Use of data objects in GLUTRAN). Then an outline of the modeling methods is provided (Basic modeling methods). Last, the commands for calculating the model steady-state parameters and the clearance (Calculation of the steady-state parameter and the clearance) and the rates of appearance (Calculation of rates of appearance) are explained. The examples are in part drawn from the demo script of Appendix 3. Data objects Matlab has a predefined set of standard data types (or “classes”), such as numeric arrays or simple strings, but also allows users to build new data types. In GLUTRAN, new data types have been created to represent time series that commonly arise from in vivo experiments, such as the time course of glucose concentration during a test. These new data types are denoted as “data objects”. Data objects are designed to work with time series in a facilitated way. A rather standard way to represent a time series in Matlab is to use a pair of numeric vectors, one for the time and one for the value (e.g. glucose concentration). For instance, the commands

t=[0 30 60 90 120]; glu=[5.1 6.5 7.2 6.9 6.2]; plot(t,glu,'.-')

create and plot a data series that may represent glucose concentration during an oral glucose tolerance test. Using data objects, such time series is created and plotted with the commands

glu=timeval([0 30 60 90 120],[5.1 6.5 7.2 6.9 6.2]); plot(glu,'.-')

Note that in this case “glu” is a data object, shown in Matlab as “timeval object”; “timeval” is a new data type (or class). Note also that the plot command does not require the time, as times are embedded in the “glu” data object. Data objects are designed not only to provide a shorter notation by keeping times and values together. The most important feature is that operations on data objects are based on the times and not on the sequence of elements as with ordinary Matlab vectors. For instance, tracee and tracer concentrations may be defined on different times:

tracer=timeval([0 30 60 90 120],[1344 1421 1280 1120 1072]); tracee=timeval([0 15 30 45 60 75 90 105 120],... [5.1 5.9 6.5 6.9 7.2 7.3 6.9 6.5 6.2]);

Page 5: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

5

From these data objects, specific activity, as a data object, is simply calculated as:

sa=tracer/tracee; The ratio is calculated at corresponding times; when the same time instant is not available in both objects, data are skipped or a missing value is inserted (missing values are represented as NaN in Matlab). All elementary mathematical operations are performed in the same way. Data objects can also store multiple time series in the same object. For instance, tracee and tracer concentrations can be embedded in the single object “data” as:

data=timeval([0 15 30 45 60 75 90 105 120],... [5.1 5.9 6.5 6.9 7.2 7.3 6.9 6.5 6.2],... [0 30 60 90 120],[1344 1421 1280 1120 1072]);

Note that the arguments of the “timeval” function are the pairs (times, values) in sequence for all data series. This data object has two data rows, the first for the tracee and the second for the tracer. The two data series share the same times and missing values are inserted in the appropriate places, when necessary as in the example above. When this object is plotted, two panels are drawn, the first for the tracee and the second for the tracer. Mathematical operations can be performed also between these objects, provided that they have the same number of data rows. Subscripting of data objects is time oriented, and yields objects. A data object has two indices, the first for time and the second for the data row. For instance,

tracer1=data([30;90],2); gives tracer concentration (the 2nd data row) between 30 and 90 min (assuming time is in minutes), as a data object. Similarly,

tracee1=data([0 30 60 90 120],1); gives tracee concentration (the 1st data row) at the times where tracer is defined. Note the difference between the two notations: in the first, the subscript for time (1st subscript) is a column vector with two elements, which are the bounds of the time interval; in the second, the subscript for time is a row vector with the requested times. In the latter case, if the time instants of the subscript do not match those of the timeval object the corresponding values are not returned. The times and values in the data objects are retrieved as ordinary numeric vectors with the commands:

time=data.t; value=data.v;

In this example, “time” is a row vector of times and “value” is a matrix with two rows, the first of which is the tracee and the second the tracer. Arrays of data objects can also be constructed: the index of the array is enclosed in curly braces. For instance:

Page 6: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

6

vector=timeval([0 30 60 90 120],[1344 1421 1280 1120 1072]); vector{2,1}=timeval([0 15 30 45 60 75 90 105 120],... [5.1 5.9 6.5 6.9 7.2 7.3 6.9 6.5 6.2]);

creates a column vector of data objects; the first element is tracer concentration, the second is tracee concentration. Note that the first element is created without indices; before the first command “data” is undefined and cannot be indexed in curly braces. Indexing of array elements, times and data rows can be combined, e.g.,

sa=vector{1}([0;60],1)/vector{2}([0;60],1); calculated specific activity in the first 60 min, as a data object. Note: due to an unresolved bug, array data objects cannot be indexed with vectors as ordinary Matlab arrays. For instance, vector{[1;2]} yields an error. Use the function “subset” for this purpose. Data objects are provided to represent tree typical time series:

• concentrations (“timeval” data objects; “timeval” stands for “time-value”) • infusions (“pwcfun” data objects; “pwcfun” stands for “piecewise-constant function”) • bolus injections (“impfun” data objects; “impfun” stands for “impulsive function”)

Similar rules apply to all these objects, though each object has its peculiarities. With the data objects for infusions (“pwcfun”), it is assumed that the value at some time instant t=tk is held constant until the next time instant t=tk+1. The value is assumed to be zero before the first time point and equal to the last value for every time greater or equal to the last time point. When the subscript for time is a row vector, the returned pwcfun object takes the times of the subscript time vector and the values are always defined, based on these rules. Use of data objects in GLUTRAN Data objects are used in GLUTRAN to handle most of the data. For instance, “timeval” data objects are used for tracer and tracee concentration, “pwcfun” objects are used to represent clearance and rates of appearance (which are assumed to be piecewise-constant) and an “impfun” object is typically used to represent the tracer priming. Some of these objects (e.g. clearance and rates of appearance) are created by the commands in the demo script for tracer analysis. However, the original data (tracer and tracee) must be provided by the user in form of data objects. The demo script in fact uses data stored in a file as data objects. As an example, suppose you are analyzing a double-label oral glucose test, as in the demo script. Suppose you are using radioactive tracers (stable isotopes have more complex equations). Suppose you have started a primed constant tracer infusion at t=-120 min; the tracer infusion rate is 1000 dpm/min/kg (illustrative units) and you have given a priming 120 times the constant tracer infusion rate. You define these data in form of data objects for use in GLUTRAN as:

bolus=impfun(-120,120*1000);

Page 7: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

7

tracerinf=pwcfun(-120,1000); These commands define an “impfun” data object representing the priming bolus of 120*1000 dpm/kg at t=-120 min and the constant infusion starting at -120 and continuing indefinitely (“pwcfun” data object). You may plot these object to see how they look like (the default x-axis scale may not be the best for viewing). Suppose then that you give the oral glucose load at t=0 min and you measure glucose concentrations at times -30, -20, -10, 0, 10, 20, 30, 45, 60, 75, 90, 105, 120, 150, 180 min. Tracer concentrations are measured on a subset of these time instants, e.g., at -30, -10, 0, 10, 30, 45, 60, 90, 105, 120, 150, 180 min for the intravenous tracer and at 10, 30, 45, 60, 90, 105, 120, 150, 180 min for the oral tracer. Suppose also that you have stored the data in some file (e.g. an Excel file) and you have loaded the data in Matlab as ordinary numeric vectors (e.g. using the function “xlsread”). Suppose these vectors are column vectors (e.g. you have stored the data in columns in the Excel file) and are loaded in the variables (all column vectors):

tglu % time for glucose concentration glu % glucose concentration ttraceriv % time for intravenous tracer traceriv % intravenous tracer concentration ttraceroral % time for oral tracer traceroral % oral tracer concentration

You create data objects for glucose concentration and the intravenous and oral tracers as:

g=timeval(tglu',glu'); glabiv=timeval(ttraceriv',traceriv'); glaboral=timeval(ttraceroral',traceroral');

Note that the prime (transposition of vectors in Matlab) is necessary because the original data are column vectors while data objects require row vectors. The first two data objects (g and glabiv) are ready for use in GLUTRAN. To calculate the glucose concentration components, i.e., glucose concentration due to endogenous glucose production and to oral absorption (gendo and gor), suppose you have added a tracer dose of 108 dpm to an oral glucose load of 75 g. If you measure glucose in mmol/l and the oral tracer in dpm/ml, the oral glucose concentration component is (1 g of glucose = 5.551 mmol):

gor=glaboral/(1e8/(75*5551)); Note that division by a constant of a data object means that the values are divided by the constant. The endogenous glucose concentration component is in principle simply calculated by subtracting gor from g. However, gor is not defined for t≤0; therefore, the simple subtraction does not give endogenous glucose concentration for t≤0. To obtain the full time course of endogenous glucose concentration, it is necessary to extend gor with zeros. This is done for instance with the command:

g0=timeval(g([-Inf;0],:).t,zeros(size(g([-Inf;0],:).t)));

Page 8: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

8

This command selects the glucose data for t≤0 (time subscript [-Inf;0]; selected time interval from –infinity to 0) and constructs a timeval object with the times of the selected portion of glucose concentration and zeros of corresponding size. Endogenous glucose concentration is then calculated as

gendo=g-union(g0,gor); where the function “union” merges the original oral glucose concentration with the extension of zeros. You can plot the concentration components in a three-panel window using the command (the three panels may not have the same time-axis scale):

plot(stack(g,gor,gendo),'.-') The function “stack” produces a data object with three data rows. The data objects produced by GLUTRAN are easily converted to ordinary numeric vectors and saved in a file. For instance, the following commands write a text tab-delimited file (named “results.txt”) with the clearance (supposed to be calculated as in Part 3A of the demo script), the oral rate of appearance and glucose production, all on the same time grid:

results=stack(cl,rao,gp); exportdata=[results([-30;Inf],:).t' results([-30;Inf],:).v']; save results.txt exportdata -ascii -tabs

The resulting file has four columns, the first with time, the second with clearance, the third with the oral rate of appearance and the fourth with glucose production. Values are exported for t≥30 min (note the subscript of the “results” data object). Analogous results are obtained with the function for writing Excel files (“xlswrite”, if available):

xlswrite('results',exportdata,'results','A2') heading={'time' 'clearance' 'oral Ra' 'endo Ra'}; xlswrite('results',heading,'results','A1')

The commands above add also a heading to the data columns. Note: in the demo script (Part 3A), the pwcfun object with the clearance is defined for t≥30 min for practical purposes (this gives a clearer visual representation of clearance for t≤0). For this reason, if data are exported without selecting a time interval, the values for clearance before t=30 min are zero (as implied by the rules for pwcfun objects). This can be overcome by defining the clearance as cl=pwcfun([-Inf tcl],[pss(end) pcl']) instead of cl=pwcfun([-30 tcl],[pss(end) pcl']) as in the demo script. Basic modeling methods The circulatory model of GLUTRAN, which can be used both for the analysis of the tracer decay curves in steady-state and for non-steady-state calculations, has several parameters.

Page 9: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

9

Among these parameters, there is a set of 4 constants that must be assumed both for steady and non-steady-state analysis. These constants include for instance cardiac output; setting this constant determines the units for the calculation of the glucose fluxes (e.g., if cardiac output is in ml/min/kg and glucose concentration is in mmol/l glucose fluxes will be in µmol/min/kg). Besides these constants, the model includes other parameters that determine its behavior. The model for steady-state glucose kinetics typically has 6 parameters; in the analysis of the steady-state tracer decay curves these parameters are determined by fitting the model to the tracer data. In non-steady-state analysis, the steady-state parameters are fixed (either set to the individually determined values or to standard parameters), while a time-varying glucose clearance is estimated from the tracer data. Therefore, depending on the type of analysis some parameters are fixed while other are estimated. In addition to the parameters, the model “inputs”, i.e., the tracer bolus or infusion, must be defined in order to simulate the model. Thus, model simulation is performed by setting two variables containing the parameters: the variable “p” contains the parameters that need to be estimated (the steady-state parameters of the time-varying clearance); the variable “paux” embeds all the fixed parameters (basic model constants; steady-state parameters in non-steady-state analysis) and the model inputs. Given this information, the solution of the model differential equations is calculated with the command:

y=abcdsim(p,t,paux); where y is the model prediction (e.g. tracer concentration) as a row vector of values corresponding to the row vector of times t (the 2nd argument of the function “abcdsim”), and p and paux are the parameters discussed above. Setting paux requires two commands, which have a different format depending on the type of analysis. The first step defines the fixed model parameters and the second adds the information on the model inputs. For instance, in the steady-state analysis (Part 2 of the demo script) the first step

pcmss=pcminit('human-bw',[],3); defines the basic model constants (the argument 'human-bw' means that parameters for human subjects are selected and cardiac output is set to a fixed value expressed in ml/min/kg body weight) and establishes that the aim is to estimate 3 exponential terms in the periphery block of the circulatory model (hence the last three arguments). The second step sets the model inputs:

pauxss=cminit(pcmss,bolus,tracerinf); The model input (tracer bolus and infusion) are provided as data objects (“bolus” and “tracerinf”) and pauxss incorporates the information on the model constants through the input argument “pcmss” defined above. Once these two steps are executed and the parameter of the steady-state model (pss) is assigned, the model can be simulated:

pss=[3.05;0.382;0.0388;0.430;0.505;1.7];

Page 10: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

10

tracerss=abcdsim(pss,t,pauxss); where t is the vector of times on which the solution (steady-state tracer, “tracerss”) is calculated. To simulate and plot the data and the model fit, the following compact notation can be used:

plot(tracerss,'o',fullsim(pss,tracerss.t,pauxss)) In this notation, the function “fullsim” performs the same action as “abcdsim”, but returns a data object that can be directly plotted without having to deal with the time vector. Note that “tracerss” is the steady-state tracer decay curve as a data object. The command above plots the model solution at the time instants of the data points (tracerss.t), linearly interpolated; if a finer interpolation is desired, the command becomes for instance:

plot(tracerss,'o',fullsim(pss,-120:0,pauxss)) The example above refers to the analysis of the steady-state tracer decay curve in which the model is a steady-state model, with a constant clearance. The model parameter “pss” is in fact that characterizing the steady-state model (six elements in pss, the last of which is the constant clearance). For the non-steady-state model, which features a time-varying clearance, the same commands are used but with different arguments. If the non-steady-state model with standard parameters is used (i.e. the parameters of the steady-state model are not estimated individually), the commands are the following (Part 3B of the demo script):

tcl1=[-Inf 0:2:tracernss1.t(end)-2]; pcmnss1=pcminit('human-bw'); pauxnss1=cminit(pcmnss1,bolus,tracerinf,tcl1);

Note that the call to the parameter initializing function “pcminit” just returns the standard parameters for human subjects (with normalization to body weight, as in the previous example) and the definition of paux with the function “cminit” is virtually as above, the only difference being the inclusion, as last argument, of the times at which the time-varying clearance is defined. In this case, the clearance is assumed to be constant from –infinity to 0 and than varying every 2 min until 2 min before the last data point (the clearance value from the last data point onwards does not influence the model prediction of the data; that’s why the last data point is not included). Note that having defined the clearance constant from –infinity to 0 implies that the first value of the clearance, i.e., that referring to the steady-state period (–infinity to 0) is the steady-state clearance. As in the steady-state case the model parameter (pss) is that determining the steady-state model behavior, here the model parameter to be estimated is the glucose clearance. Thus the model is simulated with the commands:

pcl1=3*ones(size(tcl1')); tracernss=abcdsim(pcl1,t,pauxnss1);

where again t is the vector of times on which the solution (non-steady-state tracer) is calculated and pcl1 is the column vector of clearance values (here set to a constant value of 3).

Page 11: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

11

It is interesting to compare the simple non-steady-state solution above with the more elaborate case in which the individualized steady-state parameter is used in place of the standard one. The non-steady-state model initialization and simulation is in this case:

tcl=0:2:tracernss.t(end)-2; pcmnss=pcminit('human-bw',pcmss,pss); pauxnss=cminit(pcmnss,bolus,tracerinf,tcl,pss(end)); pcl=3*ones(size(tcl')); tracernss=abcdsim(pcl,t,pauxnss);

where the use of “pcmss” and “pss”, obtained from the previous steady-state analysis, with the function “pcminit” ensures that the individualized steady-state parameters are used. Note that the last argument of the function “cminit” (pss(end), i.e. the last element of pss), which was missing in the previous example, is the steady-state clearance value. In this example, in fact, the clearance is defined from t=0 onwards (see the definition of tcl) and is undefined for t<0. This choice is related to the fact that the non-steady-state data used to determine the clearance (tracernss) are the portion of the data from t=0 onwards, i.e., the basal period is excluded. In contrast, in the previous example based on the standard steady-state parameters, a steady-state portion of the data was included (in tracernss1) and the steady-state value of the clearance was estimated. Calculation of the steady-state parameter and the clearance The calculation of the steady-state parameter and the time-varying clearance is performed by fitting the model to the tracer data using least squares. The difference between the two procedures is that the steady-state parameter is determined using ordinary least squares, while the clearance is estimated using regularized least squares. Regularization means that the clearance, which is a function of time, is constrained to have a smooth time course; otherwise, the clearance would not be determinable from the data. The function used for least squares is the function “lsqnonlin” of the Matlab Optimization toolbox. The call for the estimation of the steady-state parameter (pss) is

pss=lsqnonlin(@wlsres,pss,zeros(size(pss)),[],[],... @abcdsim,tracerss.v,wss,tracerss.t,pauxss);

while that for the determination of the clearance (pcl) is

pcl=lsqnonlin(@cmres,pcl,[],[],[],... @abcdsim,tracernss.v,wcl,sfcl,tcl,tracernss.t,pauxnss);

The first argument (@wlsres or @cmres) is the function that calculates the sum of squares and implements ordinary (@wlsres) or regularized (@cmres) least squares. Note that the notation “@func” indicates in Matlab the function “func” (as opposed to an ordinary variable). The second argument is the initial estimate of the steady-state parameter (pss) or the clearance (pcl). In this example, the same variable (pss or pcl) is used both as initial estimate and as the final estimate returned by “lsqnonlin”.

Page 12: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

12

The third and fourth arguments are the lower and upper bounds for the estimated parameter, respectively; they are undefined (the empty vector “[]” in Matlab), except for a lower bound of zeros for pss. The fifth argument defines the options for the minimization function lsqnonlin. Because this argument is undefined, default options are used. The sixth argument is the function that simulates the model (@abcdsim), and is the same in both cases. The seventh argument is a row vector of data, i.e., the tracer concentration in steady (tracerss.v) or non-steady (tracernss.v) state. Note that because tracer concentration is represented with a data object, the vector with the values is obtained with the suffix “.v”. The eighth argument is a row vector of weights for the data (wss or wcl). It is used to balance the fit and exclude outliers (when the weight for a given point is set to zero). The last two arguments are the row vectors of times corresponding to the data (tracerss.t or tracernss.t) and the auxiliary parameter for model simulation (pauxss or pauxnss). Note that because tracer concentration is represented with a data object, the vector with the times is obtained with the suffix “.t”. The ninth and tenth argument in the second call (sfcl and tcl) are the smoothing factor for the clearance and the times on which the clearance is defined, respectively. The higher is the smoothing factor the smoother is the clearance and the looser the fit; the lower is the smoothing factor the tighter is the fit and the more fluctuating is the clearance. The best compromise is obtained with some iterations with which the smoothing factor (sfcl) is adjusted; ideally, the appropriate value is that which gives a residual standard deviation for the tracer close to the expected measurement error. The determination of the steady state parameter and the clearance are made in a similar way with the “lsqnonlin” function. The main difference is that determination of the clearance requires a few iterations in which the smoothing factor is adjusted, while the steady-state parameter is calculated with one call. Another difference is the time required for calculation, which is typically very short for the steady-state parameter and considerably longer for the clearance. In both cases, examination of the data and the model fit may suggest that some data points are outliers and should be excluded setting to zero the data weights. In this case, examination is redone after setting the weights appropriately. Calculation of the rate of appearance Once the steady-state parameter and the clearance are determined, the rate of appearance is calculated from the model and glucose concentration. This is achieved with regularized least squares as for the clearance, but the calculation is in this case faster than the use of the determination of the clearance with the function lsqnonlin. Also for the rate of appearance it is necessary to choose a smoothing factor so that the best compromise between smoothness of the rate of appearance and goodness of fit is obtained.

Page 13: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

13

The procedure for the rate of appearance is analogous to deconvolution and employs the functions of the Deconvolution toolbox. With reference to the calculation of glucose production (Part 4 of the demo script), first a variable (gpdec) is created with the information to perform deconvolution:

tgp=[-Inf -120:2:gendo.t(end)-2]; cl=pwcfun(tcl,pcl'); gpdec=cmdec(pcmnss,gendo,tgp,cl,pss(end));

In this case, the results from the analysis with the individualized parameters are used (pcmnss, pss and pcl). Note that it is necessary to define a time grid on which glucose production is calculated (tgp). Because glucose production is present since ever, the first time point is –infinity; glucose production is thus assumed to be constant from –infinity to -120, and then time-varying at 2 min steps (similarly to glucose clearance). The function “cmdec” takes as arguments the parameters of the non-steady-state model (pcmnss), the endogenous glucose concentration component (gendo) as a timeval data object, the time grid for the calculation of glucose production (tgp), the clearance as a pwcfun data object (cl) and the steady state value of the clearance (as discussed above, with these settings the clearance cl is not defined for t<0). Once the variable for deconvolution (gpdec) is set, glucose production (gp) is calculated in one step:

gp=decpt(gpdec,sfgp,wgp,wrgp); where “sfgp” is the smoothing factor for production, “wgp” is a vector of weights for the data points of endogenous glucose concentration (its function is analogous to that of “wcl” in the determination of the clearance) and “wrgp” is a vector of weights with which it is possible to control the smoothness of glucose production locally (is does not has a role if set to 1). A similar procedure is adopted to calculate the oral rate of appearance (Part 5 of the demo script).

Page 14: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

14

Colophon GLUTRAN and the associated toolboxes have been developed by Andrea Mari at the Institute of Biomedical Engineering, of the National Research Council, in Padova, Italy. The Data objects toolbox has been written in collaboration with Paolo Favaro. GLUTRAN is protected by copyright. None of the functions of GLUTRAN can be distributed without permission of the author. The author can be contacted at [email protected].

Page 15: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

15

Appendix 1 – Matlab requirements and GLUTRAN installation To run GLUTRAN, a license is required for Matlab and for the Optimization toolbox. To install GLUTRAN, copy the folder “glutran” in a convenient location on your hard disk. Because this folder contains functions that should not be changed, it should be kept separate from folders containing data and specific analyses. Then start Matlab and use the path tool (Start/Desktop tools/Path) to insert in the Matlab path the folder “glutran” with all subfolders. Add the path permanently (button “Save”) if you want Matlab to remember the settings. After this step GLUTRAN is ready to be used; test it using the demo script.

Page 16: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

16

Appendix 2 – Matlab basics Matlab performs calculations based on functions that are applied to data, which typically are arrays. Generation of data in Matlab memory and application of functions to them is made with commands. For instance, to compute the mean of a set of numbers, the numbers are represented as elements of an array and the mean is a function applied to the array. This is achieved with the commands:

numset=[1 2 3 4 5] meanval=mean(numset)

The first command creates the array “numset” in in Matlab memory (called workspace). The second commands applies the function “mean”, which calculates the mean, to the array “numset” and assigns the mean value to “meanval”, an array with a single element (also called a variable in the workspace). Thus “meanval” is set to the value of 3 in the example. All the functionality of Matlab, and therefore of GLUTRAN too, is based on this essential principle, although for more elaborate tasks and data the syntax may be more complex. Matlab (and GLUTRAN) collect functions in toolboxes. Each toolbox puts together functions that belong to the same category. For instance, the Matlab Statistics toolbox collects the statistical functions, the Image Processing toolbox the functions for image processing.

Page 17: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

17

Appendix 3 – GLUTRAN demo script The demo script demoogtt.m illustrates the use of GLUTRAN functions for the analysis of a double tracer OGTT experiment. Comments are in green, commands in black/purple. The data and the model results for this example are shown in the figure at the end of the script. Notice: the demo is not designed to run interactively as a typical Matlab demo. The commands of the script should be selected and executed (by right clicking in Windows). % Example of analysis of a double tracer OGTT experiment. Data are real % data from a stable isotope study (6,6-D2-glucose as intravenous tracer % and 13C-glucose as oral tracer). Glucose concentrations are in mmol/l. % PART 1: load data and perform preliminary calculations. Demo data are % stored as data objects % load demo data from subject's file. The data, which are stored as data % objects, are the following: % bolus: tracer bolus given as priming at the beginning of the constant % intravenous tracer infusion % tracerinf: constant tracer infusion rate % glabiv: tracer concentration corresponding to the intravenous tracer % infusion % g: glucose concentration (as measured in plasma) % gor: oral glucose concentration, i.e., concentration due to glucose % ingestion (calculated from the tracer data) % gendo: endogenous glucose concentration, i.e., concentration due to % glucose production (calculated from the tracer data) load ogttdata % select the steady-state period for intravenous tracer concentration % (basal equilibration period from -120 min to 0) tracerss=glabiv([-Inf;0],:); % select the non-steady-state period for intravenous tracer concentration % (the OGTT, from 0 min to 150 min) tracernss=glabiv([0;Inf],:); % PART 2: estimate steady-state glucose kinetic parameters from intravenous % tracer concentration between -120 and 0 min and the tracer infusion and % bolus data % initialization of the circulatory model for steady-state analysis. Use % the standard fixed constants and 3 exponentials in the periphery to be % estimated. Normalize parameters and fluxes to body weight. pcmss=pcminit('human-bw',[],3); pauxss=cminit(pcmss,bolus,tracerinf); % initial parameter estimate. Note that the last element (pss(end)) is % glucose clearance in the basal state pss=[3.05;0.382;0.0388;0.430;0.505;1.7]; % weights for the data points (here ones, except a possible outlier at % t=-40 that is weighted less) wss=ones(size(tracerss.v)); wss(tracerss.t==-40)=0.2;

Page 18: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

18

% estimate parameter using least squares pss=lsqnonlin(@wlsres,pss,zeros(size(pss)),[],[],@abcdsim,tracerss.v,... wss,tracerss.t,pauxss); % plot data and model fit (intravenous tracer concentrations, as data % objects) plot(tracerss,'o',fullsim(pss,tracerss.t,pauxss)) % display metabolic parameters metpar(pss,pauxss) % PART 3A: estimate the time-varying clearance during the OGTT using the % steady-state parameters just determined in the individual subject % time grid for time-varying clearance. Clearance is supposed to be % constant before time 0 and varying as a piecewise constant function at 2 % min intervals afterwards tcl=0:2:tracernss.t(end)-2; % initial clearance estimate (just a constant value equal to the basal % value pss(end)) pcl=pss(end)*ones(size(tcl')); % set the circulatory model parameter for non-steady-state analysis to the % value determined from the steady-state analysis above pcmnss=pcminit('human-bw',pcmss,pss); % initialization of the circulatory model for non-steady-state analysis % with the results of the steady-state analysis above and assuming that % glucose clearance has the basal value (pss(end)) before t=0 pauxnss=cminit(pcmnss,bolus,tracerinf,tcl,pss(end)); % smoothing factor for glucose clearance sfcl=.4; % data weights (just ones here) wcl=ones(size(tracernss.v)); % estimate clearance (may take some time) pcl=lsqnonlin(@cmres,pcl,[],[],[],@abcdsim,tracernss.v,wcl,sfcl,tcl,... tracernss.t,pauxnss); % plot tracer data and glucose clearance during the OGTT subplot(2,1,1) plot(tracernss,'o',fullsim(pcl,tracernss.t,pauxnss)) subplot(2,1,2) cl=pwcfun([-30 tcl],[pss(end) pcl']); plot(cl) xlimall([-10 160]) % PART 3B: repeat the calculation above using the standard glucose kinetic % parameters instead of those estimated in the individual subject % select intravenous tracer concentration data including the OGTT (from 0 % min to 150 min) and the preceding 10 min steady-state period tracernss1=glabiv([-10;Inf],:);

Page 19: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

19

% time grid for time-varying clearance. Clearance is supposed to be % constant before time 0 and varying as a piecewise constant function at 2 % min intervals afterwards tcl1=[-Inf 0:2:tracernss1.t(end)-2]; % initial clearance estimate (just a constant value equal to the basal % value (~3)) pcl1=3*ones(size(tcl1')); % set the circulatory model parameter for non-steady-state analysis to the % standard value pcmnss1=pcminit('human-bw'); % initialization of the circulatory model for non-steady-state analysis % with the standard parameter value and assuming that glucose clearance % maintains its value from -infinity to 0 pauxnss1=cminit(pcmnss1,bolus,tracerinf,tcl1); % smoothing factor for glucose clearance sfcl1=.4; % data weights (just ones here) wcl1=ones(size(tracernss1.v)); % estimate clearance (may take some time) pcl1=lsqnonlin(@cmres,pcl1,[],[],[],@abcdsim,tracernss1.v,wcl1,sfcl1,... tcl1,tracernss1.t,pauxnss1); % plot tracer data and glucose clearance during the OGTT subplot(2,1,1) plot(tracernss1,'o',fullsim(pcl1,tracernss1.t,pauxnss1)) subplot(2,1,2) plot(pwcfun(tcl1,pcl1')) xlimall([-10 160]) % compare results from individually estimated parameters and standard % parameters (Parts 3A and 3B) subplot(2,1,1) plot(tracernss1,'o',fullsim(pcl1,tracernss1.t,pauxnss1),'g',... fullsim(pcl,tracernss1.t,pauxnss),'r') subplot(2,1,2) plot(pwcfun(tcl1,pcl1'),'g',cl,'r') xlimall([-10 160]) % PART 4: calculate glucose production by pseudo-deconvolution during the % OGTT (using individually estimated parameters) % time grid for glucose production, assumed to be a piecewise constant % function over 2 min intervals from the beginning of the experiment (-120 % min) and constant before -120 min tgp=[-Inf -120:2:gendo.t(end)-2]; % use clearance from the individualized model cl=pwcfun(tcl,pcl'); % calculate convolution matrix and set struct for deconvolution (gpdec) gpdec=cmdec(pcmnss,gendo,tgp,cl,pss(end));

Page 20: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

20

% smoothing factor for glucose production sfgp=50; % weights for endogenous glucose concentration (just ones here, with a % possible outlier at t=20 min weighted less) wgp=ones(size(gendo.v)); wgp(gendo.t==20)=.1; % weights to control glucose production smoothing locally (just ones here) wrgp=1; % perform deconvolution gp=decpt(gpdec,sfgp,wgp,wrgp); % plot glucose production and model fit; show statistics of residuals decplot(gpdec,gp) decstat(gpdec,gp) % PART 5: calculate oral glucose appearance by pseudo-deconvolution (using % individually estimated parameters) % time grid for oral glucose appearance, assumed to be a piecewise constant % function over 2 min intervals from the beginning of the OGTT (0 min) trao=0:2:gor.t(end)-2; % use clearance from the individualized model cl=pwcfun(tcl,pcl'); % calculate convolution matrix and set struct for deconvolution (gpdec) raodec=cmdec(pcmnss,gor,trao,cl,pss(end)); % smoothing factor for the oral glucose appearance sfrao=3; % weights for oral glucose concentration (just ones here, with a % possible outlier at t=20 min weighted less) wrao=ones(size(gor.v)); wrao(gor.t==20)=.4; % weights to control oral glucose appearance smoothing locally (just ones % here) wrrao=1; % perform deconvolution and plot oral glucose Ra and model fit rao=decpt(raodec,sfrao,wrao,wrrao,0); % plot oral glucose appearance and model fit; show statistics of residuals decplot(raodec,rao) decstat(raodec,rao) % show integral of oral glucose appearance in grams/kg body weight raoint=integral(rao,0,gor.t(end))/5.551/1000 % PART 6: save results % this command saves the results in a Matlab data file named 'ogttres.mat'. % Other methods to save data can be employed save ogttres pcmss pss wss cl wcl sfcl gp wgp wrgp sfgp rao wrao wrrao sfrao

Page 21: GLUTRAN: a Matlab toolbox for glucose tracer analysis€¦ · Institute of Biomedical Engineering, National Research Council, Padova, Italy Introduction GLUTRAN (glucose tracer analysis)

21

Figure illustrating the data and results of the demo above (obtained with commands not included in the script and with some manual editing).

-150 -100 -50 0 50 100 1500.05

0.1

0.15

0.2

0.25

trace

r

-150 -100 -50 0 50 100 1500

2

4

6

gluc

ose

-150 -100 -50 0 50 100 1500

20

40

60

GP

, RaO

, Rd

41.9 g

-150 -100 -50 0 50 100 1500

2

4

6

8

gluc

ose

clea

ranc

e

time-150 -100 -50 0 50 100 150

0

0.5

1

insu

lin

-150 -100 -50 0 50 100 1500.05

0.1

0.15

0.2

0.25

trace

r

-150 -100 -50 0 50 100 1500

2

4

6

gluc

ose

-150 -100 -50 0 50 100 1500

20

40

60

GP

, RaO

, Rd

41.9 g

-150 -100 -50 0 50 100 1500

2

4

6

8

gluc

ose

clea

ranc

e

-150 -100 -50 0 50 100 1500.05

0.1

0.15

0.2

0.25

trace

r

-150 -100 -50 0 50 100 1500

2

4

6

gluc

ose

-150 -100 -50 0 50 100 1500

20

40

60

GP

, RaO

, Rd

41.9 g

-150 -100 -50 0 50 100 1500

2

4

6

8

gluc

ose

clea

ranc

e

time-150 -100 -50 0 50 100 150

0

0.5

1

insu

lin

endogenousoral

glucose production

oral rate of appearance

glucose uptake

tracer infusiontracer bolus

OGTT