Skip to content

Instantly share code, notes, and snippets.

@icaoberg
Created July 9, 2012 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icaoberg/3079133 to your computer and use it in GitHub Desktop.
Save icaoberg/3079133 to your computer and use it in GitHub Desktop.
Train a generative model of subcellular location using the LAMP2 dataset from the Murphy Lab on CellOrganizer
function answer = lamp2( directory )
%LAMP2 Helper script that shows how to train a generative model of
%subcelullar location using the LAMP2 dataset from the Murphy Lab.
% Author: Ivan E. Cao-Berg (icaoberg@scs.cmu.edu)
%
% Copyright (C) 2012 Murphy Lab
% Lane Center for Computational Biology
% School of Computer Science
% Carnegie Mellon University
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published
% by the Free Software Foundation; either version 2 of the License,
% or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
% 02110-1301, USA.
%
% For additional information visit http://murphylab.web.cmu.edu or
% send email to murphy@cmu.edu
if nargin == 0
directory = '/share/images/Hela/3D';
end
dimensionality = '3D';
answer = false;
pattern = 'LAMP2';
imageDirectory = [ directory filesep 'LAM' ];
if ~exist( imageDirectory )
warning('Image directory does not exist')
disp( 'Would you like to download the LAMP2 dataset from the Murphy Lab website?' );
option = input( 'Yes/No: ' )
while ~strcmpi( option, 'yes' ) & ~strcmpi( option, 'no' )
warning('Unrecognized option');
disp( 'Would you like to download the LAMP2 dataset from the Murphy Lab website?' );
option = input( 'Yes/No: ' )
end
if strcmpi( option, 'yes' )
if ~exist( 'data.tgz' )
url = 'http://murphylab.web.cmu.edu/data/Hela/3D/3DHela_LAM.tgz';
filename = 'data.tgz';
disp('Downloading data. Please be patient...');
urlwrite(url,filename);
else
disp('File found. Ignoring download.');
end
if ~exist( 'LAM', 'dir' )
disp('Extracting data. Please be patient...');
untar( 'data.tgz' );
dna = 'LAM';
cell = 'LAM';
protein = 'LAM';
else
disp('LAMP2 image folder. Ignoring extraction.');
dna = 'LAM';
cell = 'LAM';
protein = 'LAM';
end
else
return
end
else
dna = imageDirectory;
cell = imageDirectory;
protein = imageDirectory;
end
% generic model options
% ---------------------
% model.name (optional) Holds the name of the model. Default is empty.
param.model.name = 'LAMP2';
% model.id (optional) Holds the id of the model. Default is empty.
try
[status,result] = system( 'uuidgen' );
param.model.id = result(1:end-1);
catch
param.model.id = num2str(now);
end
% model.filename Holds the output filename.
param.model.filename = [ lower(pattern) '.xml' ];
% nuclear shape model options
% ---------------------------
% nucleus.type Holds the nuclear model type. Default is "medial axis".
param.nucleus.type = 'medial axis';
% nucleus.name (optional) Holds the name of the nuclear model. Default is empty.
param.nucleus.name = 'LAMP2';
% nucleus.id (optional) Holds the id of the nuclear model. Default is empty.
try
[status,result] = system( 'uuidgen' );
param.nucleus.id = result(1:end-1);
catch
param.nucleus.id = num2str(now);
end
% cell shape model options
% ------------------------
% cell.type Holds the cell model type. Default is "ratio".
param.cell.type = 'ratio';
% cell.name (optional) Holds the name of the cell model. Default is empty.
param.cell.model = 'LAMP2';
% cell.id (optional) Holds the id the cell model. Default is empty.
try
[status,result] = system( 'uuidgen' );
param.cell.id = result(1:end-1);
catch
param.cell.id = num2str(now);
end
% protein shape model options
% ---------------------------
% protein.type (optional) Holds the protein model type. The default is "vesicle".
param.protein.type = 'vesicle';
% protein.name (optional) Holds the name of the protein model. The default is empty.
param.protein.name = 'LAMP2';
% protein.id (optional) Holds the id of the protein model. The default is empty.
try
[status,result] = system( 'uuidgen' );
param.protein.id = result(1:end-1);
catch
param.protein.id = num2str(now);
end
% protein.class Holds the protein class, e.g. lysosome, endosome.
param.protein.class = 'lysosome';
% protein.cytonuclearflag (optional) Determines whether the protein pattern will be generated in
% the cytosolic space ('cyto'), nuclear space ('nuc') or everywhere ('all').
% Default is cyto.
param.protein.cytonuclearflag = 'cyto';
% other options
% -------------
% verbose (optional) Displays messages to screen. The default is true.
param.verbose = true;
% debug (optional) Reports errors and warnings. Default is false.
param.debug = true;
% train.flag (optional) Selects what model is going to be trained ('nuclear',
% 'framework', or 'all'). Default is 'all'
param.train.flag = 'nuclear';
%documentation
param.documentation.author = 'Ivan E. Cao-Berg';
param.documentation.email = 'icaoberg@scs.cmu.edu';
param.documentation.description = ['Lysosomal-associated membrane protein 2 (LAMP2) ' ...
'also known as CD107b (Cluster of Differentiation 107b)']
param.documentation.website = 'http://www.genenames.org/data/hgnc_data.php?hgnc_id=6501';
answer = img2slml( dimensionality, dna, cell, protein, param );
end%lamp2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment