def set_graph(self):
        self.fragment_length = 5
        self.read_length = 1

        self.graph = GraphWithReversals({i: Block(15)
                                         for i in range(1, 5)}, {
                                             1: [2, 3],
                                             2: [4],
                                             3: [4]
                                         })
        LinearMap.from_graph(self.graph).to_file("test_linear_map.npz")
    def set_graph(self):
        self.fragment_length = 6
        self.read_length = 2
        blocks = {i: Block(3) for i in range(1, 11)}
        blocks[11] = Block(1000)
        self.graph = GraphWithReversals(
            blocks, {
                1: [2, 3],
                2: [7, 8],
                3: [4, 5],
                4: [6],
                5: [6],
                6: [10],
                7: [9],
                8: [9],
                9: [10],
                10: [11]
            })

        LinearMap.from_graph(self.graph).to_file("test_linear_map.npz")
Exemplo n.º 3
0
    def _create_data(self):
        node_offset = 1
        for chrom_number, chromosome in enumerate(self.chromosomes):
            graph = Graph(
                {i + node_offset: Block(10)
                 for i in range(0, 3)},
                {i + node_offset: [i + 1 + node_offset]
                 for i in range(0, 2)})

            linear_map = LinearMap.from_graph(graph)
            linear_map_file_name = "linear_map_%s.npz" % chromosome
            linear_map.to_file(linear_map_file_name)
            self.linear_maps.append(linear_map_file_name)
            self.sequence_retrievers.append(
                SequenceRetriever(
                    {i + node_offset: "A" * 10
                     for i in range(0, 3)}))
            self._create_reads(chrom_number, chromosome, graph)
            node_offset += 3
            graph.convert_to_numpy_backend()
            SequenceGraph.create_empty_from_ob_graph(graph).to_file(
                chromosome + ".nobg.sequences")
            graph.to_file(chromosome + ".nobg")
Exemplo n.º 4
0
def test_from_snp_graph(snp_graph, snp_map):
    linear_map = LinearMap.from_graph(snp_graph)
    assert linear_map == snp_map
Exemplo n.º 5
0
def test_from_graph(hierarchical_graph, hierarchical_map):
    linear_map = LinearMap.from_graph(hierarchical_graph)
    assert linear_map == hierarchical_map
Exemplo n.º 6
0
def snp_map():
    true_starts = [0, 1, 1, 2, 2, 4]
    true_ends = [1, 4, 2, 4, 4, 6]
    return LinearMap(true_starts, true_ends, hierarchical_graph())
Exemplo n.º 7
0
def hierarchical_map():
    true_starts = [0, 10, 10, 22, 22, 36]
    true_ends = [10, 36, 22, 36, 36, 51]
    return LinearMap(true_starts, true_ends, hierarchical_graph())