humann/store.py
def _find_structure(self,items,reaction_names=None):
        """
        Find the structure of the pathway from the string
        """
        
        structure=[config.pathways_database_stucture_delimiter]
        levels={ 0: structure}
        current_level=0
            
        # Process through the list of strings
        for item in items:
            if item:
                # check if the item name indicates an optional reaction
                # if so remove the optional reaction indicator at the beginning of the name                
                if self._is_optional_reaction(item, reaction_names):
                    item=item[1:]
                        
                # Check if this is the start of a list
                if item == "(":
                    new_list=[config.pathways_database_stucture_delimiter]
                    levels[current_level+1]=new_list
                    # add the new list to the structure
                    levels[current_level].append(new_list)
                    # update the current level
                    current_level+=1
                # Check if this is the end of a list
                elif item == ")":
                    # Update the current level to close the list
                    current_level-=1
                # Check if this is a delimiter
                elif item in [config.pathway_AND,config.pathway_OR]:
                    # Update the delimiter at the beginning of the list
                    levels[current_level][0]=item
                else:
                    levels[current_level].append(item)

        return structure

        Find the structure of the pathway from the string
        
Find the structure of the pathway from the string
Find the structure of the pathway from the string
def _find_structure(self,items,reaction_names=None):
        structure=[config.pathways_database_stucture_delimiter]
        levels={ 0: structure}
        current_level=0
        for item in items:
            if item:
                if self._is_optional_reaction(item, reaction_names):
                    item=item[1:]
                if item == "(":
                    new_list=[config.pathways_database_stucture_delimiter]
                    levels[current_level+1]=new_list
                    levels[current_level].append(new_list)
                    current_level+=1
                elif item == ")":
                    current_level-=1
                elif item in [config.pathway_AND,config.pathway_OR]:
                    levels[current_level][0]=item
                else:
                    levels[current_level].append(item)
        return structure
def _find_structure ( self , items , reaction_names = None ) : structure = [ config . pathways_database_stucture_delimiter ] levels = { 0 : structure } current_level = 0 for item in items : if item : if self . _is_optional_reaction ( item , reaction_names ) : item = item [ 1 : ] if item == "(" : new_list = [ config . pathways_database_stucture_delimiter ] levels [ current_level + 1 ] = new_list levels [ current_level ] . append ( new_list ) current_level += 1 elif item == ")" : current_level -= 1 elif item in [ config . pathway_AND , config . pathway_OR ] : levels [ current_level ] [ 0 ] = item else : levels [ current_level ] . append ( item ) return structure
Find the structure of the pathway from the string
Find the structure of the pathway from the string
"""
        Find the structure of the pathway from the string
        """ # Process through the list of strings # check if the item name indicates an optional reaction # if so remove the optional reaction indicator at the beginning of the name                 # Check if this is the start of a list # add the new list to the structure # update the current level # Check if this is the end of a list # Update the current level to close the list # Check if this is a delimiter # Update the delimiter at the beginning of the list
self
items
reaction_names