Difference between revisions of "Support:Documents:Examples:Estimate Change of Neurotransmitter"

From COMKAT wiki
Jump to navigation Jump to search
Line 109: Line 109:
 
<pre>
 
<pre>
 
     DApar = [50 27 1 0.1 240+10]; % = [Basal Gamma Alpha Beta Delay]  
 
     DApar = [50 27 1 0.1 240+10]; % = [Basal Gamma Alpha Beta Delay]  
     cm = addParameter(cm, 'DA', DApar);
+
     params = {'DAbasal', 'G', 'alpha', 'beta', 'delay'};
     cm = addInput(cm, 'F^{EN}', 0, 0, 'gammavariate', 'DA'); %DA defined by gamma variate function at activation condition
+
    for i = 1:length(params),
     figure; plot(t, gammavariate(DApar, t), 'b', 'LineWidth', 2); title('Endogenous Input Function'); legend('F^{en}');  
+
        cm = addParameter(cm, params{i}, DApar(i));
     ax = axis; axis([ax(1) ax(2) 0 ax(4)]); % ensure minimum y-axis value is zero
+
    end
</pre>
+
     cm = addInput(cm, 'F^{EN}', 0, 0, 'ntInput', params);
 +
     figure; plot(t, ntInput(t,0,params,num2cell(DApar)), 'b', 'LineWidth', 2); title('Endogenous Input Function'); legend('F^{en}');  
 +
     cm = addSensitivity(cm, params{:}, 'k1', 'k2', 'kon', 'koff');  
  
 
[[Image:Input2.jpg]]
 
[[Image:Input2.jpg]]
Line 167: Line 169:
 
     cm = addLink(cm, 'K',  'B2',      'F2',      'koff');
 
     cm = addLink(cm, 'K',  'B2',      'F2',      'koff');
 
     cm = addLink(cm, 'K',  'B^{EN}',  'Junk',    'koffEN');
 
     cm = addLink(cm, 'K',  'B^{EN}',  'Junk',    'koffEN');
     cm = addSensitivity(cm, 'DA', 'k1', 'k2', 'kon', 'koff', 'k2ref');  % set desired 'estimated parameters'
+
      
 
</pre>
 
</pre>
  
Line 173: Line 175:
  
 
<pre>
 
<pre>
    disp('Properly handle the initial conditions assuming no exogenous ligand initially')
 
    IC.time = 0;
 
    Kd = pxEval(cm, 'koffEN') / pxEval(cm, 'konEN');
 
    Bmax = pxEval(cm, 'Bmax');
 
    FEN = gammavariate(DApar, 0);
 
    compNames = get(cm, 'CompartmentName');
 
    sensNames = get(cm, 'SensitivityName');
 
    idxBEN = strmatch('B^{EN}', compNames);
 
    idxBasal = strmatch('DA', sensNames); % DA is a vector-valued parameter and Basal is its 1st element
 
    ncomp = get(cm, 'NumberCompartments');
 
  
    %initialize cell array, if matrix is used then solver error is thrown sometimes
+
    disp('Properly handle the initial conditions assuming no exogenous ligand initially')
    IC.compartment =cell(ncomp,1);
+
    compNames = get(cm, 'CompartmentName');
    for j = 1:ncomp
+
    sensNames = get(cm, 'SensitivityName');
        IC.compartment{j} = 0;
+
    ncomp = get(cm, 'NumberCompartments');
    end
+
    idxBENComp = strmatch('B^{EN}', compNames, 'exact');
    IC.compartment{strmatch('B^{EN}', compNames, 'exact')} = Bmax * FEN / (Kd + FEN);
+
    idxBasal = strmatch('DA', sensNames);
           
+
    IC.time = 0;
    IC.compartmentSensitivity = zeros([length(compNames) length(sensNames)]);
+
   
    IC.compartmentSensitivity(idxBEN, idxBasal) = Bmax*Kd / ((Kd + FEN)^2); %dBEN/dBasal calculated correctly now
+
    IC.compartment = cell([ncomp 1]); 
    cm = set(cm, 'InitialConditions', IC);
+
    IC.compartmentSensitivity = cell([length(compNames) length(sensNames)]);
 +
    IC.compartmentSensitivity{idxBEN, idxBasal} = 'Bmax*(koffEN/konEN) / ((koffEN/konEN + DAbasal)^2)';
 +
    IC.compartment{idxBENComp} = 'Bmax*DAbasal/(koffEN/konEN+DAbasal)';
 +
    cm = set(cm, 'InitialConditions', IC);
  
 
     [PET, PETIndex, Output, OutputIndex] = solve(cm);
 
     [PET, PETIndex, Output, OutputIndex] = solve(cm);
 
      
 
      
 +
    Bmax = pxEval(cm, 'Bmax');
 
     disp('Plot some compartment concentrations to examine model behavior');
 
     disp('Plot some compartment concentrations to examine model behavior');
 
     figure; idx = [3 6]; plot(Output(:,1), Output(:, idx), 'LineWidth', 2); legend(OutputIndex(idx)); title('Free Compartment Concentrations');
 
     figure; idx = [3 6]; plot(Output(:,1), Output(:, idx), 'LineWidth', 2); legend(OutputIndex(idx)); title('Free Compartment Concentrations');
Line 210: Line 206:
  
 
<pre>
 
<pre>
     basal_LB  = 40;      basal_UB  = 75;
+
     basal_LB  = 30;      basal_UB  = 70;
 
     gamma_LB  = 15;      gamma_UB  = 50;
 
     gamma_LB  = 15;      gamma_UB  = 50;
 
     alpha_LB  = 0.1;    alpha_UB  = 5;
 
     alpha_LB  = 0.1;    alpha_UB  = 5;
Line 220: Line 216:
 
     koff_LB  = 0.01;  koff_UB  = 1;
 
     koff_LB  = 0.01;  koff_UB  = 1;
 
      
 
      
     pinit = [30 18 1 0.01 240 0.1 0.1 0.005 0.1];   
+
     pinit = [45 18 1 0.01 250 0.1 0.1 0.005 0.1];   
 
     cm = set(cm, 'ExperimentalData', PET(:,3));
 
     cm = set(cm, 'ExperimentalData', PET(:,3));
 +
       
 +
    lb = [basal_LB ; gamma_LB ; alpha_LB ; beta_LB ; delay_LB ; k1_LB ; k2_LB ; kon_LB ; koff_LB];
 +
    ub = [basal_UB ; gamma_UB ; alpha_UB ; beta_UB ; delay_UB ; k1_UB ; k2_UB ; kon_UB ; koff_UB];   
 
      
 
      
    lb = [basal_LB ; gamma_LB ; alpha_LB ; beta_LB ; delay_LB ; k1_LB ; k2_LB ; kon_LB ; koff_LB];
 
    ub = [basal_UB ; gamma_UB ; alpha_UB ; beta_UB ; delay_UB ; k1_UB ; k2_UB ; kon_UB ; koff_UB];
 
 
     [pfit, modelfit, resnorm, residual, exitFlag, output] = fit(cm, pinit, lb, ub);
 
     [pfit, modelfit, resnorm, residual, exitFlag, output] = fit(cm, pinit, lb, ub);
 
      
 
      
     figure; plot(t, gammavariate(DApar, t), 'b--',t, gammavariate(pfit(1:5), t), 'r-', 'LineWidth', 1.5);  
+
     figure; plot(t, ntInput(t,0,params,num2cell(DApar)), 'b--',t, ntInput(t,0,params,num2cell(pfit(1:5))), 'r-', 'LineWidth', 1.5);  
     title('Endogenous Input Function'); legend('True F^{en}','Estimated F^(en)');  
+
     title('Endogenous Input Function'); legend('True F^{en}','Estimated F^{en}');  
 
</pre>
 
</pre>
  
 
[[Image:Fitoutput.jpg]]
 
[[Image:Fitoutput.jpg]]

Revision as of 19:14, 11 March 2009

Model of Neurotransmitter PET (ntPET)

Overview

The changes of endogenous neurotransmitter by PET scanning after a stimulus have been proved with different approaches. In stead of detecting the increase or decrease of a neurotransmitter, it is important to characterize the temporal change of a neurotransmitter after a stimulus. Morris proposed the new technique (called ntPET) for capturing the dynamic changes of a neurotransmitter after a stimulus and demonstrated the ability of this method to reconstruct the temporal characteristics of an enhance in neurotransmitter concentration.

Generally, there are two separate injections of tracer for ntPET: one for the rest condition (without any stimuli) and the other for the activation condition (after a stimulus). Therefore, the model can be described as:

Model.jpg

This model can be described by the differential equations:

dF/dt = K1Cp - K2F - Kon[Bmax - B - B2 - Ben]F + koffB


dB/dt = Kon[Bmax - B - B2 - Ben]F - koffB


dF2/dt = K1Cp2 - K2F2 - Kon[Bmax - B - B2 - Ben]F2 + koffB2


dB2/dt = Kon[Bmax - B - B2 - Ben]F2 - koffB2


dBen/dt = Kenon[Bmax - B - B2 - Ben]Fen -kenoffBen


Cp is the plasma concentration of tracer at the first injection (the "rest" condition).

F and B are free (unbound) and bound molar concentrations of tracer after the first injection

Cp2 is the plasma concentration of tracer at the second injection (the "activation" condition).

F2 and B2 are free (unbound) and bound molar concentrations of tracer after the second injection.

Fen and Ben are free and bound molar concentrations of a neurotransmitter released by endogenous ligand after a stimulus.

Bmax is the maximum number of receptors that can be bound by neurotransmitter or tracer.

Bmax - B - B2 - Ben is the concentration of available receptors. This also indicates that binding is saturable.

K1, K2, Kon, Koff, Kenon and Kenoff are rate constants.

Implementing the Compartment Model

Create a new model for ntPET

Step 1. Create the compartemt model

    cm = compartmentModel;

    %Set scan time of the whole scan
    inj2Delay = 240; % min between 1st and 2nd inj
    disp('Define one long study: inj 1 = baseline, inj 2 = activation');
    scantInj1 = [[0:0.1:0.9 1:0.25:1.75 2:0.5:4.5 5:1:59]' [0.1:0.1:1 1.25:0.25:2 2.5:0.5:5 6:1:60]']; 
    scantInj2 = scantInj1 + inj2Delay;
    scant = [scantInj1; scantInj2]; 
    deltaT = scant(:,2) - scant(:,1);
    tmid   = 0.5*(scant(:,1) + scant(:,2));
    cm = set(cm, 'ScanTime', scant);

    %Set parameters of the model
    cm = addParameter(cm, 'PV', 1 );    
    cm = addParameter(cm, 'Fv', 0);     
    cm = addParameter(cm, 'sa', 1);    % uCi/pmol
    cm = addParameter(cm, 'dk', 0);    % assume data are decay-corrected        
    cm = addParameter(cm, 'k1',      0.9);   
    cm = addParameter(cm, 'k2',      0.4);   
    cm = addParameter(cm, 'kon' ,   0.01);   
    cm = addParameter(cm, 'koff',    0.14);  
    cm = addParameter(cm, 'k2ref',  0.3);
    cm = addParameter(cm, 'Bmax',  80);
    cm = addParameter(cm, 'konEN', 0.25);
    cm = addParameter(cm, 'koffEN', 25);     

    %model for baseline condition:
    cm = addCompartment(cm, 'F');
    cm = addCompartment(cm, 'B',      'Bmax');
    cm = addCompartment(cm, 'Junk');

    %model for activation condition:
    cm = addCompartment(cm, 'F2');
    cm = addCompartment(cm, 'B2',      'Bmax');
    cm = addCompartment(cm, 'B^{EN}', 'Bmax');

Step 2. Set the input function for two injections

    % Create input functions for two injections
    t = 0:0.05:305; % coverage out to 6+ h
    Cp1Data = fengInput([2 0.5 8.5 0.22 0.2 -4. -0.1 -0.02], t);
    Cp2Data = fengInput([2 inj2Delay+0.5 8.5 0.22 0.2 -4. -0.1 -0.02], t);
    ppCp1 = spline(t, Cp1Data);
    ppCp2 = spline(t, Cp2Data);
    
    figure; plot(t, ppval(ppCp1, t), 'r', t, ppval(ppCp2,t), 'b', 'LineWidth', 2); title('Exogenous Input Functions'); legend('Cp1', 'Cp2')

    cm = addInput(cm, 'C_p', 'sa', 'dk', 'ppval', ppCp1);
    cm = addInput(cm, 'C_p2', 'sa', 'dk', 'ppval', ppCp2);

Input.jpg

Step 3. Create a function described the change of concentrations of the endogenous neurotransmitter. To detect the change, the parameters of the function will be estimated.

The change of concentrations of the endogenous neurotransmitter after a stimulus is described by a gamma variate function. Fen = Basal + Gamma[t-Delay]Alpha exp(-Beta[t-Delay]). Note: Basal is the concentration of the endogenous neurotransmitter without any stimulus. Gamma, Alpha and Beta control the change of concentrations of the endogenous neurotransmitter. Delay is the delay time.

    DApar = [50 27 1 0.1 240+10]; % = [Basal Gamma Alpha Beta Delay] 
    params = {'DAbasal', 'G', 'alpha', 'beta', 'delay'};
    for i = 1:length(params),
        cm = addParameter(cm, params{i}, DApar(i));
    end
    cm = addInput(cm, 'F^{EN}', 0, 0, 'ntInput', params);
    figure; plot(t, ntInput(t,0,params,num2cell(DApar)), 'b', 'LineWidth', 2); title('Endogenous Input Function'); legend('F^{en}'); 
    cm = addSensitivity(cm, params{:}, 'k1', 'k2', 'kon', 'koff'); 

[[Image:Input2.jpg]]

The endogenous input function is implemented as (create the below function and put in in a file called gammavariate.m):

<pre>
function [y, grad] = gammavariate(p,t) 
% parameters [p(1) p(2) p(3) p(4) p(5)] = [Basal G alpha beta delay]
    y = p(1).*ones(size(t)); 
    idx = find(t >= p(5));
    dt  = t(idx) - p(5);
    
    y(idx) = p(1) + p(2)*(dt.^p(3)).*exp(-p(4).*dt);
    
    if nargout > 1,
        grad = zeros(length(t), 5); 
        grad(:,1)=ones(size(t));

        if ~isempty(idx), 
            grad(idx,2) = (dt).^p(3).*exp(-p(4).*(dt));
            grad(idx,3) = p(2).*(dt).^p(3).*log(dt).*exp(-p(4).*(dt));
            grad(idx,4) = -p(2).*(dt).^(p(3)+1).*exp(-p(4).*(dt));
            grad(idx,5) = -p(2)*p(3)*(dt).^(p(3)-1).*exp(-p(4).*(dt)) + p(2)*p(4)*(dt).^p(3).*exp(-p(4).*(dt)); %dy/ddelay
        end
    end
return

Step 4. Set link between each compartment and add output.

    %links/output for baseline condition:
    cm = addLink(cm, 'L',  'C_p',     'F',      'k1');
    cm = addLink(cm, 'K',  'F',       'Junk',   'k2');
    cm = addLink(cm, 'K2', 'F',       'B',      'kon');
    cm = addLink(cm, 'K',  'B',       'F',      'koff');

    disp('Output is sum of radioactivity in free and bound compartments')
    WList = {...
          'F', 'PV'; 
          'F2', 'PV';
          'B', 'PV';
          'B2', 'PV'};
    XList = {}; 
    cm = addOutput(cm, 'PET Scan', WList, XList);

    %links/output for activation condition:
    cm = addLink(cm, 'L',  'C_p2',     'F2',      'k1');
    cm = addLink(cm, 'K',  'F2',       'Junk',    'k2');
    cm = addLink(cm, 'K2', 'F2',       'B2',      'kon');
    cm = addLink(cm, 'L2', 'F^{EN}',  'B^{EN}', 'konEN');   
    cm = addLink(cm, 'K',  'B2',       'F2',      'koff');
    cm = addLink(cm, 'K',  'B^{EN}',  'Junk',    'koffEN');
    

Step 5. Solve the model and generate the output


    disp('Properly handle the initial conditions assuming no exogenous ligand initially')
    compNames = get(cm, 'CompartmentName');
    sensNames = get(cm, 'SensitivityName');
    ncomp = get(cm, 'NumberCompartments');
    idxBENComp = strmatch('B^{EN}', compNames, 'exact');
    idxBasal = strmatch('DA', sensNames);
    IC.time = 0;
    
    IC.compartment = cell([ncomp 1]);  
    IC.compartmentSensitivity = cell([length(compNames) length(sensNames)]);
    IC.compartmentSensitivity{idxBEN, idxBasal} = 'Bmax*(koffEN/konEN) / ((koffEN/konEN + DAbasal)^2)';
    IC.compartment{idxBENComp} = 'Bmax*DAbasal/(koffEN/konEN+DAbasal)';
    cm = set(cm, 'InitialConditions', IC);

    [PET, PETIndex, Output, OutputIndex] = solve(cm);
    
    Bmax = pxEval(cm, 'Bmax');
    disp('Plot some compartment concentrations to examine model behavior');
    figure; idx = [3 6]; plot(Output(:,1), Output(:, idx), 'LineWidth', 2); legend(OutputIndex(idx)); title('Free Compartment Concentrations');
    figure; idx = [4 7 8]; plot(Output(:,1), Output(:, idx), [0 Output(end,1)],  [Bmax Bmax], 'g:', 'LineWidth', 2); legend(OutputIndex(idx), 'Bmax'); title('Bound    
    Compartment Concentrations');

Output1.jpg

Output2.jpg

Step 6. Fit the simulated data

    basal_LB  = 30;      basal_UB  = 70;
    gamma_LB  = 15;      gamma_UB  = 50;
    alpha_LB  = 0.1;    alpha_UB  = 5;
    beta_LB   = 0.01;   beta_UB   = 1;
    delay_LB  = 240;    delay_UB  = 300;
    k1_LB     = 0.01;   k1_UB     = 3;
    k2_LB     = 0.01;   k2_UB     = 1;
    kon_LB    = 0.001;  kon_UB    = 0.1;
    koff_LB   = 0.01;   koff_UB   = 1;
    
    pinit = [45 18 1 0.01 250 0.1 0.1 0.005 0.1];   
    cm = set(cm, 'ExperimentalData', PET(:,3));
        
    lb = [basal_LB ; gamma_LB ; alpha_LB ; beta_LB ; delay_LB ; k1_LB ; k2_LB ; kon_LB ; koff_LB];
    ub = [basal_UB ; gamma_UB ; alpha_UB ; beta_UB ; delay_UB ; k1_UB ; k2_UB ; kon_UB ; koff_UB];    
    
    [pfit, modelfit, resnorm, residual, exitFlag, output] = fit(cm, pinit, lb, ub);
    
    figure; plot(t, ntInput(t,0,params,num2cell(DApar)), 'b--',t, ntInput(t,0,params,num2cell(pfit(1:5))), 'r-', 'LineWidth', 1.5); 
    title('Endogenous Input Function'); legend('True F^{en}','Estimated F^{en}'); 

Fitoutput.jpg