Motivation: Fixed nitrogen is an essential requirement for the biosynthesis of cellular nitrogenous compounds. Some cyanobacteria can fix nitrogen, contributing significantly to the nitrogen cycle, agriculture and biogeochemical history of Earth. The rate and position on the species phylogeny of gains and losses of this ability, as well as of the underlying nif genes, are controversial.
Results: We use probabilistic models of trait evolution to investigate the presence and absence of cyanobacterial nitrogen-fixing ability. We estimate rates of change on the species phylogeny, pinpoint probable changes and reconstruct the state and nif gene complement of the ancestor. Our results are consistent with a nitrogen-fixing cyanobacterial ancestor, repeated loss of nitrogen fixation and vertical descent, with little horizontal transfer of the genes involved.