Gestational diabetes mellitus (GDM) is one of the most common pregnancy complications threatening both maternal and fetal health1. The prevalence of GDM in China is 14.8%, which is the largest worldwide2. GDM is known as impaired glucose tolerance during pregnancy. In healthy pregnant women, the demand of insulin increases to store glucose for later stages of pregnancy. However, the dysfunction of pancreatic β-cell occurred in GDM pregnant women resulted in insufficient of insulin and causes hyperglycemia3. In literature, there is increasing evidence that certain heavy metals in pregnant women is associated with the risk of GDM. For example, several meta-analyses have reported that increased levels of arsenic (As)4, iron (Fe)5 and cadmium (Cd)6 were associated with the risk of GDM. However, contradictory results have been reported. For instance, two recently published studies evaluated the association between multi-elements and GDM. One of them reported that urinary Ni was positively associated with GDM7 while another reported no significant association between Ni and GDM8. More studies are required for confirming an association between heavy metals and GDM.

Studies involving nail samples (i.e., fingernails, toenails) in human biomonitoring (HBM) have proliferated in recent years due to the ease of collection and their biological properties compared with blood and urine9. The major advantages of nails over blood and urine are that samples represent long-term accumulation; collection is simple, easy and non-invasive; and storage and transport are also simple, easy, and convenient. Due to the slow growth rate of nails, nails record exposure over periods ranging from a few weeks to more than a year10. The correlation between elemental contents in nail samples and diabetes have been evaluated in various studies. Copper (Cu)11 and selenium (Se)12 were inversely associated with the risks of diabetes and obesity. In contrast, exposure to mercury (Hg) and nickel (Ni)13 increased the risk of diabetes. There has been only one study, however, assessing the relationship between elements in nails and GDM. That study evaluated the correlation between As in toenails and the risk of GDM14. Understanding the correlation between nail elements and GDM may promote the use of nails as a simple, non-invasive way of monitoring the risk for GDM in clinical applications.

Machine learning analysis is an emerging trend in the field of HBM. Conventional statistical models describe the features of data based on various assumptions rather than predicting the risk of disease development. In contrast, machine learning aims at developing models through general learning algorithms from data to predict outcomes15. Machine learning has been widely applied for predicting and/or classifying different diseases based on elemental contents in the body. The concentration of six elements in cerebrospinal fluid was used to predict the risk of Parkinson’s disease using Support Vector Machine Model16. In another study, healthy individual and nasopharyngeal carcinoma (NPC) patients were accurately classified according to the elemental contents in their blood serum. This study highlights the potential of early diagnosis of NPC. In terms of GDM prediction by machine learning, several biomarkers in blood have provided acceptable prediction for the risk of GDM17,18,19. The many known risk factors of GDM, such as age, pre-pregnancy BMI and family history of diabetes20, have also been proved to be valuable in the prediction of GDM using machine learning20,21,22. However, these risk factors failed to fully elucidate the etiology of GDM. As mentioned previously, elements were associated with the risk of GDM. Machine learning is a good way to explore and establish the predictive value of elements together with conventional risk factors for the incidence of GDM. Moreover, fingernail samples used in this study reflected elemental contents in pregnant women well before the onset of GDM, demonstrating a great potential for early prediction on the risk of GDM. To the best of our knowledge, this is the first study applying machine learning for GDM prediction based on the elemental contents determined in fingernail samples.

The present nested case–control study aimed to demonstrate the ability of machine learning to predict GDM based on analysis of elements in fingernails. Twenty-seven elements were monitored in fingernails by ICP-MS after acid digestion. The risk of GDM was predicted by ensemble subspace model using the elemental contents in fingernails as well as the clinical information. The performance of optimized prediction model trained by fingernails elemental contents was also evaluated.


Basic characteristics

The basic characteristics of control and GDM pregnant women are listed in Table 1. No significant associations were observed for the characteristics assessed between control and GDM group. One outlier was observed from the GDM patient fingernail elemental contents while four patient urinary elemental contents were found missing. Hence, only 33 and 30 GDM patients were included in the fingernails and urine statistical analyses, respectively.

Table 1 Basic characteristics of control and GDM pregnant women.

Elemental contents in fingernails

The detection rates, median concentrations, and the interquartile ranges (IQR) of elements in fingernails are summarized in Table 2. The detection rates of beryllium (Be), arsenic (As), molybdenum (Mo), cerium (Ce) and mercury (Hg) were below 90%. The concentrations of Be (p value < 0.001), selenium (Se) (p value = 0.003), tin (Sn) (p value = 0.009) and antimony (Sb) (p value = 0.032) in fingernails of GDM patient were significantly higher than those of the control group while the concentration of nickel (Ni) (p value = 0.029) and mercury (Hg) (p value = 0.005) in fingernails of GDM patients showed the opposite trend.

Table 2 Elemental concentrations in fingernails of control and GDM group.

Associations between elemental concentration in fingernails and GDM

The association between the elemental concentrations in fingernails and GDM was calculated by logistic regression model. Table 3 lists the crude odd ratio with the 95% confidence interval of each element. Among the 27 elements, Se (OR: 43.49, 95% CI 3.54–847.67), Sn (OR: 2.32, 95% CI 1.13–5.55) and Be (OR: 1.52, 95% CI 1.23–1.97) were positively association with GDM. Ni (OR: 0.50, 95% CI 0.25–0.92) and Hg (OR: 0.73, 95% CI 0.58–0.89) were negatively associated with GDM. We further analyzed the association between elements and the risk of GDM based on the tertiles of elemental concentrations (Table 4). The risk of GDM increased with the concentrations of Be (OR: 8.64, 95% CI 2.04–45.44 in the highest tertile), Cu (OR: 8.08. 95% CI 1.93–41.78 in the second tertile), Se (OR: 4.67, 95% CI 1.23–19.73 in the highest tertile) and Sn (OR: 6.78, 95% CI 1.68–32.34 in the highest tertile). Significant positive dose–response relationships were observed for Be (adjusted p for trend: 0.090) and Sn (adjusted p for trend: 0.090). The risk of GDM decreased with increased concentrations of Ni (OR: 0.020, 95% CI 0.05–0.77 in the highest tertile) and Hg (OR: 0.21, 95% CI 0.05–0.84 in the second tertile and OR: 0.10, 95% CI 0.02–0.41 in the highest tertile). Significant negative dose–response relationship was observed for Hg (adjusted p for trend: 0.081).

Table 3 Adjusted odd ratio (OR) of elements in fingernails for the risk of GDM.
Table 4 Adjusted odd ratio (OR) for the risk of GDM according to the tertiles of fingernail elemental concentration.

Prediction performance of ensemble model

Machine learning analysis can help predict diseases including GDM. In the present study, we utilized machine learning to evaluate the correlation between multi-element contents and the risk of GDM based on the results from the traditional statistical analysis. According to the logistic regression analysis shown above, Be, Ni, Cu, Se, Sn and Hg were found significantly associated with the risk of GDM. Due to the low detection rate of Be and Hg, they were not included in the machine learning algorithm to minimize the bias generated by the accumulation of larger portion of data points.

The training data set was firstly trained by SVM, KNN, DA, ensemble and NB to select the most accurate algorithm for further analysis. The performances of trained models were compared using the AUC of ROC. The average AUC of the ensemble subspace algorithm resulted in the highest AUC (0.78) with the smallest standard deviation among the tested algorithms. Because this indicate a higher reproducibility, it was used in further analysis (Supplementary Fig. S1).

In the first attempt, a single element was used to train models; the results are shown in Supplementary Table S5. In order to further enhance the accuracy of the trained models, multi-element models were employed to improve the prediction performance. All possible combinations were evaluated by the ensemble model with the best results summarized in Table 5. The highest AUC obtained was 0.81 using Ni, Cu and Se as predictors. When Sn was added to the trained model, the AUC did not change significantly while the accuracy and sensitivity of models decreased significantly to 0.65 and 0.71 respectively. Hence, the combination of Ni, Cu and Se was evaluated together with the basic characteristics of participants to maximize the prediction accuracy. Finally, six different basic characteristics were added on top of the combination of Ni, Cu and Se to evaluate the prediction performance. However, the prediction performance of trained models deteriorated due to the decrease of sensitivity (Supplementary Table S6). Hence, models trained by Ni, Cu and Se without any basic characteristics were further validated by testing data set in the subsequent study.

Table 5 Prediction performance of multi-element model trained by fingernail elemental contents.

Comparison of prediction performance of models constructed from fingernails and urine data

The association of urinary elements with GDM and the prediction performance with urinary elements are detailed in Supplementary Table S3. Among the 10 elements (Li, Mg, Ni, Cu, Zn, As, Se, Sr, Mo, Sn) with detection rates at 90% or above, none showed significant association between control and GDM groups. There was also lack of significant dose–response relationships between the target elements and the risk of GDM (Supplementary Table S8).

The machine learning analysis of urinary elements was carried out like fingernails. As shown in Supplementary Fig. S2, kNN and ensemble models resulted in similar AUCs. The training process of kNN was much faster than that of the ensemble model; hence the kNN model was used for training models with urinary elemental contents. The best prediction combination was given by urinary Cu, Se and Sn concentrations in addition to pre-pregnancy BMI, physical activity pattern and parity (Supplementary Table S11). After selecting the optimized models for fingernails and urine respectively, the testing data set was used to validate the prediction performance of both models. Figure 1 shows that the trained fingernail model (AUC: 0.71) performed better than the urine model (AUC: 0.49) in predicting GDM.

Figure 1
figure 1

ROC curve of best predictions given by nails and urine with ensemble model and KNN model respectively. The prediction performance of trained models were validated by testing data set. The AUC of fingernail and urine prediction models were 0.71 and 0.49, respectively.


This is the first study predicting the risk of GDM based on the elemental content of fingernails using a machine learning algorithm. A similar approach has been used to evaluate the risk of GDM based on the metabolites of urine23. Conventional statistical models have been widely applied to evaluate the association between elements and GDM in many studies14,24,25. However, no studies have applied machine learning for this purpose. In the present study, we first used conventional statistical models, and found significant associations of Be, Ni, Se, Sn, Sb, Cu and Hg with GDM (Table 2 to Table 4). We here present the first report of a significant association between Be concentration and GDM. Nevertheless, statistical models cannot conclusively determine the risk of GDM solely by the association with elements. According to Senat, et al., many other basic characteristics including age, pre-pregnancy BMI, and family history of diabetes are general risk factors for GDM26. Passive smoking24; parity25 has also been reported as a potential risk factor. Machine learning can take into account these many factors. Hence, machine learning analysis was implemented to find the hidden pattern in multi-factorial data collected from pregnant women with and without GDM, and then predict the risk of GDM with trained models.

Numerous machine learning models for the prediction of GDM have been reported27,28; however, there is no consensus as to which one is best. As shown in Supplementary Fig. S1, the prediction performances of 15 machine learning algorithms were compared using the training data set. Ensemble models and SVM models resulted in similar AUC in the trained models, but the ensemble subspace model was more reproducible, suggesting it would be more reliable for the data in the present study. The major advantage of ensemble models over SVM is that ensemble models use multiple single models to form a new model. As a result, the prediction performance of an ensemble algorithm is usually better than a single algorithm29. After selecting the algorithms, different combinations of elements as well as basic characteristics were used to train models to obtain the highest accuracy.

The model was firstly trained by single element content in fingernails. The results of single element models (Supplementary Table S5) show that only the ensemble model trained by Cu level in fingernails provided acceptable prediction performance. Multiple studies have reported that multi-elements exposure is significantly associated with GDM7,8. Hence, we also evaluated the performance of models trained by multiple elements, ranging from two element combinations to four element combinations. Table 5 shows that when the number of elements increased, the prediction performance of the trained model also increased. The trained model was validated by an external testing data set. Figure 1 shows that acceptable accuracy was obtained by the trained model, which suggested that the concentrations of Cu, Ni and Se were important predictors for GDM. In the present study, addition of the basic characteristics of pregnant women did not improve the prediction performance of the machine learning models. It indicated that the models used in the present study worked better for numerical variables but not categorical variables30.

The elements used to train the predictive model were similar to most of the other studies. The correlation between circulating Cu level and GDM was summarized using the data from 14 published studies. It was concluded that high serum Cu was positively associated with the risk of GDM, especially among Asians during the third trimester31. Multiple systematic reviews and meta-analyses have focused on the association between Se and GDM. Those studies were consistent in concluding that Se concentrations were low in women with GDM compared with normal women, while the present study shows an opposite trend. The studies involved in those reviews determined serum Se level in either second or third trimesters32,33,34; while in this study Se levels were measured in the first trimester. Studies reporting the correlation of blood or urinary Ni with GDM are limited, and the conclusions are inconsistent. The present study found significant negative association between fingernail Ni level and GDM while the above mentioned studies reported no significant association8 and positive association7, respectively. Our results show that the correlation between fingernail elements and GDM is different from that of blood and urine.

Although the trained model in the present study did not include basic characteristic as predictors, our models highlighted fingernail Cu, Ni and Se concentrations as potential predictors for GDM. To the best of our knowledge, this is the first study demonstrating the prediction of GDM by elemental contents using machine learning. Our model outperformed the models trained by serum triglyceride and fasting plasma glucose level (AUC: 0.68)17. Our trained model also performed comparably to another model trained by cytosine-phosphate-guanine levels in blood (AUC: 0.82)19. Although excellent prediction models constructed by putrescine and microRNA with AUC 0.95 and 0.91, respectively, have been reported, studies using those models did not include external validation by a testing data set18,27. Our prediction model was validated by a testing data set and resulted in AUC 0.71, which indicated acceptable performance.

Another major highlight of the present study is that fingernail samples were collected in the first trimester. To date, many studies involving nail samples utilized nail clippings collected either during a later stage of pregnancy or postpartum35. Information obtained from nail samples represents exposure from a few weeks to a few months before collection36. As a result, the association observed using those samples is closely related to the middle to later stage of pregnancy. In contrast, the fingernail samples used in this study represent exposure during the first few weeks of gestation, if not before, which is much earlier than the identification of GDM. But this is what prediction means: Anticipating a problem before it develops. The model used in this pilot study highlights the ability of fingernail Cu, Ni and Se levels to predict GDM because it was predicting the risk of GDM before the development of GDM.

In the present work, we collected both urine and fingernail samples from the same individual and predicted the risk of GDM with their elemental contents through machine learning analysis. One of the major advantages of using fingernails rather than urine is that the elemental detection rate in fingernails is higher than that in urine. The elemental analysis revealed more than 90% of 24 elements in fingernail samples, while the same analysis could detect only 9 elements in urine samples. For fingernails, it should be pointed out that although the detection rates of Be and Hg were relatively low, our model found that they had a significant association with the risk of GDM. In terms of the prediction performance of the trained model, prediction by fingernail elemental contents provided acceptable predictive accuracy for the testing data set while the prediction by urinary elemental contents was similar to random guessing, as the AUC was 0.49 for the external validation result of a urine prediction model (Fig. 1)37. It was mainly due to the low elemental detection rate and no significant difference in elemental concentrations between control and GDM patients for urine sample (Supplementary Table S3). Although it is expected that the use of urine sample will remain dominant in HBM studies, this pilot study highlights that fingernails are a potential alternative sample for predicting the risk of GDM.

However, there are several important limitations that should be considered in interpreting the results of the present study. Firstly, the sample size was relatively small. A larger sample (more than 1000 pregnant women in total) will be utilized in the future study to compare the prediction performance of models with other studies38. Secondly, the reason why the results of this study with regard to the correlation between some of the elements with GDM were not consistent with past studies is not known. For example, As content in urine or blood is well-known for its correlation with GDM but no significant association was observed in the present study39,40. To date, there is only one study reported As content in toenails in association with GDM, and it found that As content in toenails collected 2 weeks postpartum was significantly associated with GDM14. Our study utilized fingernails, collected in the first trimester. The influence of type of nails and the specific stage of pregnancy needs to be thoroughly examined in future studies, and other reasons for these inconsistencies need to be explored. Thirdly, the urinary elemental detection rates in the present study were low, which affected the results of machine learning.


To the best of our knowledge, this is the first study demonstrating the application of machine learning analysis to the prediction of GDM using the elemental contents in fingernails. Our study provides additional evidence for the positive association between elemental contents in fingernails and GDM. The results indicate that Ni, Cu and Se concentrations, in particular, in fingernails are important factors for the prediction of GDM by ensemble subspace models. In contrast with fingernails, the elemental contents in urine failed to predict the risk of GDM due to the low detection rate for most of the elements. The present study highlights the potential of GDM prediction in early pregnancy using the elemental contents in fingernails. Further large scale studies are required to verify the correlation of elemental contents in fingernails and GDM. It should be pointed out that long-term exposure information provided by fingernails may also help in elucidating the mechanistic relationship between elements and GDM development.


Study population

This pilot, nested case–control study was based on the Shanghai Maternal-Child Pairs cohort study conducted at the School of Public Health, Fudan University, Shanghai. A cohort of Shanghai pregnant women were recruited from September 2016 to December 2017. Eligible women were those who: (1) were over 20 years old; (2) were free of serious chronic disorders (e.g., diabetes, high blood pressure, heart disease, etc.); (3) did not smoke or drink alcohol. Of these, 34 with GDM were recruited for the evaluation of the association between elemental exposure and the risk of GDM. Diagnosis of GDM was performed by oral glucose tolerance test (OGTT) during gestational weeks 24–28. 34 pregnant women without GDM were selected as control group by propensity score matching. The control group was matched with the experimental group in terms of age, living district, pre-pregnancy BMI, family yearly income, education level, infant sex, parity, passive smoking, and physical activity pattern.

Ethic statement

All methods were carried out in accordance with relevant guidelines and regulations. The study was approved by the Institutional Review Boards (IRB) of the School of Public Health, Fudan University (IRB#2016-04-0587). Informed consent was obtained for each participant at the time of enrollment.

Data collection

A face-to-face interview was conducted by a trained nurse with each participant using a standard questionnaire to collect information on age, pre-pregnancy BMI, education level, family yearly income, passive smoking, physical activity pattern, parity and family history of diabetes. Information on the oral glucose tolerance test (OGTT) of pregnant women, and infant sex were retrieved from medical records.

GDM diagnosis

The diagnosis of GDM was based on the guideline published by the Ministry of Health (MOH) of China41. A 75 g OGTT was performed on pregnant women during gestational weeks 24–28. Pregnant women were identified as having GDM if any one of the following criteria was met: fasting plasma glucose ≥ 5.1 mmol/L, 1 h plasma glucose ≥ 10.0 mmol/L or 2 h plasma glucose ≥ 5.1 mmol/L.

Sample collection

Fingernail samples (width larger than 0.2 mm) were provided by pregnant women during 12–16 weeks of gestation. They were asked to collect nails from all fingers with a stainless-steel nail clipper. Fingernail samples were stored in a zip-locked plastic bag at room temperature and transported to Hong Kong Baptist University (HKBU) for elemental analysis. For each individual, the mass of fingernail samples used for ICP-MS analysis ranged from 5 to 10 mg.

Urine samples (10 mL) were collected at around 16 weeks of gestation. Samples were stored in polypropylene centrifuge tubes at -80 °C until analysis.

Elemental analysis

The concentration of 27 elements in fingernails was determined by inductively coupled plasma-mass spectrometry (ICP-MS) at HKBU while the concentration of the same 27 elements in urine was determined by ICP-MS in Shanghai. Fingernail samples were washed using the method recommended by the International Atomic Energy Agency (IAEA)42. The subsequent acid-digestion was performed using a modified method reported in our previous study43. In brief, fingernail samples were transferred to 15 mL polypropylene tubes and then rinsed by acetone followed by ultrapure water three times. The washed samples were oven-dried at 60 °C overnight. Samples were then mineralized with 3 mL of concentrated nitric acid and 1 mL of 30% hydrogen peroxide in a microwave digestion system. The digested solution was transferred to an acid-washed beaker and evaporated on a hotplate until nearly dry. 5 µL of 1 µg/mL germanium standard solution was added as an internal standard and ultrapure water was used to make up the sample solution to 5 mL. The solution was then analyzed by ICP-MS. Multi-element standard solutions (Li, Be, Mg, V, Cr, Mn, Ni, As, Se, Mo, Cd, Sn, Sb, La, Ce, Hg, U: 0.2–10 ng/mL; Co, Tl, Bi: 0.04–2 ng/mL; Sr, Pb: 0.8–40 ng/mL; Cu, Ba: 2–100 ng/mL; Fe: 4–200 ng/mL; Al-Zn: 8–400 ng/mL) were prepared by appropriate dilution of 1000 µg/mL of stock standard solution for the quantification of elements by external calibration. Since certified reference material (CRM) for nails was not available, hair CRM was employed for method validation. 5 mg of hair CRM or fingernail sample was digested and analyzed by ICP-MS. The standard solution used in the calibration was analyzed every 20 samples to ensure no significant instrumental drift occurred during the analysis.

Urine samples were thawed at room temperature and vortexed (IKA, Germany) for 5 s. Then each sample was centrifuged (Microfuge 16, Beckman Coulter, USA) at 4000 rpm for 1 min to remove debris. 1 mL of supernatant was diluted with 1% (v/v) concentrated nitric acid (HNO3) to 10 mL and vortexed for 30 s to ensure complete mixing. Other relevant details can be found in the Supplementary Materials.

Statistical analysis

Limit of Detections (LODs) were calculated by multiplying the standard deviation of 7 consecutive measurements of blank standard solution by three, and then dividing that number by the slope of the calibration curve. Calculated concentrations below LOD were assigned the value as LOD/2 for further analysis. Elements with detection rates higher than 90% were included in the machine learning algorithm. The basic characteristics of the participants are summarized in Table 1. The education level, income, passive smoking, physical activity pattern, family history of diabetes and parity were compared by Pearson chi-square test. Mann–Whitney U test was used to examine the age and pre-pregnancy BMI. The association between elements and the risk of GDM were evaluated by Mann–Whitney U test and logistic regression analysis. Odd ratio (OR) and 95% confidence intervals (CIs) were calculated with elemental concentration as continuous variables and categorical variables according to the tertile distribution (The first tertile was used as the reference group) for the risk of GDM. The regression model was adjusted for age, pre-pregnancy BMI, education level, income, passive smoking, physical activity pattern, family history of diabetes, and parity. The Pearson correlation between fingernail and urinary elemental concentration was determined by MATLAB R2021b software. Unless otherwise specified, a two-tailed p value < 0.05 was defined as statistically significant. False discovery rate (FDR) was employed for multiple testing with significant level defined at p value < 0.1.

Machine learning analysis was performed by MATLAB R2021b software. Maternal age and pre-pregnancy BMI were input as continuous variables while passive smoking, physical activity pattern, parity and family history of diabetes were input as categorical variables. The prediction accuracy of multiple models, including ensemble models, discriminant analysis (DA), support vector machine (SVM), k-nearest neighbor (kNN) and Naive Bayes (NB), were evaluated. The data was split into a training data set consisting of 51 individuals (75% of total individual) and a testing data set consisting of 16 individuals (25% of total individual, control to patient ratio = 1:1). Ensemble modeling using a random subspace algorithm resulted in the highest area under curve (AUC) in the receiver operating characteristic (ROC) curve for the trained model; these models were used in all analysis in this pilot study. The trained ensemble models were optimized by the training data set with tenfold cross validation repeated five times. The performance of optimized models was evaluated by the test data set. Based on the result of the logistic regression analysis mentioned above, nickel (Ni), copper (Cu), selenium (Se), and tin (Sn) concentrations in fingernails were input as predictors in the ensemble model. Age, pre-pregnancy BMI, passive smoking, physical activity pattern, parity and family history of diabetes were incorporated in machine learning analysis to further optimize the prediction models. Permutation test was employed as the negative control. The p value of the permutation test was determined as the fraction obtained by the 100 permutations which were higher than the real accuracy44. Balanced accuracy, F-value, Matthews correlation coefficient were also calculated with MATLAB.