## 2 Materials and Methods
### Bioinformatic and Statistical Analysis  
All of the data were analyzed and plotted using the phyloseq [31], tidyverse [32], RColorBrewer [33], patchwork [34], vegan [35], dendextend [36] and ComplexHeatmap [37] packages implemented in R version 4.4.0 [38].  
We analyzed the differences in the abundances of bacterial and fungal taxa at ASV, genus and phylum levels between sewage sludge and earthworm casts and between earthworm casts and vermicompost using DESeq2 package [39], as previously described [2]. We determined taxonomic \(\alpha\)-diversity using several indexes (observed richness and Chao1, inverse Simpson and Faith's phylogenetic diversity [40]). We determined taxonomic \(\beta\)-diversity using distance matrices (Bray-Curtis, Jaccard, weighted and unweighted unifrac [41]) and PCoA analysis. The effect of transit through the gut of earthworm on both \(\alpha\)- (diversity indexes) and \(\beta\)-diversity (PCoA scores) was analyzed using Kruskal-Wallis tests with paired Wilcoxon test as post hoc test. \(p\)-values from DESeq2 and all post hoc tests were corrected for multiple comparisons (Benjamini-Hochberg FDR).  
We used the previously outlined procedure [2] to assess the presence of bacterial and fungal ASVs in sewage sludge, earthworm casts and vermicompost. Briefly, we removed ASVs shared among treatments to define native ASVs of each type of sample. These are ASVs only found in sewage sludge, earthworm casts or vermicompost samples. Shared ASVs among treatments were determined by pairwise comparison of treatments.  
Furthermore, for 16S sequencing data, Phylogenetic Investigation of Communities by Reconstruction of Unobserved States (PictorUSt2 v2.5.2) [42] was used to predict functional orthologs from the KEGG database. Bacterial pathways were assumed to be complete when at least 75% of the KEGG orthologues (KOs) of each pathway were detected in the data. We selected \"biosynthesis of amino acids\", \"furfurral degradation\" and \"bisphenol degradation\" pathways for further analysis. Additionally, we included \"antibiotic synthesis\", \"antibiotic resistance\", \"plant hormone synthesis\", and \"nitrogen metabolism\" pathways, based on KO lists from previous studies [43; 44]. To standardize the data distribution, the KO abundances were z-score transformed. Contributional \(\alpha\) and \(\beta\)-diversity, i.e., the taxa contributing to each KO across samples, was computed with FuncDiv [45] and KEGGREST [46] R packages. The effect of transit through the gut of earthworm on contributionsal \(\alpha\) and \(\beta\)-diversity of bacterial communities of sewage sludge was analyzed using non-parametric Kruskal-Wallis tests. Paired Wilcoxon test was used for post hoc comparisons, with Benjamini-Hochberg FDR as a multiple test correction method.  
As PictorUSt2 does not perform well with ITS sequencing data [42], we used FUN-GuildR, a tool used to assign trait information based on matches with a taxonomic classification in the FUNGuild database. This database is used to compare fungal functions that can link fungal gene sequencing information with the ecological functions of fungi, as well as to identify the nutrient types used by fungi at the genus level and conduct the specific functional classifications [47]. The method categorized 81% of all taxa, and only fungal AVSs with \"probable\" and \"highly probable\" confidence rankings were chosen for further analysis. The effect of transit through the earthworm gut on the abundance of fungal guilds in the ingested sewage sludge was analyzed using non-parametric Kruskal-Wallis tests. Paired Wilcoxon test was used for post hoc comparisons, with Benjamini-Hochberg FDR as a multiple test correction method only in cases where the trophic mode was detected in more than one type of sample.