def run(self):
        """Run check for duplicates"""

        # Create dictonary of signatures
        database_signatures = {}
        for entry in self._model.reactions:
            signature = reaction_signature(
                entry.equation, direction=self._args.compare_direction,
                stoichiometry=self._args.compare_stoichiometry)
            database_signatures.setdefault(signature, set()).add(
                (entry.id, entry.equation, entry.filemark))

        for reaction_set in itervalues(database_signatures):
            if len(reaction_set) > 1:
                print('Found {} duplicate reactions:'.format(
                    len(reaction_set)))
                for reaction, equation, filemark in reaction_set:
                    result = ' - {}: {}'.format(reaction, equation)
                    if filemark is not None:
                        result += ' (found in {})'.format(filemark)
                    print(result)
def run ( self ) : database_signatures = { } for entry in self . _model . reactions : signature = reaction_signature ( entry . equation , direction = self . _args . compare_direction , stoichiometry = self . _args . compare_stoichiometry ) database_signatures . setdefault ( signature , set ( ) ) . add ( ( entry . id , entry . equation , entry . filemark ) ) for reaction_set in itervalues ( database_signatures ) : if len ( reaction_set ) > 1 : print ( 'Found {} duplicate reactions:' . format ( len ( reaction_set ) ) ) for reaction , equation , filemark in reaction_set : result = ' - {}: {}' . format ( reaction , equation ) if filemark is not None : result += ' (found in {})' . format ( filemark ) print ( result )
Run check for duplicates