Protein folding and aggregation in bacteria