Project: s41467-025-56084-6 | Function: run_forward_mediation_analysis (r)

system: You are an expert R programmer implementing algorithms from scientific papers.
Complete the masked function based on the algorithm description.
Follow R best practices and maintain consistent code style.
Return **only** the complete R function code.

user: Complete this R function:

**DESCRIPTION:** Implements mediation analysis using mixed-effects models to test causal pathways between gut microbiome species, metabolites, and clinical outcomes. Uses lme4 for random effects and mediate package for causal inference.

**KEY TERMS:** {
  "spe": "Microbiome species",
  "m": "Metabolite mediator",
  "ser": "Clinical outcome",
  "ACME": "Average Causal Mediation Effect",
  "ADE": "Average Direct Effect"
}

**CONTEXT CODE:** #load packages
library(mediation)
library(lme4)
library(lmerTest)
library(reshape2)
library(dplyr)
library(tidyr)
library(parallel)

#合并表格(plasma_meta)
species_table <- as.data.frame(t(species_otu_table))
genus_table <- as.data.frame(t(genus_otu_table))
meta.tab <- merge(species_table,genus_table,by='row.names')
meta.tab <- merge(metadata[c(1:8,23:37)],meta.tab,by.x='SampleID',by.y="Row.names",all=T)
meta.tab <- merge(meta.tab,plasma_metabolites_meta[,c(1:2,9:219)],by=c("Subject","Time"),all=T)
meta.tab[,9:ncol(meta.tab)] <- lapply(meta.tab[,9:ncol(meta.tab)],scale)

species <- c(sig_species,sig_genus)
marker <- colnames(metadata)[c(23:27,29:37)]
metabolite <- plasma_metabolite_sig
covar <- c("Age","Gender")

params_list <- expand.grid(species, marker, metabolite)
colnames(params_list) <- c("spe","ser","m")
#Group1
g1.mid.tab <- subset(meta.tab,Treatment=="Group1")

# forward mediation --------------------
g1_Mediation.forward_plasma <- NULL
#创建函数
run_forward_mediation_analysis <- function(spe, ser, m){
  stop("Function implementation has been masked")
}


Complete the function implementation replacing "stop("Not implemented")".