Exploring the mechanisms of maintaining microbial community structure is important to understand biofilm development or microbiota dysbiosis. In this paper, we propose a functional gene-based composition prediction (FCP) model to predict the population structure composition within a microbial community. The model predicts the community composition well in both a low-complexity community as acid mine drainage (AMD) microbiota, and a complex community as human gut microbiota. Furthermore, we define community structure shaping (CSS) genes as functional genes crucial for shaping the microbial community. We have identified CSS genes in AMD and human gut microbiota samples with FCP model and find that CSS genes change with the conditions. Compare...