Пример #1
0
    def postprocess(self):
        '''
        Handle all deferred operations such as binding together and expanding
        repeating units. Removes any distinguishing markers on node ids, and
        constructs a new instance of :attr:`structure_class` from the accumulated
        graph

        Returns
        -------
        Glycan
        '''
        for repeat_index, repeater in self.repeats.items():
            repeater.expand_inner()

        for postop in self.postponed:
            logger.debug("Postprocessing %s", postop)
            postop[0](*postop[1:])

        return undecorate_tree(self.structure_class(rootp(self.root)))
Пример #2
0
 def __root__(self):
     root_node = rootp(self.graph[1])
     if root_node.node_type is Substituent.node_type:
         root_node = root_node.links[1][0].parent if root_node.links[1][0].parent.node_type is Monosaccharide.node_type\
                                                  else root_node.links[1][0].child
     return root_node