The solubility and compactness of proteins is investigated within the
framework of models amenable to an exact numerical study through
exhaustive enumeration. We study how the average inter-amino acid
interaction potential affects the properties of both isolated and
interacting proteins. In a concentrated solution, depending on the value
of the average potential, individual proteins may remain stable in the
isolated native structure (soluble case), may aggregate preserving their
geometrical shape (nonsoluble case) or aggregate changing their
geometrical shape (prionlike behavior). The number of sequences that
have compact native states and are soluble is maximal at a fine-tuned
average interaction potential and of the same order of the corresponding
number of nonsoluble prionlike proteins. The viable protein sequences
selected by such a fine-tuned potential are found to have an amino acid
composition similar to naturally occurring proteins.