Пример #1
0
    def test_creation_coreoverlap(self):
        cluster = create_cluster(3, 8, 71, 76, 'a')
        extra_cluster = create_cluster(50, 60, 120, 170, 'b')
        # create a CDS within both clusters that has a product from only one cluster
        cds = create_cds(60, 65, ["a"])
        cluster.add_cds(cds)
        extra_cluster.add_cds(cds)

        created = creator([cluster, extra_cluster])
        print(created)
        assert len(created) == 1
        supercluster = created[0]
        assert supercluster.kind == SuperCluster.kinds.INTERLEAVED
        assert supercluster.location == FeatureLocation(3, 170)
Пример #2
0
 def test_creation_neighbours(self):
     cluster = create_cluster(3, 8, 71, 76, 'a')
     extra_cluster = create_cluster(50, 100, 120, 170, 'b')
     created = creator([cluster, extra_cluster])
     print(created)
     assert len(created) == 3
     expected_location = FeatureLocation(cluster.location.start,
                                         extra_cluster.location.end)
     assert created[0].kind == SuperCluster.kinds.NEIGHBOURING and created[
         0].location == expected_location
     assert created[1].kind == SuperCluster.kinds.SINGLE and created[
         1].location == cluster.location
     assert created[2].kind == SuperCluster.kinds.SINGLE and created[
         2].location == extra_cluster.location
Пример #3
0
    def test_creation_hybrid(self):
        cluster = create_cluster(3, 8, 71, 76, 'a')
        hybrid_cluster = create_cluster(50, 60, 120, 170, 'b')

        # insert the cds that will cause the hybrid call
        cds_ab = create_cds(60, 65, ["a", "b"])
        cluster.add_cds(cds_ab)
        hybrid_cluster.add_cds(cds_ab)

        created = creator([cluster, hybrid_cluster])
        print(created)
        assert len(created) == 1
        supercluster = created[0]
        assert supercluster.kind == SuperCluster.kinds.CHEMICAL_HYBRID
        assert supercluster.location == FeatureLocation(3, 170)
Пример #4
0
    def test_creation_mixed(self):
        cluster = create_cluster(3, 8, 71, 76, 'a')
        hybrid_cluster = create_cluster(50, 60, 120, 170, 'b')
        overlap_cluster = create_cluster(80, 90, 130, 180, 'o')
        neighbour_cluster = create_cluster(50, 210, 260, 270, 'a')
        isolated_cluster = create_cluster(450, 500, 550, 600, 'alone')

        # insert the cds that will cause the hybrid call
        cds_ab = create_cds(60, 65, ["a", "b"])
        cluster.add_cds(cds_ab)
        hybrid_cluster.add_cds(cds_ab)

        created = creator([
            cluster, hybrid_cluster, overlap_cluster, neighbour_cluster,
            isolated_cluster
        ])
        print(created)

        assert len(created) == 5
        assert created[0].location == FeatureLocation(3, 270)
        assert created[0].kind == SuperCluster.kinds.NEIGHBOURING
        assert created[0].clusters == (cluster, hybrid_cluster,
                                       overlap_cluster, neighbour_cluster)

        assert created[1].location == FeatureLocation(3, 180)
        assert created[1].kind == SuperCluster.kinds.INTERLEAVED
        assert created[1].clusters == (cluster, hybrid_cluster,
                                       overlap_cluster)

        assert created[2].location == FeatureLocation(3, 170)
        assert created[2].kind == SuperCluster.kinds.CHEMICAL_HYBRID
        assert created[2].clusters == (cluster, hybrid_cluster)

        assert created[3].location == FeatureLocation(50, 270)
        assert created[3].kind == SuperCluster.kinds.SINGLE
        assert created[3].clusters == (neighbour_cluster, )

        assert created[4].location == FeatureLocation(450, 600)
        assert created[4].kind == SuperCluster.kinds.SINGLE
        assert created[4].clusters == (isolated_cluster, )
Пример #5
0
 def test_creation_single(self):
     created = creator([create_cluster(3, 8, 71, 76, 'a')])
     print(created)
     assert len(created) == 1
     assert created[0].location == FeatureLocation(3, 76)
     assert created[0].kind == SuperCluster.kinds.SINGLE
Пример #6
0
 def test_creation_empty(self):
     assert creator([]) == []