geoSeries = getgeodata('GSE1441');
gse = getgeodata ('GSE28');
plt = getgeodata (gse.Header.Series.platform_id);
genes = plt.Data(:, 3);
expr = gse.Data;

title = gse.Header.Samples.title;
labels = cellfun(@(x) extractBetween(x, ": ", " hr"), title)

% Data Cleaning

emptyGenes = strcmp('EMPTY', genes);
nanExpr = any(isnan(expr), 2);
nullRows = emptyGenes | nanExpr;
genes(nullRows) = [];
expr (nullRows, :) = [];
numel(genes);

% Preprocessing
mask = genevarfilter (expr);
expr = expr (mask, :);
genes = genes(mask);
numel(genes) 

% FIltering significant genes

[mask, expr, genes] = genelowvalfilter (expr, genes, 'absval', log2(3));
[mask, expr, genes] = geneentropyfilter (expr, genes,'prctile',15);
numel(genes)

% Drawing the clustergram
cgObj = clustergram( expr.double(),'RowLabels', genes, ...
                        'ColumnLabels', labels); 

h = mapcaplot(expr.double(), genes);
[pc, zscores, pcvars] = pca(expr.double());

disp(pcvars)
