function[]=imagecf(X,col,nfac) % draws images of genes in x ordered by elements of A(:,1), or more % than one eigenvector % for clarity, this version simply restricts to at most 4 images/evecs -- % easy to modify if required; or use multiple times % produces SVD in original order as output % if nargin < 2 error('Requires at least two input arguments.'); else if nargin==2 nfac=1; else if length(nfac)>4 nfac=nfac(1:4); end end end % mean zero the X data prior to SVD [m,k]=size(X); [A,D,F]=svd_mw(X-repmat(mean(X,2),1,k)); % how many images? nr=1; nc=1; nf=length(nfac); if (nf==2), nc=2; end; if (nf>2), nr=2; nc=2; end; clf for j=1:nf subplot(nr,nc,j); [b,i]=sort(A(:,nfac(j))); i=flipud(i); imagesc(X(i,:)); eval(['cmap ',col]) ylabel(['Genes listed by factor ',int2str(nfac(j))]); xlabel('Samples'); end