Ejemplo n.º 1
0
 def test_chain_len_groups(self):
     chain_len_map = {'A': 1, 'C': 3, 'B': 2, 'E': 3, 'D': 2}
     expected = {1: ['A'], 2: ['B', 'D'], 3: ['C', 'E']}
     self.assertDictEqual(
         expected,
         ChainMappingRMSDMatrixCalculator.getChainLenGroups(chain_len_map))
     self.assertItemsEqual(
         [['A'], ['B', 'D'], ['C', 'E']],
         ChainMappingRMSDMatrixCalculator.getPermGroups(
             ChainMappingRMSDMatrixCalculator.getChainLenGroups(
                 chain_len_map)))
Ejemplo n.º 2
0
 def test_reorderAllCoordinatesByChainLen(self):
     input = StringIO.StringIO(chain_padding_proto_3)
     structure = prody.parsePDBStream(input)
     group_lens = {1: ['A'], 2: ['B', 'D'], 3: ['C', 'E']}
     result =  ChainMappingRMSDMatrixCalculator.getReorderedCoordinatesByLenGroups(structure, "all", group_lens)
     expected =[[[1.0, 2.0, 3.0],
                 [4.0, 5.0, 6.0],
                 [7.0, 8.0, 9.0],
                 [19.0, 20.0, 21.0],
                 [22.0, 23.0, 24.0],
                 [10.0, 11.0, 12.0],
                 [13.0, 14.0, 15.0],
                 [16.0, 17.0, 18.0],
                 [25.0, 26.0, 27.0],
                 [28.0, 29.0, 30.0],
                 [31.0, 32.0, 33.0]],
                [[41.0, 42.0, 43.0],
                 [44.0, 45.0, 46.0],
                 [47.0, 48.0, 49.0],
                 [59.0, 60.0, 61.0],
                 [62.0, 63.0, 64.0],
                 [50.0, 51.0, 52.0],
                 [53.0, 54.0, 55.0],
                 [56.0, 57.0, 58.0],
                 [65.0, 66.0, 67.0],
                 [68.0, 69.0, 70.0],
                 [71.0, 72.0, 73.0]]]
     numpy.testing.assert_array_equal(expected, result)
Ejemplo n.º 3
0
    def test_getStructureChains(self):
        expected = [{
            'A': numpy.array([[1., 2., 3.]]),
            'X': numpy.array([[-33.115, 1.294, -1.163]])
        }, {
            'A': numpy.array([[4., 5., 6.]]),
            'X': numpy.array([[-32.555, -2.5, -5.367]])
        }, {
            'A': numpy.array([[7., 8., 9.]]),
            'X': numpy.array([[-33.257, 5.28, -8.441]])
        }, {
            'A': numpy.array([[10., 11., 12.]]),
            'X': numpy.array([[32.306, 6.517, -1.544]])
        }, {
            'A': numpy.array([[13., 14., 15.]]),
            'X': numpy.array([[30.494, 10.39, -3.066]])
        }]

        input = StringIO.StringIO(pdb_data)
        pdb_structure = prody.parsePDBStream(input)
        result = ChainMappingRMSDMatrixCalculator.getStructureChains(
            pdb_structure, "all")
        for i in range(len(expected)):
            numpy.testing.assert_array_equal(expected[i]['A'], result[i]['A'])
            numpy.testing.assert_array_equal(expected[i]['X'], result[i]['X'])
Ejemplo n.º 4
0
 def test_getChainLengths(self):
     input = StringIO.StringIO(chain_padding_proto_3)
     structure = prody.parsePDBStream(input)
     self.assertDictEqual({
         'A': 1,
         'C': 3,
         'B': 2,
         'E': 3,
         'D': 2
     }, ChainMappingRMSDMatrixCalculator.getChainLengths(structure, "all"))
Ejemplo n.º 5
0
 def test_reorderCoordinates(self):
     chain = {
         'A': numpy.array([[1., 2., 3.]]),
         'X': numpy.array([[-33.115, 1.294, -1.163]])
     }
     chain_map = {"A": "X", "X": "A"}
     numpy.testing.assert_array_equal(
         [[-33.115, 1.294, -1.163], [1., 2., 3.]],
         ChainMappingRMSDMatrixCalculator.reorderCoordinates(
             chain, ["X", "A"]))
Ejemplo n.º 6
0
    def test_getStructureChains(self):
        expected = [{'A': numpy.array([[ 1.,  2.,  3.]]), 'X': numpy.array([[-33.115,   1.294,  -1.163]])},
                    {'A': numpy.array([[ 4.,  5.,  6.]]), 'X': numpy.array([[-32.555,  -2.5  ,  -5.367]])},
                    {'A': numpy.array([[ 7.,  8.,  9.]]), 'X': numpy.array([[-33.257,   5.28 ,  -8.441]])},
                    {'A': numpy.array([[ 10.,  11.,  12.]]), 'X': numpy.array([[ 32.306,   6.517,  -1.544]])},
                    {'A': numpy.array([[ 13.,  14.,  15.]]), 'X': numpy.array([[ 30.494,  10.39 ,  -3.066]])}]

        input = StringIO.StringIO(pdb_data)
        pdb_structure = prody.parsePDBStream(input)
        result =  ChainMappingRMSDMatrixCalculator.getStructureChains(pdb_structure,"all")
        for i in range(len(expected)):
            numpy.testing.assert_array_equal(expected[i]['A'], result[i]['A'])
            numpy.testing.assert_array_equal(expected[i]['X'], result[i]['X'])
Ejemplo n.º 7
0
 def test_reorderAllCoordinatesByChainLen(self):
     input = StringIO.StringIO(chain_padding_proto_3)
     structure = prody.parsePDBStream(input)
     group_lens = {1: ['A'], 2: ['B', 'D'], 3: ['C', 'E']}
     result = ChainMappingRMSDMatrixCalculator.getReorderedCoordinatesByLenGroups(
         structure, "all", group_lens)
     expected = [[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0],
                  [19.0, 20.0, 21.0], [22.0, 23.0,
                                       24.0], [10.0, 11.0, 12.0],
                  [13.0, 14.0, 15.0], [16.0, 17.0,
                                       18.0], [25.0, 26.0, 27.0],
                  [28.0, 29.0, 30.0], [31.0, 32.0, 33.0]],
                 [[41.0, 42.0, 43.0], [44.0, 45.0,
                                       46.0], [47.0, 48.0, 49.0],
                  [59.0, 60.0, 61.0], [62.0, 63.0,
                                       64.0], [50.0, 51.0, 52.0],
                  [53.0, 54.0, 55.0], [56.0, 57.0,
                                       58.0], [65.0, 66.0, 67.0],
                  [68.0, 69.0, 70.0], [71.0, 72.0, 73.0]]]
     numpy.testing.assert_array_equal(expected, result)
Ejemplo n.º 8
0
 def test_chain_len_groups(self):
     chain_len_map = {'A': 1, 'C': 3, 'B': 2, 'E': 3, 'D': 2}
     expected = {1: ['A'], 2: ['B', 'D'], 3: ['C', 'E']}
     self.assertDictEqual(expected, ChainMappingRMSDMatrixCalculator.getChainLenGroups(chain_len_map))
     self.assertItemsEqual([['A'], ['B', 'D'], ['C', 'E']], ChainMappingRMSDMatrixCalculator.getPermGroups(ChainMappingRMSDMatrixCalculator.getChainLenGroups(chain_len_map)))
Ejemplo n.º 9
0
 def test_getChainLengths(self):
     input = StringIO.StringIO(chain_padding_proto_3)
     structure = prody.parsePDBStream(input)
     self.assertDictEqual({'A': 1, 'C': 3, 'B': 2, 'E': 3, 'D': 2},
                           ChainMappingRMSDMatrixCalculator.getChainLengths(structure, "all"))
Ejemplo n.º 10
0
 def test_reorderCoordinates(self):
     chain = {'A': numpy.array([[ 1.,  2.,  3.]]), 'X': numpy.array([[-33.115,   1.294,  -1.163]])}
     chain_map = {"A":"X", "X":"A"}
     numpy.testing.assert_array_equal( [[-33.115,   1.294,  -1.163], [  1., 2., 3.]],
                                       ChainMappingRMSDMatrixCalculator.reorderCoordinates(chain, ["X","A"]))