Changeset 151


Ignore:
Timestamp:
01/11/20 00:14:42 (5 years ago)
Author:
bduin
Message:
 
Location:
prdatasets
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • prdatasets/flowcyto.m

    r150 r151  
    2525
    2626if nargin < 1 || isempty(n)
    27   n = 1;
     27  n = 0;
    2828end
    2929
    30 if any(n<1) || any(n>4)
     30if any(n<0) || any(n>4)
    3131  error('Dataset number should be larger than 0 and smaller than 5')
    3232end
    3333
    34 d = pr_getdata('http://prtools.tudelft.nl/prdatasets/FlowCyto_sort.mat',5);
    35 
    36 a = cell(1,numel(n));
    37 for j=1:numel(n)
    38   x = prdataset(d{n(j)});
    39   x = setname(x(:,2:255),['Flow Cytometry ' num2str(n(j))]);
    40   desc = ['These datasets are based on 612 FL3-A DNA flowcytometer histograms' ...
    41   'from breast cancer tissues in 256 resolution. The initial data have been' ...
    42   'acquired by M. Nap and N. van Rodijnen of the Atrium Medical Center in' ...
    43   'Heerlen, The Netherlands, during 2000-2004, using tubes 3-6 of a DACO' ...
    44   'Galaxy flowcytometer (N = 1-4). Histograms are labeled in 3 classes:' ...
    45   'aneuploid (335 patients), diploid (131) and tetraploid (146). The first' ...
    46   'and the last bin (1 and 256) are set to 0, as they contsin noise. After' ...
    47   'that histograms are normalized (sum to one) resulting in a dataset with' ...
    48   '254 features.'];
    49   ref = {['']};
    50   x = setprior(x,getprior(x,0));
    51   x = setuser(x,desc,'desc');
    52   x = setuser(x,ref,'ref');
    53   a{j} = x;
     34a = pr_loadmatfile(['flowcyto_' num2str(n)]);
     35if isempty(a)
     36  d = pr_getdata('http://prtools.tudelft.nl/prdatasets/FlowCyto_sort.mat',5);
     37  matfile = fullfile(fullfile(fileparts(which(mfilename)),'data'),'flowcyto');
     38  b = [];
     39  for i=1:4
     40    a = setname(prdataset(d{i}),['Flow Cytometry Tube_' num2str(i+2)]);
     41    save([matfile '_' num2str(i)],'a');
     42    b = [b a];
     43  end
     44  a = setname(b,'Flow Cytometry');
     45  save([matfile '_0'],'a');
     46  a = pr_loadmatfile(['flowcyto_' num2str(n)]);
    5447end
    55 
    56 if numel(a) == 1
    57   a = a{1};
    58 end
    59 
    60 
  • prdatasets/pr_download_uci.m

    r150 r151  
    172172  if exist([filenames{j} '.mat'],'file') == 2
    173173    % if mat-file is available, use it
    174     s = load([filenames{j} '.mat']);
    175     f = fieldnames(s);
    176     a = getfield(s,f{1});
     174%     s = load([filenames{j} '.mat']);
     175%     f = fieldnames(s);
     176%     a = getfield(s,f{1});
     177    a = file2dset([filenames{j} '.mat']);
    177178  else
    178179    if ~exist('data','var')
  • prdatasets/pr_getdata.m

    r150 r151  
    1111%
    1212% A mat-file returns a structure with fields pointing to stored variables.
    13 % If available, the dataset DSET stored in FIELD (default 1) is returned in
    14 % OUT. In case of a datafile DFILE, it is created, if necessary, with given
     13% If available, the dataset DSET stored in FIELD is returned in OUT. If
     14% FIELD is not set all fields are returned in a cell array.
     15%
     16% In case of a datafile DFILE, it is created, if necessary, with given
    1517% TYPE and returned in OUT. In case the download was successful but no
    1618% dataset or datfile could be created (e.g. because of empty TYPE) OUT is
     
    127129if exist([dsetmat],'file') == 2
    128130  try
    129     s = prload(dsetmat);
     131    out = file2dset(dsetmat);
    130132  catch ME
    131     out = 'error';
    132     return
    133   end
    134   if isstruct(s)
    135     if isempty(field)
    136       f = fieldnames(s);
    137       out = getfield(s,f{1});
     133    s = load(dsetmat);
     134    if isstruct(s)
     135      if isempty(field)
     136        s = struct2cell(s);
     137        out = s{1};
     138      else
     139        out = getfield(s,field);
     140      end
    138141    else
    139       out = getfield(s,field);
     142      out = s;
    140143    end
    141   else
    142     out = s;
    143144  end
    144145elseif exist(dset,'dir') == 7
  • prdatasets/pr_loadmatfile.m

    r137 r151  
    2424  name = pr_callername;
    2525end
    26 matfile = fullfile(fullfile(fileparts(which(name)),'data'),name);
     26matfile = fullfile(fullfile(fileparts(which(mfilename)),'data'),name);
     27if exist([matfile '.mat'],'file') ~= 2,
     28  return
     29end
    2730
    2831if nargout == 1
    29   varargout{1} = loadmatf([matfile '.mat']);
     32%   varargout{1} = loadmatf([matfile '.mat']);
     33  varargout{1} = file2dset([matfile '.mat']);
    3034else
    3135  for i=1:nargout
    32     varargout{i} = loadmatf([matfile '_' num2str(i) '.mat']);
     36%     varargout{i} = loadmatf([matfile '_' num2str(i) '.mat']);
     37    varargout{i} = file2dset([matfile '_' num2str(i) '.mat']);
    3338  end
    3439end
  • prdatasets/pr_showdsets.m

    r142 r151  
    22
    33forget = {'Contents','mfeat_all','check_','pr_'};
    4 commands = struct2cell(dir('*.m'));
     4dirr = fileparts(which(mfilename));
     5commands = struct2cell(dir(fullfile(dirr,'*.m')));
    56commands = commands(1,:);
    67L = strmatch('pr_',commands);
Note: See TracChangeset for help on using the changeset viewer.