Transcriptional activity has been shown to relate to the organization of chromosomes in the eukaryotic nucleus and in the bacterial nucleoid. In particular, highly transcribed genes, RNA polymerases and transcription factors gather into discrete spatial foci called transcription factories. However, the mechanisms underlying the formation of these foci and the resulting topological order of the chromosome remain to be elucidated. Here we consider a thermodynamic framework based on a worm-like chain model of chromosomes where sparse designated sites along the DNA are able to interact whenever they are spatially close by. This is motivated by recurrent evidence that there exist physical interactions between genes that operate together. Three important results come out of this simple framework. First, the resulting formation of transcription foci can be viewed as a micro-phase separation of the interacting sites from the rest of the DNA. In this respect, a thermodynamic analysis suggests transcription factors to be appropriate candidates for mediating the physical interactions between genes. Next, numerical simulations of the polymer reveal a rich variety of phases that are associated with different topological orderings, each providing a way to increase the local concentrations of the interacting sites. Finally, the numerical results show that both one-dimensional clustering and periodic location of the binding sites along the DNA, which have been observed in several organisms, make the spatial co-localization of multiple families of genes particularly efficient.