PCA.m 592 B

1234567891011121314151617181920212223
  1. %PCA analysis script written by Laura Ylä-Outinen
  2. X1=readtable('PCA_table.xlsx');
  3. X1(1:36,1)=table({'hPSC_20517_MEA1and2'});
  4. X2=X1(:,4:end);
  5. X3=table2array(X2);
  6. Xstandard=zscore(X3);
  7. expressions=Xstandard;
  8. %%
  9. subtypes=X1(:,1);
  10. subtypes= table2array(subtypes);
  11. subtypes3=categorical(subtypes);
  12. %%
  13. [coeff, score, latent, tsquared, explained,mu] = pca(expressions); %if matrix do not contain blanks
  14. X=score(:,1);
  15. Y=score(:,2);
  16. Z=score(:,3);
  17. %%
  18. gscatter3b(X,Y,Z, subtypes3, [0.82 0.3 0.1; 0.82 0.3 0.1; 0.82 0.3 0.1; 0 0.48 0.83; 0 0.48 0.83; 0 0.48 0.83;] ,'ox.ox.',[10,10,15,10,10,15]) ;