예제 #1
0
            frag_data.add_view(LanguageDependentValue(id2t("FRAGMENT_COMPOUND_TYPE"), {"en":hit.substructure.compound_type}))
            frag_data_atoms = Complex(id2t("ATOMS"))
            frag_data.add_view(frag_data_atoms)
            for atom in hit.get_significant_atoms():
                frag_data_atoms.add_part(Relation(id2t('REL_COMPOSED_FROM'), _atom_to_a_data[atom]))
            mol_data_frags.add_part(Relation(id2t('REL_COMPOSED_FROM'), frag_data))
        # add relations between rings
        for i,ring1 in enumerate(rings):
            for ring2 in rings[i+1:]:
                common_atoms = set(ring1.get_significant_atoms()) & set(ring2.get_significant_atoms())
                if common_atoms:
                    d1 = _hit_to_data[ring1]
                    d2 = _hit_to_data[ring2]
                    count = len(common_atoms)
                    data_type = DataType("SHARED_ATOMS",
                                         _("%d shared atoms")%count,
                                         _("The ring shares %d atoms with the neighbor ring"%count))
                    d1.add_neighbor(Relation(data_type, d2))
                    d2.add_neighbor(Relation(data_type, d1))
        # // fragment support
        # svg picture support
        for (atom,data) in _atom_to_a_data.iteritems():
            atom.properties_['svg_id'] = str(data.id())
        svg_xml = self._generate_svg(mol)
        mol_data.add_view(Value(id2t("MOL_PICTURE"), svg_xml))
        # // svg picture support
        return mol_data

    @classmethod
    def process_reaction(self, react):
        def add_reaction_components_to_reaction(data_type, comps):
예제 #2
0
 def test_none_type(self):
   self.assertEqual('no value', DataType.data_type(None))
예제 #3
0
 def test_array_type(self):
   self.assertEqual(3, DataType.data_type([1, 2, 3]))
예제 #4
0
 def test_str_type(self):
   self.assertEqual(6, DataType.data_type('andela'))
예제 #5
0
 def test_large_integer_type(self):
   self.assertEqual('more than 100', DataType.data_type(200))
예제 #6
0
 def test_small_integer_type(self):
   self.assertEqual('less than 100', DataType.data_type(3))
예제 #7
0
 def test_small_booleans_type(self):
   self.assertEqual(True, DataType.data_type(True))
예제 #8
0
 def test_small_array_type(self):
   self.assertEqual(None, DataType.data_type([1, 2]))