Example #1
0
import sys
sys.path.append("..")
import data_tools as dt
import plotting as plot
import numpy as np

plot.plot_cluster_interactive(
    dt.clusterFromFile("hic_data/GM12878_combined_22_10kb_mmds_coords.tsv"),
    out_path="Fig9A.png")
plot.plot_cluster_interactive(
    dt.clusterFromFile("hic_data/GM12878_combined_22_10kb_cmds_coords.tsv"),
    out_path="Fig9B.png")
plot.plot_cluster_interactive(
    dt.clusterFromFile("hic_data/GM12878_combined_22_10kb_minimds_coords.tsv"),
    out_path="Fig9C.png")
plot.plot_coords_interactive(np.loadtxt(
    "MOGEN/examples/hiC/output/GM12878_combined_22_10kb_rep1_coords.tsv"),
                             out_path="Fig9D.png")
Example #2
0
import array_tools as at
import misc

#"true" distance matrix
cluster = dt.clusterFromBed(bedpath, None, None)
contactMat = dt.matFromBed(bedpath, cluster)
distMat = at.contactToDist(contactMat)
at.makeSymmetric(distMat)
for j in range(len(distMat)):  #remove diagonal
    distMat[j, j] = 0

chromthreed_distMat = misc.distsFromCoords(
    "Chromosome3D/output/chr22_100kb/chr22_100kb_coords.tsv")
chromthreed_r = misc.pearson(distMat, chromthreed_distMat)

mmds_distMat = dt.clusterFromFile(
    "hic_data/GM12878_combined_22_10kb_mmds_coords.tsv").distMat()
mmds_r = misc.pearson(distMat, mmds_distMat)

cmds_distMat = dt.clusterFromFile(
    "hic_data/GM12878_combined_22_10kb_cmds_coords.tsv").distMat()
cmds_r = misc.pearson(distMat, cmds_distMat)

minimds_distMat = dt.clusterFromFile(
    "hic_data/GM12878_combined_22_10kb_minimds_coords.tsv").distMat()
minimds_r = misc.pearson(distMat, minimds_distMat)

mogen_distMat = misc.distsFromCoords(
    "MOGEN/examples/hiC/output/GM12878_combined_22_10kb_rep1_coords.tsv")
mogen_r = misc.pearson(distMat, mogen_distMat)

hsa_distMat = misc.distsFromCoords("hsa/GM12878_combined_22_100kb_coords.tsv")
Example #3
0
import sys
sys.path.append("..")
import plotting as plot
import data_tools as dt

chroms = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, "X"]
clusters = [dt.clusterFromFile("hic_data/GM12878_combined_{}_10kb_cluster.tsv".format(chrom)) for chrom in chroms]
plot.plot_clusters_interactive(clusters)
Example #4
0
mmds_rs = np.zeros(n)
cmds_rs = np.zeros(n)
minimds_rs = np.zeros(n)
mogen_rs = np.zeros(n)

for i, chrom in enumerate(chroms):
	#"true" distance matrix
	bedpath = "hic_data/GM12878_combined_{}_10kb.bed".format(chrom)
	cluster = dt.clusterFromBed(bedpath, None, None)
	contactMat = dt.matFromBed(bedpath, cluster)
	distMat = at.contactToDist(contactMat)
	at.makeSymmetric(distMat)
	for j in range(len(distMat)):	#remove diagonal
		distMat[j,j] = 0

	mmds_distMat = dt.clusterFromFile("hic_data/GM12878_combined_{}_10kb_mmds_coords.tsv".format(chrom)).distMat()
	mmds_rs[i] = misc.pearson(distMat, mmds_distMat)
	
	cmds_distMat = dt.clusterFromFile("hic_data/GM12878_combined_{}_10kb_cmds_coords.tsv".format(chrom)).distMat()
	cmds_rs[i] = misc.pearson(distMat, cmds_distMat)

	minimds_distMat = dt.clusterFromFile("hic_data/GM12878_combined_{}_10kb_minimds_coords.tsv".format(chrom)).distMat()
	minimds_rs[i] = misc.pearson(distMat, minimds_distMat)

	mogen_distMat = misc.distsFromCoords("MOGEN/examples/hiC/output/GM12878_combined_{}_10kb_rep1_coords.tsv".format(chrom))
	mogen_rs[i] = misc.pearson(distMat, mogen_distMat)

chrom_sizes = np.loadtxt("chrom_sizes_10kb.txt")

fig = plt.figure()
ax = fig.add_subplot(111, frameon=False)
Example #5
0
	return misc.pearson(dists1, dists2)


#labels = ("Chromosome3D", "mMDS", "miniMDS", "MOGEN", "HSA", "ChromSDE")
labels = ("mMDS", "miniMDS", "MOGEN", "HSA")
n = len(labels)
rs = np.zeros(n)

#Chromosome3D
#coords1 = np.loadtxt("Chromosome3D/output_models/chr22_10kb_rep1/rep1_coords.tsv")
#coords2 = np.loadtxt("Chromosome3D/output_models/chr22_10kb_rep1/rep2_coords.tsv")
#rs[0] = rep_correlation(coords1, coords2)

#mMDS
coords1 = dt.clusterFromFile("hic_data/GM12878_combined_22_10kb_mmds_rep1.tsv").getCoords()
coords2 = dt.clusterFromFile("hic_data/GM12878_combined_22_10kb_mmds_rep2.tsv").getCoords()
#rs[1] = rep_correlation(coords1, coords2)
rs[0] = rep_correlation(coords1, coords2)

#miniMDS
coords1 = dt.clusterFromFile("hic_data/GM12878_combined_22_10kb_minimds_rep1.tsv").getCoords()
coords2 = dt.clusterFromFile("hic_data/GM12878_combined_22_10kb_minimds_rep2.tsv").getCoords()
#rs[2] = rep_correlation(coords1, coords2)
rs[1] = rep_correlation(coords1, coords2)

#MOGEN
coords1 = np.loadtxt("MOGEN/examples/hiC/output/GM12878_combined_22_10kb_rep1_coords.tsv")
coords2 = np.loadtxt("MOGEN/examples/hiC/output/GM12878_combined_22_10kb_rep2_coords.tsv")
#rs[3] = rep_correlation(coords1, coords2)
rs[2] = rep_correlation(coords1, coords2)
Example #6
0
import sys
sys.path.append("..")
import plotting as plot
import data_tools as dt

chroms = [
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
    22, "X"
]
clusters = [
    dt.clusterFromFile(
        "hic_data/GM12878_combined_chr{}_10kb_cluster.tsv".format(chrom))
    for chrom in chroms
]
plot.plot_clusters_interactive(clusters, out_path="Fig10.png")
Example #7
0
import sys
sys.path.append("..")
import data_tools as dt

res_kb = int(sys.argv[1])
with open("chrom_sizes_{}kb.txt".format(res_kb), "w") as out:
    for chrom in [
            1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
            20, 21, 22, "X"
    ]:
        cluster = dt.clusterFromFile(
            "hic_data/GM12878_combined_chr{}_{}kb_cluster.tsv".format(
                chrom, res_kb))
        out.write(str(len(cluster.getPoints())) + "\n")
out.close()