Exemple #1
0
    def test_update_matrix_pmods(self):
        """Test updating the matrix with multiple protein modifications."""
        sub = protein(namespace='HGNC', name='A', identifier='1')
        obj = protein(namespace='HGNC', name='B', identifier='2', variants=[pmod('Ub'), pmod('Ph')])

        index = {'A', 'B'}

        test_dict = {}

        test_matrix = DataFrame(0, index=index, columns=index)

        test_dict["activation_ubiquination"] = test_matrix
        test_dict["activation_phosphorylation"] = test_matrix

        update_spia_matrices(test_dict, sub, obj, {'relation': 'increases'})

        self.assertEqual(test_dict["activation_ubiquination"]['A']['B'], 1)
        self.assertEqual(test_dict["activation_ubiquination"]['A']['A'], 0)
        self.assertEqual(test_dict["activation_ubiquination"]['B']['A'], 0)
        self.assertEqual(test_dict["activation_ubiquination"]['B']['B'], 0)

        self.assertEqual(test_dict["activation_phosphorylation"]['A']['B'], 1)
        self.assertEqual(test_dict["activation_phosphorylation"]['A']['A'], 0)
        self.assertEqual(test_dict["activation_phosphorylation"]['B']['A'], 0)
        self.assertEqual(test_dict["activation_phosphorylation"]['B']['B'], 0)
Exemple #2
0
    def test_update_matrix_inhibition_ubiquination(self):
        """Test updating the matrix with an inhibition ubiquitination."""
        sub = protein(namespace='HGNC', name='A', identifier='1')
        obj = protein(namespace='HGNC',
                      name='B',
                      identifier='2',
                      variants=[pmod('Ub')])

        index = {'A', 'B'}

        test_dict = {}

        test_matrix = DataFrame(0, index=index, columns=index)

        # Initialize matrix correctly
        self.assertEqual(test_matrix.values.all(), 0)

        test_dict["inhibition_ubiquination"] = test_matrix

        update_spia_matrices(test_dict, sub, obj, {'relation': 'decreases'})

        self.assertEqual(test_dict["inhibition_ubiquination"]['A']['B'], 1)
        self.assertEqual(test_dict["inhibition_ubiquination"]['A']['A'], 0)
        self.assertEqual(test_dict["inhibition_ubiquination"]['B']['A'], 0)
        self.assertEqual(test_dict["inhibition_ubiquination"]['B']['B'], 0)
Exemple #3
0
    def test_update_matrix_inhibition_phosphorylation(self):
        """Test updating the matrix with an inhibition phosphorylation."""
        sub = protein(namespace='HGNC', name='A', identifier='1')
        obj = protein(namespace='HGNC', name='B', identifier='2', variants=[pmod('Ph')])

        index = {'A', 'B'}

        test_dict = {}

        test_matrix = DataFrame(0, index=index, columns=index)

        test_dict["inhibition_phosphorylation"] = test_matrix

        update_spia_matrices(test_dict, sub, obj, {'relation': 'decreases'})

        self.assertEqual(test_dict["inhibition_phosphorylation"]['A']['B'], 1)
        self.assertEqual(test_dict["inhibition_phosphorylation"]['A']['A'], 0)
        self.assertEqual(test_dict["inhibition_phosphorylation"]['B']['A'], 0)
        self.assertEqual(test_dict["inhibition_phosphorylation"]['B']['B'], 0)
Exemple #4
0
    def test_update_matrix_association(self):
        """Test updating the matrix with association."""
        sub = protein(namespace='HGNC', name='A', identifier='1')
        obj = protein(namespace='HGNC', name='B', identifier='2')

        index = {'A', 'B'}

        test_dict = {}

        test_matrix = DataFrame(0, index=index, columns=index)

        test_dict["binding_association"] = test_matrix

        update_spia_matrices(test_dict, sub, obj, {'relation': 'association'})

        self.assertEqual(test_dict["binding_association"]['A']['B'], 1)
        self.assertEqual(test_dict["binding_association"]['A']['A'], 0)
        self.assertEqual(test_dict["binding_association"]['B']['A'], 0)
        self.assertEqual(test_dict["binding_association"]['B']['B'], 0)