CNNM2 and cancer: This study aims to comprehensively analyze magnesium homeostasis across 33 cancer types, exploring its role in tumorigenesis, immune regulation, and therapeutic potential. Key magnesium homeostasis-related genes (e.g., ANK3, CNNM2) were significantly downregulated in most tumors, correlating with improved prognosis.