Evolution and horizontal transfer of the psilocybin biosynthetic gene cluster drive the diversification of magic mushrooms
Psilocybin, the psychoactive compound responsible for the hallucinogenic effects of “magic mushrooms,” is synthesized by a biosynthetic gene cluster (BGC) traditionally associated with Psilocybe species. However, psilocybin production has also been identified in multiple genera across the Strophariaceae, Hymenogastraceae, and Galeropsidaceae families. Here, we sequenced the genomes of 30 putative psilocybin-producing mushroom species from ten genera using PacBio long-read technology. Comparative analysis across 20,608 bacterial, plant, and fungal genomes indicates that the psilocybin BGC most likely originated from endogenous fungal homologs through gene duplication and rearrangement, rather than horizontal gene transfer (HGT) from nonfungal sources. We identified four independent HGT events and three distinct BGC configurations, and propose an evolutionary framework integrating vertical inheritance, HGT, and strong purifying selection. Transcriptomic profiling revealed high expression of PsiK during the mycelial stage, while PsiH and PsiM remained inactive-correlating with the absence of psilocybin in mycelial tissue confirmed by UHPLC-MS/MS, and suggesting stage-specific regulation. Divergence time estimation, coupled with the coprophilous habit of most psilocybin-producing species, supports a post-Cretaceous-Tertiary radiation coinciding with the rise of mammals and novel ecological niches such as grasslands and dung substrates. Pangenomic analysis further reveals that horizontal BGC transfer contributes substantially to genetic innovation, facilitating species diversification and ecological adaptation. These findings highlight the pivotal role of secondary metabolites in fungal evolution and provide a genomic foundation for future research on psilocybin biosynthesis and its therapeutic potential.