image thumbnail
from virtualPCR v0.6 by Gie Spaepen
This little program generates real-time PCR plots based all important real-time PCR parameters.

virtualPCR(varargin)
function varargout = virtualPCR(varargin)
% VIRTUALPCR M-file for virtualPCR.fig
%      VIRTUALPCR, by itself, creates a new VIRTUALPCR or raises the existing
%      singleton*.
%
%      H = VIRTUALPCR returns the handle to a new VIRTUALPCR or the handle to
%      the existing singleton*.
%
%      VIRTUALPCR('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in VIRTUALPCR.M with the given input arguments.
%
%      VIRTUALPCR('Property','Value',...) creates a new VIRTUALPCR or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before virtualPCR_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to virtualPCR_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
%      This GUI is based on the virtualPCR algorithm which is located in
%      the doRTReaction.m file.  If you want to tweak parameters in this
%      algorithm
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help virtualPCR

% Last Modified by GUIDE v2.5 12-Sep-2007 17:23:09

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @virtualPCR_OpeningFcn, ...
                   'gui_OutputFcn',  @virtualPCR_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
%Call global

% --- Executes just before virtualPCR is made visible.
function virtualPCR_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to virtualPCR (see VARARGIN)

%Show welcome message
clc;
disp(' ');
disp(' ');
disp(' ');
disp(' ');
disp('***********************************');
disp('* virtualPCR - (c)2007 University of Antwerp ');
disp('* Author: Gie Spaepen');
disp('* ');
disp('* University of Antwerp');
disp('* Dept. of Medicine');
disp('* ');
disp('* Email: gie.spaepen@ua.ac.be');
disp('* ');
disp('***********************************');
disp(' ');
disp(' ');
disp(' ');
disp(' ');
%Reset global values
global vSamples;
vSamples = {'Name','Cycles','Eff','dNTP','Primers/Probe','RIN','cDNA'};

% Choose default command line output for virtualPCR
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes virtualPCR wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = virtualPCR_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on selection change in lbSamples.
function lbSamples_Callback(hObject, eventdata, handles)
% hObject    handle to lbSamples (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns lbSamples contents as cell array
%        contents{get(hObject,'Value')} returns selected item from lbSamples


% --- Executes during object creation, after setting all properties.
function lbSamples_CreateFcn(hObject, eventdata, handles)
% hObject    handle to lbSamples (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function txtName_Callback(hObject, eventdata, handles)
% hObject    handle to txtName (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of txtName as text
%        str2double(get(hObject,'String')) returns contents of txtName as a double


% --- Executes during object creation, after setting all properties.
function txtName_CreateFcn(hObject, eventdata, handles)
% hObject    handle to txtName (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function txtCDNA_Callback(hObject, eventdata, handles)
% hObject    handle to txtCDNA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of txtCDNA as text
%        str2double(get(hObject,'String')) returns contents of txtCDNA as a double


% --- Executes during object creation, after setting all properties.
function txtCDNA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to txtCDNA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function txtEff_Callback(hObject, eventdata, handles)
% hObject    handle to txtEff (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of txtEff as text
%        str2double(get(hObject,'String')) returns contents of txtEff as a double


% --- Executes during object creation, after setting all properties.
function txtEff_CreateFcn(hObject, eventdata, handles)
% hObject    handle to txtEff (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


function txtCycles_Callback(hObject, eventdata, handles)
% hObject    handle to txtCycles (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of txtCycles as text
%        str2double(get(hObject,'String')) returns contents of txtCycles as a double


% --- Executes during object creation, after setting all properties.
function txtCycles_CreateFcn(hObject, eventdata, handles)
% hObject    handle to txtCycles (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function txtPrimers_Callback(hObject, eventdata, handles)
% hObject    handle to txtPrimers (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of txtPrimers as text
%        str2double(get(hObject,'String')) returns contents of txtPrimers as a double


% --- Executes during object creation, after setting all properties.
function txtPrimers_CreateFcn(hObject, eventdata, handles)
% hObject    handle to txtPrimers (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

% --- Executes on button press in btAdd.
function btAdd_Callback(hObject, eventdata, handles)
% hObject    handle to btAdd (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%Call global
global vSamples;

%Get the fields
%try
    name = get(handles.txtName,'string');
    eff = str2num(get(handles.txtEff,'string'));
    cs = str2num(get(handles.txtCycles,'string'));
    dntp = str2num(get(handles.txtDNTP,'string'));
    pp = str2num(get(handles.txtPrimers,'string')); 
    rin = str2num(get(handles.txtRIN,'string'));  
    disp(rin);
    cdna = str2num(get(handles.txtCDNA,'string'));
    
    %Compile the sample
    sample = {name,eff,cs,dntp,pp,rin,cdna};
    %and concatenate
    try
        vSamples = [vSamples;sample];
    catch
        sample = {name,eff,cs,dntp,pp,rin,cdna,'',''};
        vSamples = [vSamples;sample];
    end
%catch
    disp('* Some of the parameters are no numbers');
%end

%Set the listbox
set(handles.lbSamples,'string',vSamples(:,1));


% --- Executes on button press in btCalculate.
function btCalculate_Callback(hObject, eventdata, handles)
% hObject    handle to btCalculate (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%Call global
global vSamples;

%Set axes
axes(handles.axAmpPlot);
%Clear axes
cla;

%Results
vResults = {'Ct','StDev'};

%Loop through the samples
clc;
disp('***********************************');
disp('* Start PCR Reaction');
disp('***********************************');
disp(' ');
for i=2:size(vSamples,1)
   %Get the parameters
   name = vSamples{i,1};
   eff = vSamples{i,2};
   cs = vSamples{i,3};
   dntp = vSamples{i,4};
   pp = vSamples{i,5};
   rin = vSamples{i,6};
   cdna = vSamples{i,7};
   %Launch the reaction
   disp('***********************************');
   disp(strcat('* Name:',name));
   [rn,ct,ctstdev] = doTripleRT(cdna,dntp,pp,cs,eff,rin,1);
   %Concatenate the results
   result = {ct,ctstdev};
   vResults = [vResults;result];
   disp(' ');
end

%Save figure, ask first
%button = questdlg('Save this plot as image?','virtualPCR','Yes','No','No');
%if strcmp(button,'Yes') == 1
%    saveas(gcf,'lastrun','jpg');
%end

function txtDNTP_Callback(hObject, eventdata, handles)
% hObject    handle to txtDNTP (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of txtDNTP as text
%        str2double(get(hObject,'String')) returns contents of txtDNTP as a double


% --- Executes during object creation, after setting all properties.
function txtDNTP_CreateFcn(hObject, eventdata, handles)
% hObject    handle to txtDNTP (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


% --- Executes on button press in btClear.
function btClear_Callback(hObject, eventdata, handles)
% hObject    handle to btClear (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%Reset the global
global vSamples;
vSamples = {'Name','Cycles','Eff','dNTP','Primers/Probe','RIN','cDNA'};;

%Set axes
axes(handles.axAmpPlot);
%Clear axes
cla;

%Set the listbox
set(handles.lbSamples,'string',vSamples(:,1));

% --- Executes on button press in rbLinear.
function rbLinear_Callback(hObject, eventdata, handles)
% hObject    handle to bt_setAxis (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%Set axes
axes(handles.axAmpPlot);

%Change axes
set(gca,'YScale','linear');

% --- Executes on button press in rbLinear.
function rbLog_Callback(hObject, eventdata, handles)
% hObject    handle to bt_setAxis (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%Set axes
axes(handles.axAmpPlot);

%Change axes
set(gca,'YScale','log');


% --- Executes on button press in btViewResults.
function btViewResults_Callback(hObject, eventdata, handles)
% hObject    handle to btViewResults (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

global vSamples;
vSamples



function edit8_Callback(hObject, eventdata, handles)
% hObject    handle to edit8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit8 as text
%        str2double(get(hObject,'String')) returns contents of edit8 as a double


% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function txtRIN_Callback(hObject, eventdata, handles)
% hObject    handle to txtRIN (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of txtRIN as text
%        str2double(get(hObject,'String')) returns contents of txtRIN as a double


% --- Executes during object creation, after setting all properties.
function txtRIN_CreateFcn(hObject, eventdata, handles)
% hObject    handle to txtRIN (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


Contact us at files@mathworks.com