def plotLevels(mat): smoothingFactors = [1, 2, 3, 8, 33] #these smoothing factors were selected to demonstrate to best demonstrate TAD levels domainsToInclude = [range(1, 15), [2,3,4,5], [7], [1,6], [3]] #selected domains from these smoothing factors to maximize prettiness all_tads = [] for i in range(len(smoothingFactors)): smoothingFactor = smoothingFactors[i] indices = domainsToInclude[i] tads = tad.getDomains(mat, smoothingFactor, 0) for index in indices: all_tads.append(tads[index]) hm.heatMapFromMat(mat, 100, all_tads, "Fig2") #all levels combined
def plotMovingAverage(mat): smoothingFactor = 5 outpath = "Fig1B" tads = tad.getDomains(mat, smoothingFactor, 0) hm.heatMapFromMat(mat, 100, tads, outpath)
def plotDixon(mat): tads = [[0, 8], [8, 38], [38, 52], [52, 78], [78, 97], [97, 115], [115, 127]] outpath = "Fig1A" hm.heatMapFromMat(mat, 100, tads, outpath)
import sys from multimds import data_tools as dt import heatmap as hm import numpy as np num = sys.argv[1] path = "sim{}_chr21_100kb.bed".format(num) size = dt.size_from_bed(path) struct = dt.structureFromBed(path, size) mat = dt.matFromBed(path, size, struct) tad_boundaries = np.loadtxt("subseqs{}.tsv".format(num)) tads = [] for i in range(1, len(tad_boundaries)): bound1 = tad_boundaries[i-1] bound2 = tad_boundaries[i] if bound1 == 0: start = 0 else: start = struct.get_rel_index(bound1) end = struct.get_rel_index(bound2) tads.append((start,end)) #hm.heatMapFromMat(mat, maxvalue=50, tads=tad_indices, outpath="sup6_{}".format(num)) hm.heatMapFromMat(mat, maxvalue=5, tads=tads, outpath="sup6_{}.svg".format(num))
import sys from multimds import data_tools as dt import heatmap as hm num = sys.argv[1] path = "sim{}_chr21_100kb.bed".format(num) size = dt.size_from_bed(path) struct = dt.structureFromBed(path, size) mat = dt.matFromBed(path, size, struct) tads = np.loadtxt("sim{}_tads.tsv".format(num)) tad_indices = [(struct.get_rel_index(start), struct.get_rel_index(end)) for start, end in tads] hm.heatMapFromMat(mat, maxvalue=50, tads=tad_indices)