function varargout = blast(varargin)
% BLAST M-file for blast.fig
% BLAST, by itself, creates a new BLAST or raises the existing
% singleton*.
%
% H = BLAST returns the handle to a new BLAST or the handle to
% the existing singleton*.
%
% BLAST('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in BLAST.M with the given input arguments.
%
% BLAST('Property','Value',...) creates a new BLAST or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before blast_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to blast_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help blast
% Last Modified by GUIDE v2.5 26-Feb-2005 15:33:19
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @blast_OpeningFcn, ...
'gui_OutputFcn', @blast_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
% --- Executes just before blast is made visible.
function blast_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 blast (see VARARGIN)
% Choose default command line output for blast
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes blast wait for user response (see UIRESUME)
% uiwait(handles.figure1);
list{1}='Not Available';
list{2}='Create sequence db ...';
a = dir('*.nhr')
for i = 1:length(a)
n = a(i).name;
[p,n,e] = fileparts(n);
list{i} = n;
if i==length(a)
list{i+1} = 'Create sequence db ...';
end
end
set(handles.pm_Database, 'String', list)
set(handles.pb_BlastThem, 'enable', 'off')
set(handles.pb_load2, 'enable', 'off')
%Check to see if the blast executables are downloaded already
%If not, grey out all the pushbuttons except the download
set(handles.pb_blast, 'enable', 'off')
a = dir('*.exe')
if length(a)==13
%do nothing
else
set(handles.pb_Load, 'enable', 'off')
set(handles.pb_load1, 'enable', 'off')
end
% --- Outputs from this function are returned to the command line.
function varargout = blast_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;
%% BL2SEQ
% --- Executes on button press in pb_load1.
function pb_load1_Callback(hObject, eventdata, handles)
% hObject handle to pb_load1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
file1 = uigetfile('*.fasta');
set(handles.pb_load1, 'Userdata', file1)
set(handles.pb_load2, 'Enable', 'on')
% --- Executes on button press in pb_load2.
function pb_load2_Callback(hObject, eventdata, handles)
% hObject handle to pb_load2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
file2 = uigetfile('*.fasta');
set(handles.pb_load2, 'Userdata', file2)
set(handles.pb_BlastThem, 'Enable', 'on')
% --- Executes on button press in pb_BlastThem.
function pb_BlastThem_Callback(hObject, eventdata, handles)
% hObject handle to pb_BlastThem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
file1 = get(handles.pb_load1,'Userdata');
file2 = get(handles.pb_load2,'Userdata');
system(['bl2seq -i ' file1 ' -j ' file2 ' -p blastn -o output.txt'])
pause(2)
winopen('output.txt')
%% BLAST
% --- Executes on button press in pb_Load.
function pb_Load_Callback(hObject, eventdata, handles)
% hObject handle to pb_Load (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[FileName,PathName] = uigetfile('*.fasta');
set(handles.pb_Load, 'Userdata', FileName);
x = strcat(PathName, FileName);
set(handles.edit_DisplayFile, 'string', x)
set(handles.pb_blast, 'enable', 'on')
%if not(ischar(FileName))
% set(handles.pb_blast, 'enable','on')
%end
% --- Executes on selection change in pm_SelectProgram.
function pm_SelectProgram_Callback(hObject, eventdata, handles)
% hObject handle to pm_SelectProgram (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 pm_SelectProgram contents as cell array
% contents{get(hObject,'Value')} returns selected item from pm_SelectProgram
% --- Executes during object creation, after setting all properties.
function pm_SelectProgram_CreateFcn(hObject, eventdata, handles)
% hObject handle to pm_SelectProgram (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in pm_MatrixType.
function pm_MatrixType_Callback(hObject, eventdata, handles)
% hObject handle to pm_MatrixType (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 pm_MatrixType contents as cell array
% contents{get(hObject,'Value')} returns selected item from pm_MatrixType
% --- Executes during object creation, after setting all properties.
function pm_MatrixType_CreateFcn(hObject, eventdata, handles)
% hObject handle to pm_MatrixType (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in pm_Database.
function pm_Database_Callback(hObject, eventdata, handles)
% hObject handle to pm_Database (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 pm_Database contents as cell array
% contents{get(hObject,'Value')} returns selected item from pm_Database
total_contents = get(hObject,'String');
num_elements = length(total_contents);
index_selected = get(hObject,'Value');
item_selected = total_contents{index_selected};
if index_selected==num_elements
%Do formatdb
file_in = uigetfile('*', 'Select FASTA formatted sequence file');
button = questdlg('Is this DNA or Protein sequence?','Select sequence type','DNA','Protein','DNA')
if strcmp(button, 'DNA')
TypeSelect = 'F';
else
TypeSelect = 'T';
end
system(['formatdb -i ' file_in ' -p ' TypeSelect])
a = dir('*.nhr')
for i = 1:length(a)
n = a(i).name;
[p,n,e] = fileparts(n);
list{i} = n;
if i==length(a)
list{i+1} = 'Create sequence db ...';
end
end
set(handles.pm_Database, 'String', list)
end
% --- Executes during object creation, after setting all properties.
function pm_Database_CreateFcn(hObject, eventdata, handles)
% hObject handle to pm_Database (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit_Evalue_Callback(hObject, eventdata, handles)
% hObject handle to edit_Evalue (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 edit_Evalue as text
% str2double(get(hObject,'String')) returns contents of edit_Evalue as a double
% --- Executes during object creation, after setting all properties.
function edit_Evalue_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_Evalue (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in pm_ViewOptions.
function pm_ViewOptions_Callback(hObject, eventdata, handles)
% hObject handle to pm_ViewOptions (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 pm_ViewOptions contents as cell array
% contents{get(hObject,'Value')} returns selected item from pm_ViewOptions
% --- Executes during object creation, after setting all properties.
function pm_ViewOptions_CreateFcn(hObject, eventdata, handles)
% hObject handle to pm_ViewOptions (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in pm_GappedAlignment.
function pm_GappedAlignment_Callback(hObject, eventdata, handles)
% hObject handle to pm_GappedAlignment (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 pm_GappedAlignment contents as cell array
% contents{get(hObject,'Value')} returns selected item from pm_GappedAlignment
% --- Executes during object creation, after setting all properties.
function pm_GappedAlignment_CreateFcn(hObject, eventdata, handles)
% hObject handle to pm_GappedAlignment (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit_GapCost_Callback(hObject, eventdata, handles)
% hObject handle to edit_GapCost (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 edit_GapCost as text
% str2double(get(hObject,'String')) returns contents of edit_GapCost as a double
% --- Executes during object creation, after setting all properties.
function edit_GapCost_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_GapCost (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit_GapExtend_Callback(hObject, eventdata, handles)
% hObject handle to edit_GapExtend (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 edit_GapExtend as text
% str2double(get(hObject,'String')) returns contents of edit_GapExtend as a double
% --- Executes during object creation, after setting all properties.
function edit_GapExtend_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_GapExtend (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit_WordSize_Callback(hObject, eventdata, handles)
% hObject handle to edit_WordSize (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 edit_WordSize as text
% str2double(get(hObject,'String')) returns contents of edit_WordSize as a double
% --- Executes during object creation, after setting all properties.
function edit_WordSize_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_WordSize (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit_MismatchPenalty_Callback(hObject, eventdata, handles)
% hObject handle to edit_MismatchPenalty (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 edit_MismatchPenalty as text
% str2double(get(hObject,'String')) returns contents of edit_MismatchPenalty as a double
% --- Executes during object creation, after setting all properties.
function edit_MismatchPenalty_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_MismatchPenalty (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit_MatchReward_Callback(hObject, eventdata, handles)
% hObject handle to edit_MatchReward (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 edit_MatchReward as text
% str2double(get(hObject,'String')) returns contents of edit_MatchReward as a double
% --- Executes during object creation, after setting all properties.
function edit_MatchReward_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_MatchReward (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pb_blast.
function pb_blast_Callback(hObject, eventdata, handles)
% hObject handle to pb_blast (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
SeqFastaFile = get(handles.pb_Load, 'Userdata');
ProgName = getString(handles.pm_SelectProgram);
GappedAlignment = getString(handles.pm_GappedAlignment);
ViewOption_index = num2str(get(handles.pm_ViewOptions,'value')-1);
Database = getString(handles.pm_Database);
%Database = 'Makhi_genes'
MatrixType = getString(handles.pm_MatrixType);
Evalue = get(handles.edit_Evalue, 'string');
GapCost = get(handles.edit_GapCost, 'string');
GapExtend = get(handles.edit_GapExtend, 'string');
WordSize = get(handles.edit_WordSize, 'string');
MismatchPenalty = get(handles.edit_MismatchPenalty, 'string');
MatchReward = get(handles.edit_MatchReward, 'string');
dos_string = ['blastall -p ' ProgName ' -d ' Database ' -i ' SeqFastaFile ' -e ' Evalue ' -m ' ViewOption_index ' -G ' GapCost ' -E ' GapExtend ' -W ' WordSize ' -q ' MismatchPenalty ' -r ' MatchReward ' -o blastout.txt'];
set(hObject,'Enable','off')
set(handles.figure1,'Pointer','watch')
s = system(dos_string);
set(hObject,'Enable','on')
set(handles.figure1,'Pointer','arrow')
winopen('blastout.txt')
% --- Executes during object creation, after setting all properties.
function pb_blast_CreateFcn(hObject, eventdata, handles)
% hObject handle to pb_blast (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
%set(handles.pb_blast, 'enable','off')
% --- Executes on selection change in pm_TypeSelect.
function pm_TypeSelect_Callback(hObject, eventdata, handles)
% hObject handle to pm_TypeSelect (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 pm_TypeSelect contents as cell array
% contents{get(hObject,'Value')} returns selected item from pm_TypeSelect
% --- Executes during object creation, after setting all properties.
function pm_TypeSelect_CreateFcn(hObject, eventdata, handles)
% hObject handle to pm_TypeSelect (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% % --- Executes on button press in pb_formatdb.
% function pb_formatdb_Callback(hObject, eventdata, handles)
% % hObject handle to pb_formatdb (see GCBO)
% % eventdata reserved - to be defined in a future version of MATLAB
% % handles structure with handles and user data (see GUIDATA)
% file_in = get(handles.pb_LoadFormatdb, 'Userdata')
% [TypeSelect,index] = getString(handles.pm_TypeSelect)
% if index == 1
% TypeSelect = 'F'
% else
% TypeSelect = 'T'
% end
% system(['formatdb -i ' file_in ' -p ' TypeSelect])
% a = dir('*.nhr')
% for i = 1:length(a)
% n = a(i).name;
% [p,n,e] = fileparts(n);
% list{i} = n;
% end
% set(handles.pm_Database, 'String', list)
% %This generates a binary file with the name of the input file in same
% %directory
%% HELPER FUNCTIONS
%function getString
%Obtains the name of the entry in drop down list
function [name,index] = getString(handle_name)
list = get(handle_name, 'string');
index = get(handle_name, 'value');
name = list{index};
% --- Executes on button press in pb_GetBlast.
function pb_GetBlast_Callback(hObject, eventdata, handles)
% hObject handle to pb_GetBlast (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
f = ftp('ftp.ncbi.nih.gov');
cd(f,'blast/executables/LATEST');
mget(f,'blast-20041205-ia32-win32.exe');
close(f);
!blast-20041205-ia32-win32.exe
set(handles.pb_blast, 'enable', 'on')
set(handles.pb_formatdb, 'enable', 'on')
set(handles.pb_Load, 'enable', 'on')
set(handles.pb_load1, 'enable', 'on')
% --------------------------------------------------------------------
function HelpMenu_Callback(hObject, eventdata, handles)
% hObject handle to HelpMenu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function HelpGUIMenu_Callback(hObject, eventdata, handles)
% hObject handle to HelpGUIMenu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
web('help.html')
function edit_DisplayFile_Callback(hObject, eventdata, handles)
% hObject handle to edit_DisplayFile (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 edit_DisplayFile as text
% str2double(get(hObject,'String')) returns contents of edit_DisplayFile as a double
% --- Executes during object creation, after setting all properties.
function edit_DisplayFile_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_DisplayFile (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end