Conformational transitions governing function and aggregation of enzymes