Exemple #1
0
    def setup_method(self, method):
        # make TAD-like structures for testing
        hic = Hic()

        nodes = []
        for i in range(1, 12000, 1000):
            node = Node(chromosome="chr1", start=i, end=i + 1000 - 1)
            nodes.append(node)
        for i in range(1, 4000, 500):
            node = Node(chromosome="chr2", start=i, end=i + 500 - 1)
            nodes.append(node)
        hic.add_nodes(nodes)

        edges = []
        for i in range(0, 5):
            for j in range(i, 5):
                edges.append(Edge(source=i, sink=j, weight=50))
        for i in range(6, 12):
            for j in range(i, 12):
                edges.append(Edge(source=i, sink=j, weight=75))
        for i in range(13, 18):
            for j in range(i, 18):
                edges.append(Edge(source=i, sink=j, weight=30))
        for i in range(18, 20):
            for j in range(i, 20):
                edges.append(Edge(source=i, sink=j, weight=50))

        hic.add_edges(edges)
        self.hic = hic
Exemple #2
0
        def get_hic(max_random_offset=2.0, amplify=False):
            hic = Hic()

            # add some nodes (120 to be exact)
            nodes = []
            for i in range(1, 5000, 1000):
                nodes.append(Node(chromosome="chr1", start=i,
                                  end=i + 1000 - 1))
            for i in range(1, 3000, 1000):
                nodes.append(Node(chromosome="chr2", start=i,
                                  end=i + 1000 - 1))
            for i in range(1, 2000, 500):
                nodes.append(Node(chromosome="chr3", start=i,
                                  end=i + 1000 - 1))
            hic.add_nodes(nodes)

            # add some edges with increasing weight for testing
            edges = []
            weight = 1.0
            for i in range(0, len(nodes)):
                for j in range(i, len(nodes)):
                    if amplify and i > 7:
                        a = 10.0
                    else:
                        a = 1.0
                    edges.append(
                        Edge(source=i,
                             sink=j,
                             weight=a +
                             weight * max_random_offset * random.random()))
                    weight += 1.0

            hic.add_edges(edges)
            return hic
Exemple #3
0
    def setup_method(self, method):
        hic = Hic()

        # add some nodes (120 to be exact)
        nodes = []
        for i in range(1, 5000, 1000):
            nodes.append(Node(chromosome="chr1", start=i, end=i + 1000 - 1))
        for i in range(1, 3000, 1000):
            nodes.append(Node(chromosome="chr2", start=i, end=i + 1000 - 1))
        for i in range(1, 2000, 500):
            nodes.append(Node(chromosome="chr3", start=i, end=i + 1000 - 1))
        hic.add_nodes(nodes)

        # add some edges with increasing weight for testing
        edges = []
        weight = 1
        for i in range(0, len(nodes)):
            for j in range(i, len(nodes)):
                edges.append(Edge(source=i, sink=j, weight=weight))
                weight += 1

        hic.add_edges(edges)

        self.hic = hic