Code covered by the BSD License  

Highlights from
ClustalW Interface

from ClustalW Interface by Steve Simon
MATLAB tools for working with ClustalW.

clustalwgui(varargin)
function varargout = clustalwgui(varargin)
% CLUSTALWGUI interface to ClustalW
%      CLUSTALWGUI provides a simple interface to the stand-alone version
%      of the ClustalW alignment software
%
%  Requirements: compiled version of the CLustalW stand-alone application
%      appropriate for your system architecture.  Source code (or
%      precompiled binaries) are available for free download here:
%     
%     ftp://ftp-igbmc.u-strasbg.fr/pub/ClustalW/
%
%     The compiled application should be placed in the same directory as
%     the CLUSTALWGUI files
%
%
%  Known Limitations: Haven't implemented all of the available options.
%     Limit to number of characters that can be passed as input for the
%     Windows version.
%

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @clustalwgui_OpeningFcn, ...
                   'gui_OutputFcn',  @clustalwgui_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(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


% --- Executes just before clustalwgui is made visible.
function clustalwgui_OpeningFcn(hObject, eventdata, handles, varargin)

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

% Create a default clustalwcmd object
handles.clustalwcmd = clustalwcmd;

% Update handles structure
guidata(hObject, handles);


function varargout = clustalwgui_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;


% -------------- CALL_CLUSTALW --------------
function call_clustalw_btn_Callback(hObject, eventdata, handles)
% use to call ClustalW stand-alone application

% must specify an input file
if get(handles.clustalwcmd,'infile')
    call_clustalw(handles.clustalwcmd)
else
    warndlg('No input file specified.')
end


% -------------- OUTPUT_FORMAT --------------
function output_format_popup_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function output_format_popup_Callback(hObject, eventdata, handles)
% select the output format
ind = get(hObject,'Value');
if ind ~= 1,
    str = get(hObject,'String');
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'output',str{ind});
else % default is ClustalW format
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'output','');
end
guidata(hObject,handles)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   SLOW ALIGNMENT   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% -------------- PWMATRIX --------------
function pwmatrix_popup_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function pwmatrix_popup_Callback(hObject, eventdata, handles)
% select amino acid score matrix
ind = get(hObject,'Value');
if ind < 5
    str = get(hObject,'String');
    set(hObject,'ToolTipString','')    
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'pwmatrix',str{ind});
elseif ind == 5 % File ...
    [pwmatrixfile, pwmatrixpath] = uigetfile({'*.*','All files'},'Select score matrix file');
    if pwmatrixfile == 0, % nothing selected, make no changes
        return
    end
    fullpwmatrixfile = fullfile(pwmatrixpath,pwmatrixfile);
    set(hObject,'ToolTipString',fullpwmatrixfile)
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'pwmatrix',fullpwmatrixfile);
end
guidata(hObject,handles)


% -------------- PWDNAMATRIX --------------
function pwdnamatrix_popup_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function pwdnamatrix_popup_Callback(hObject, eventdata, handles)
% select dna score matrix 
ind = get(hObject,'Value');
if ind < 3
    str = get(hObject,'String');
    set(hObject,'ToolTipString','')
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'pwdnamatrix',str{ind});
elseif ind == 3 % File ...
    [pwdnamatrixfile, pwdnamatrixpath] = uigetfile({'*.*','All files'},'Select DNA score matrix file');
    if pwdnamatrixfile == 0, % nothing selected, make no changes
        return
    end
    fullpwdnamatrixfile = fullfile(pwdnamatrixpath,pwdnamatrixfile);
    set(hObject,'ToolTipString',fullpwdnamatrixfile)
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'pwdnamatrix',fullpwdnamatrixfile);
end
guidata(hObject,handles)


% -------------- PWGAPOPEN --------------
function pwgapopen_edit_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function pwgapopen_edit_Callback(hObject, eventdata, handles)
% pairwise gap opening penalty
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'pwgapopen',num);
guidata(hObject,handles)


% -------------- PWGAPEXT --------------
function pwgapext_edit_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function pwgapext_edit_Callback(hObject, eventdata, handles)
% set pairwise gap extension penalty
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'pwgapext',num);
guidata(hObject,handles)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   FAST ALIGNMENT   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% -------------- KTUPLE --------------
function ktuple_edit_CreateFcn(hObject, eventdata, handles)
set(hObject,'BackgroundColor',[.831 .816 .784]);

function ktuple_edit_Callback(hObject, eventdata, handles)
% ktuple length
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'ktuple',num);
guidata(hObject,handles)


% -------------- TOPDIAGS --------------
function topdiags_edit_CreateFcn(hObject, eventdata, handles)
set(hObject,'BackgroundColor',[.831 .816 .784]);

function topdiags_edit_Callback(hObject, eventdata, handles)
% number of 'best' diagonals to use
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'topdiags',num);
guidata(hObject,handles)


% -------------- WINDOW --------------
function window_edit_CreateFcn(hObject, eventdata, handles)
set(hObject,'BackgroundColor',[.831 .816 .784]);

function window_edit_Callback(hObject, eventdata, handles)
% number of diagonals around each of the 'best' diagonals that will be used.
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'window',num);
guidata(hObject,handles)


% -------------- PAIRGAP --------------
function pairgap_edit_CreateFcn(hObject, eventdata, handles)
set(hObject,'BackgroundColor',[.831 .816 .784]);

function pairgap_edit_Callback(hObject, eventdata, handles)
% gap penalty for pairwise alignments
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'pairgap',num);
guidata(hObject,handles)


% -------------- TYPE --------------
function type_popup_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function type_popup_Callback(hObject, eventdata, handles)
% type of sequences : protein or dna
ind = get(hObject,'Value');
str = get(hObject,'String');
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'type',str{ind});
guidata(hObject,handles)


% -------------- MATRIX --------------
function matrix_popup_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function matrix_popup_Callback(hObject, eventdata, handles)
% protein substitution matrix used in multiple alignments
ind = get(hObject,'Value');
if ind < 5
    str = get(hObject,'String');
    set(hObject,'ToolTipString','')
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'matrix',str{ind});
elseif ind == 5
    [matrixfile, matrixpath] = uigetfile({'*.*','All files'},'Select  score matrix file');
    if matrixfile == 0, % nothing selected, make no changes
        return
    end
    fullmatrixfile = fullfile(matrixpath,matrixfile);
    set(hObject,'ToolTipString',fullmatrixfile)
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'matrix',fullmatrixfile);
end

guidata(hObject,handles)


% -------------- DNAMATRIX --------------
function dnamatrix_popup_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function dnamatrix_popup_Callback(hObject, eventdata, handles)
% dna substitution matrix used in multiple alignments
ind = get(hObject,'Value');
if ind < 3
    str = get(hObject,'String');
    set(hObject,'ToolTipString','')
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'dnamatrix',str{ind});
elseif ind == 3
    [dnamatrixfile, dnamatrixpath] = uigetfile({'*.*','All files'},'Select DNA score matrix file');
    if dnamatrixfile == 0, % nothing selected, make no changes
        return
    end
    fulldnamatrixfile = fullfile(dnamatrixpath,dnamatrixfile);
    set(hObject,'ToolTipString',fulldnamatrixfile)
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'dnamatrix',fulldnamatrixfile);
end
guidata(hObject,handles)


% -------------- GAPOPEN --------------
function gapopen_text_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function gapopen_text_Callback(hObject, eventdata, handles)
% gap opening penalty
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'gapopen',num);
guidata(hObject,handles)


% -------------- GAPEXT --------------
function gapext_text_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function gapext_text_Callback(hObject, eventdata, handles)
%gap extension penalty
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'gapext',num);
guidata(hObject,handles)


% -------------- GAPDIST --------------
function gapdist_text_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function gapdist_text_Callback(hObject, eventdata, handles)
% gap separation distance
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'gapdist',num);
guidata(hObject,handles)


% -------------- ENDGAPS --------------
function endgaps_check_Callback(hObject, eventdata, handles)
% end gap separation
if get(hObject,'Value')
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'endgaps',true);
else
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'endgaps',false);
end
guidata(hObject,handles)


% -------------- NOPGAP --------------
function nopgap_check_Callback(hObject, eventdata, handles)
% Pascarella gaps off
if get(hObject,'Value')
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'nopgap',true);
else
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'nopgap',false);
end
guidata(hObject,handles)


% -------------- NOHGAP --------------
function nohgap_check_Callback(hObject, eventdata, handles)
% hydrophilic gaps off
if get(hObject,'Value')
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'nohgap',true);
else
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'nohgap',false);
end
guidata(hObject,handles)


% -------------- HGAPRESIDUES
function hgapresidues_text_CreateFcn(hObject, eventdata, handles)
% specify hydrophilic residues
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function hgapresidues_text_Callback(hObject, eventdata, handles)
str = get(hObject,'String');
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'hgapresidues',str);
guidata(hObject,handles)


% -------------- MAXDIV --------------
function maxdiv_text_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function maxdiv_text_Callback(hObject, eventdata, handles)
% percent identity for delay
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'maxdiv',num);
guidata(hObject,handles)


% -------------- TRANSWEIGHT --------------
function transweight_text_CreateFcn(hObject, eventdata, handles)
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

function transweight_text_Callback(hObject, eventdata, handles)
% transitions weight
num = str2num(get(hObject,'String'));
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'transweight',num);
guidata(hObject,handles)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                    %
%                                 MENUS                              %
%                                                                    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% --------------------------------------------------------------------
function filemenu_Callback(hObject, eventdata, handles)

% --------------------------------------------------------------------
function inputfile_menu_Callback(hObject, eventdata, handles)
% select input alignment file
[infile, inpath] = uigetfile({'*.aln','Clustal'},'Select sequence file');
if infile == 0, % nothing selected, make no changes
    return
end
fullinfile = fullfile(inpath,infile);
set(handles.input_file_text,'String',infile,'TooltipString',fullinfile)
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'infile',fullinfile);
guidata(hObject,handles)


% --------------------------------------------------------------------
function outputfile_menu_Callback(hObject, eventdata, handles)
% set output alignment file
infilename = get(handles.clustalwcmd,'infile');
[outfile, outfilepath] = uiputfile([infilename(1:end-4) '.aln'],'Select Output Location');
if outfile == 0, % nothing selected, make no changes
    return
end
outfile = lower(outfile);
outpath = lower(outfilepath);
fulloutfile = fullfile(outfilepath,outfile);
set(handles.output_file_text,'String',outfile,'TooltipString',fulloutfile)
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'outfile',fulloutfile);
guidata(hObject,handles)


% --------------------------------------------------------------------
function newtree_menu_Callback(hObject, eventdata, handles)
% set tree output location
infilename = get(handles.clustalwcmd,'infile');
[outfile, outfilepath] = uiputfile([infilename(1:end-4) '.dnd'],'Select New Tree File');
outfile = lower(outfile);
outpath = outfilepath;
if outfile,
    fulloutfile = fullfile(outfilepath,outfile);
    set(handles.newtree_text,'String',outfile)
    set(handles.usetree_text,'String','')
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'newtree',fulloutfile);
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'usetree','');
    guidata(hObject,handles)
else
    set(handles.newtree_text,'String','')
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'newtree','');
end
    



% --------------------------------------------------------------------
function usetree_menu_Callback(hObject, eventdata, handles)
% select existing tree file
[infile, infilepath] = uigetfile({'*.dnd','Dendrogram'},'Select Tree File');
if infile == 0, % nothing selected, make no changes
    return
end
infile = infile;
inpath = infilepath;
fullinfile = fullfile(inpath,infile);
set(handles.usetree_text,'String',infile)
set(handles.newtree_text,'String','')
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'usetree',fullinfile);
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'newtree','');
guidata(hObject,handles)

% --------------------------------------------------------------------
function align_menu_Callback(hObject, eventdata, handles)

% --------------------------------------------------------------------
function quick_menu_Callback(hObject, eventdata, handles)
% choose between slow and fast alignment
fastobjs = [handles.ktuple_edit,...
            handles.topdiags_edit,...
            handles.window_edit,...
            handles.pairgap_edit];
slowobjs = [handles.pwmatrix_popup,...
            handles.pwdnamatrix_popup,...
            handles.pwgapopen_edit,...
            handles.pwgapext_edit];
if strcmp(get(hObject,'checked'),'on')
    set(hObject,'checked','off')
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'quicktree',false);
    set(fastobjs,'Enable','off',...
                 'BackgroundColor',get(handles.clustalw_figure,'Color'))
    set(slowobjs,'Enable','on',...
                 'BackgroundColor',[1 1 1])    
else
    set(hObject,'checked','on')
    handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'quicktree',true);
    set(fastobjs,'Enable','on',...
                 'BackgroundColor',[1 1 1])
    set(slowobjs,'Enable','off',...
                 'BackgroundColor',get(handles.clustalw_figure,'Color'))
end 
guidata(hObject,handles)

% --------------------------------------------------------------------
function tree_menu_Callback(hObject, eventdata, handles)

% --------------------------------------------------------------------
function resethgap_menu_Callback(hObject, eventdata, handles)
% reset to the default hydrophilic residues
str = 'GPSNDQEKR';
set(handles.hgapresidues_text,'String',str)
handles.clustalwcmd = clustalwcmd(handles.clustalwcmd,'hgapresidues',str);
guidata(hObject,handles)




% --- Executes during object creation, after setting all properties.
function clustalw_figure_CreateFcn(hObject, eventdata, handles)

Contact us at files@mathworks.com