Performing Custom Analysis in the Desktop

About Custom Analysis

You can perform custom analysis by setting up Custom Tasks, which are user-defined elements that let you script tasks in combination with each other and with other data processing functions. You can use functions from any of the products in your license. Custom tasks let you work within the context of the SimBiology® desktop and use features like plotting, and exporting data within the desktop, while being able to specify custom processing and analysis of the model data.

Open the Example Project

This example shows you how to set up parameter estimation in the desktop for the G protein model shown in the following section:

Model of the Yeast Heterotrimeric G Protein Cycle .

  1. To open the desktop, at the MATLAB® command line, type

    sbiodesktop

    The SimBiology Desktop opens. Use the Project Explorer in the left pane to navigate.

  2. From the File menu, select Open Project. The Open SimBiology Project dialog box opens.

  3. Browse to the directory in which the product is installed and select the file gprotein.sbproj and then click Open. The project opens in the SimBiology desktop.

Setting Up a Custom Task

  1. From the Analysis menu select Add Analysis Task to Heterotrimeric_G_Protein_wt > Create custom analysis. The SimBiology desktop adds the custom task to the Project Explorer, and opens the task pane.

  2. In the Custom Settings tab you can define your own script that you can run in the desktop.

    The next section shows an example of how to add the script for custom parameter analysis.

Parameter Estimation Using Custom Task

  1. In the Custom Settings tab, replace the default function declaration statement with the following:

    function data = custom(modelobj)
    %Parameter Estimation of a G Protein Model
    
    %Target Data
    
    %Preprocess the experimental data
    
    % The estimated amount of total G protein (Gt) is 10000
    Gt = 10000;
    t_span  = [0 10 30 60 110 210 300 450 600]';
    Ga_frac = [0 0.35 0.4 0.36 0.39 0.33 0.24 0.17 0.2]';
    Ga_target = Ga_frac * Gt;
    
    fh = figure;
    plot(t_span, Ga_target, 'ro');
    grid on;
    title('Variation of Ga');
    xlabel('Time (sec)');
    ylabel('Amount of Ga');
    lgnd0 = 'Target';
    legend(lgnd0);
    
    % Simulate the model as is to see how Ga in the model varies with
    % time. Also calculate the original R-square value
    simdata_orig = sbiosimulate(modelobj);
    [t_orig, Ga_orig] = selectbyname(simdata_orig,'Ga');
    sst = norm(Ga_target - mean(Ga_target))^2;
    Ga_resampled = interp1(t_orig, Ga_orig, t_span, 'cubic');
    sse = norm(Ga_target - Ga_resampled)^2;
    rsquare_orig = 1-sse/sst;
    
    % Plot the original species data
    figure(fh);
    hold on;
    plot(t_orig, Ga_orig);
    str_orig = sprintf('R^2 = %6.4f', rsquare_orig);
    grid on;
    lgnd0 = 'Target';
    lgnd_orig = ['Wild-Type model, ', str_orig];
    legend(lgnd0, lgnd_orig);
    
    % Parameter to Estimate
    param_to_tune = sbioselect(modelobj,'Type','parameter','Name','kGd');
    
    % Match experimental (target) species data to model species data
    Ga = sbioselect(modelobj,'Type','species','Name','Ga');
     
    % Estimate the parameter
    [k_new1, result1] = sbioparamestim(modelobj, t_span, Ga_target, Ga, param_to_tune);
    
    % Simulation Results of Using the Estimated Parameter Value
    %
    % Use the estimated value of kGd and see how it affects simulation
    % results. Before changing the value, save it to reset it later. We
    % will also compute the new R-square value.
    %
    kGd0 = get(param_to_tune, 'Value');
    set(param_to_tune, 'Value', k_new1);
    simdata1 = sbiosimulate(modelobj);
    [t1, Ga1] = selectbyname(simdata1,'Ga');
    sse = result1.fval;
    rsquare1 = 1-sse/sst;
    
    % Plot the data and compare
    figure(fh);
    plot(t1, Ga1, 'm-');
    str1 = sprintf('R^2 = %6.4f', rsquare1);
    lgnd_kGd = ['Single parameter changed, ', str1];
    legend(lgnd0, lgnd_orig, lgnd_kGd);
    
    %Reset the value of the parameter
    set(param_to_tune, 'Value', kGd0);
    
    % Reference
    %
    % Tau-Mu Yi, Hiroaki Kitano, and Melvin I. Simon. PNAS (2003) vol.
    % 100, 10764-10769.
    
  2. In the Plot Results tab, add plots to visualize the results, alternatively you can add plot code to the task script.

  3. Click to run the task. The plot should look similar to this:

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS