A two-dimensional shallow water hydro-sediment-morphodynamic model is applied to investigate alternate bar formation, development and sediment sorting in straight channels. The model is coupled, explicitly incorporating the flow–sediment–bed interactions by using the full mass and momentum conservation equations, which are numerically solved by a well-balanced version of the finite volume Slope Limiter Centred (SLIC) scheme. The model is first tested against a flume experiment on alternate bars formed over a uniform sediment bed, which clearly exhibits processes of bar formation, migrating and finally approaching an equilibrium state. Then it is applied to another flume experiment on alternate bars due to non-uniform sediment transport. The computational results are evaluated, with a focus on the longitudinal and vertical sediment sorting. It is argued for the first time that the inconsistent sediment sorting patterns observed in previous studies are determined by different sediment transport conditions, i.e. full versus partial transport. When a condition of full transport is achieved, under which all size fractions are fully mobilized and transported, the longitudinal surface sediment shows a sorting pattern of coarse-on-head and fine-in-pool, and the vertical substrate sediment exhibits an immobile-fine-coarse structure upwards. In contrast, for a partial transport condition, under which only finer fraction participates in the transport process, an opposite longitudinal pattern (i.e. fine-on-head and coarse-in-pool) and a different vertical structure (i.e. immobile-coarse-fine) are observed. Concurrently, numerical experiments with specified conditions show that the critical aspect ratio for the formation of migrating alternate bars is approximately equal to 12. With the increase of the aspect ratio, the bar length grows gradually, while the bar height increases rapidly for moderate values of the aspect ratio and then keeps nearly stable. The bar celerity, however, is weakly sensitive to the variation of this ratio.