wt=cbind(log2(1+(all_m0[,33])),log2(1+(all_m0[,17]))) ko=cbind(log2(1+(all_m0[,32])),log2(1+(all_m0[,16]))) #wiss={}; for (i in 2:20){k=kmeans(wt, centers=i, iter.max=200);wiss=c(wiss,k$tot.withinss);print(c(i, k$tot.withinss)) } #plot(wiss) #opt i=25; k=kmeans(wt, centers=i, iter.max=200); pdf("m0_wt_rna_vs_poly2.pdf") plot (wt[,1],wt[,2]) points(k$centers, col="red", pch="*") dev.off() i=25; k2=kmeans(ko, centers=i, iter.max=200); pdf("m0_ko_rna_vs_poly2.pdf") plot (ko[,1],ko[,2]) points(k2$centers, col="red", pch="*") dev.off() #all2_m0=all_m0[(log2(1+all_m0[,17])<1)&(log2(1+all_m0[,16])<1),] #ks.test(log2(1+(all2_m0[,33])),log2(1+(all2_m0[,32]))) wt=cbind(log2(1+(all_m1[,33])),log2(1+(all_m1[,17]))) ko=cbind(log2(1+(all_m1[,32])),log2(1+(all_m1[,16]))) k=kmeans(wt, centers=i, iter.max=200); pdf("m1_wt_rna_vs_poly2.pdf") plot (wt[,1],wt[,2]) points(k$centers, col="red", pch="*") dev.off() i=25; k2=kmeans(ko, centers=i, iter.max=200); pdf("m1_ko_rna_vs_poly2.pdf") plot (ko[,1],ko[,2]) points(k2$centers, col="red", pch="*") dev.off() wt=cbind(log2(1+(all_m2[,33])),log2(1+(all_m2[,17]))) ko=cbind(log2(1+(all_m2[,32])),log2(1+(all_m2[,16]))) k=kmeans(wt, centers=i, iter.max=200); pdf("m2_wt_rna_vs_poly2.pdf") plot (wt[,1],wt[,2]) points(k$centers, col="red", pch="*") dev.off() i=25; k2=kmeans(ko, centers=i, iter.max=200); pdf("m2_ko_rna_vs_poly2.pdf") plot (ko[,1],ko[,2]) points(k2$centers, col="red", pch="*") dev.off() wt=cbind(log2(1+(all_2h[,33])),log2(1+(all_2h[,17]))) ko=cbind(log2(1+(all_2h[,32])),log2(1+(all_2h[,16]))) k=kmeans(wt, centers=i, iter.max=200); pdf("2h_wt_rna_vs_poly2.pdf") plot (wt[,1],wt[,2]) points(k$centers, col="red", pch="*") dev.off() i=25; k2=kmeans(ko, centers=i, iter.max=200); pdf("2h_ko_rna_vs_poly2.pdf") plot (ko[,1],ko[,2]) points(k2$centers, col="red", pch="*") dev.off() wt=cbind(log2(1+(all_6h[,33])),log2(1+(all_6h[,17]))) ko=cbind(log2(1+(all_6h[,32])),log2(1+(all_6h[,16]))) k=kmeans(wt, centers=i, iter.max=200); pdf("6h_wt_rna_vs_poly2.pdf") plot (wt[,1],wt[,2]) points(k$centers, col="red", pch="*") dev.off() i=25; k2=kmeans(ko, centers=i, iter.max=200); pdf("6h_ko_rna_vs_poly2.pdf") plot (ko[,1],ko[,2]) points(k2$centers, col="red", pch="*") dev.off() require(hexbin) hbin=hexbin(log2(1+(all_m0[,33])),log2(1+(all_m0[,17]))) pdf("dens_m0_wt_rna_vs_poly.pdf") plot(hbin) dev.off() hbin=hexbin(log2(1+(all_m0[,32])),log2(1+(all_m0[,16]))) pdf("dens_m0_ko_rna_vs_poly.pdf") plot(hbin) dev.off() hbin=hexbin(log2(1+(all_6h[,33])),log2(1+(all_6h[,17]))) pdf("dens_m0_wt_rna_vs_poly.pdf") plot(hbin) dev.off() hbin=hexbin(log2(1+(all_6h[,32])),log2(1+(all_6h[,16]))) pdf("dens_m0_ko_rna_vs_poly.pdf") plot(hbin) dev.off()