Participants

Participants were unrelated individuals from the UK Biobank [63] (Year of birth: 1936–1970) of European ancestries [64] as identified using multidimensional scaling and self-report (UK Biobank data field 22006). We restricted our analyses to this group of participants as the GWAS for autism has been conducted in individuals of European ancestries and may not be accurate in individuals of other ancesitries [65]. We excluded participants whose genetic sex did not match their reported sex (sex is used as a covariate in the analyses and we may not be able to covary this correctly in the analysis without this restriction), who were outliers for genetic heterozygosity, and who did not complete the mental health questionnaire [66] (final N = 105,638 participants; 44% males). We identified 150 autistic individuals using the UK Biobank data field 20544 (‘Mental Health problems ever diagnosed by a professional’).

Primary phenotypes

The primary phenotypes used in the study are cumulative scores on measures of childhood trauma and life-time SSBI [66] (Histograms in Supplementary Figs. 1–3):

Childhood trauma (N = 105,638)

Trauma (adult and childhood) was measured using 21 questions, which included five questions for childhood trauma. The five questions were from the childhood trauma screener (CTS), a retrospective measure of trauma designed for adults and adolescents [67]. The CTS has good internal consistency [α = 0.757] [67], correlates well with the scales of the longer Childhood Trauma Questionnaire [68], and covers physical, emotional, and sexual abuse, and physical and emotional neglect. Questions were scored from 0 to 4, with options ranging from ‘never true’ to ‘very often true’. We excluded participants who reported ‘prefer not to answer’. For two of the positive items, we inverse scored it to capture trauma. Total scores ranged from 0 to 20, with higher scores representing higher trauma. We used total score as there is evidence to suggest that the total sum of childhood trauma is a better marker of risk for adverse outcomes than individual items [69]. We refer to this phenotype as ‘childhood trauma score’ throughout the results. The items included are:

(a) Felt loved as a child (inverse scored) (emotional neglect) (b) Someone to take me to the doctor as a child (inverse scored) (physical neglect) (c) Sexually molested as a child (sexual abuse) (d) Physically abused by family as a child (physical abuse) (e) Felt hated by family member as a child (emotional abuse)

SSBI (N = 105,222)

In contrast to childhood trauma, the UK Biobank mental health working group did not identify an adequate previously-published instrument to measure SSBI [66]. Self-harm was thus measured using 10 questions in the UK Biobank (UK Biobank data showcase category 146). Three of these questions asked about SSBI in the past year, and we excluded this to focus on life-time self-harm behaviours. We further excluded two questions: ‘Methods of self-harm’, and ‘Action taken following self-harm’, as these cannot be easily included in a scale of SSBI. Finally, we excluded two additional questions: ‘Number of times self-harmed’ and ‘Ever attempted suicide’ as these were completed by only 6,872 participants. Thus, we used four questions of SSBI which were measured on different scales. The first two items had three options: ‘No’, ‘Yes, Once’, ‘Yes, more than once’. The third item had four options: ‘Not at all’, ‘Several days’, ‘More than half the days’, ‘Nearly every day’.

(a) Ever thought life was not worth living (range: 0–2) (b) Ever contemplated self-harm (range: 0–2) (c) Recent thoughts of suicide or self-harm (range: 0–3) (d) Ever attempted self-harm (binarized: 1 = yes, 0 = no)

Given the range in scores, we constructed two scales, the first being the self-harm ideation scale, which was created by summing up the scores for the first three items. The total score on the self-harm ideation scale ranged from 0 to 7. We refer to this phenotype as ‘self-harm ideation score’. We created a second scale by including all items. For this, we binarized scores for all four items with 1 representing ‘yes’ and 0 representing ‘no’. Thus, the total score on the self-harm scale ranged from 0 to 4. We refer to this phenotype as ‘self-harm score’. For both measures, we excluded participants who chose ‘Prefer not to answer’. Total scores were created only for participants who responded to all the items included in the scores.

Mediators and moderators of self-harm

We considered the effects of nine measures as mediators of autism PGS and self-harm:

(1) Depressive symptoms (39,479 < N < 39,551) (2) Anxiety symptoms (28,177 < N < 28,231) (3) Friendship dissatisfaction (56,704 < N < 56,842) (4) Family relationship dissatisfaction (56,704 < N < 56,842) (5) Job dissatisfaction (30,533 < N < 30,575) (6) Frequency of friendship/family visits (117,616 < N < 117,772 (7) Confiding relationship (115,402 < N < 115,553) (8) Cognitive aptitude (93,811 < N < 93,935) (9) Educational attainment (103,279 < N < 103,417)

Further details of how these phenotypes were constructed and methods used in mediation analyses are provided in Supplementary Note Section 1. Previous research has provided support for all these variables influencing SSBI, which is provided in Supplementary Note Section 2. Histograms are provided in Supplementary Fig. 4. Prior to mediation, we investigated if the autism PGS are associated with the mediators, and included only those variables that were associated with autism PGS. We tested each mediator independently rather than in parallel or serially as: (1) We are unable to provide causal relationship between the mediators; (2) It is impossible to provide temporal ordering in this cross-sectional dataset; (3) Several of these variables are moderately correlated with each other (Supplementary Table 1).

We considered two variables as moderators of the effect of PGS on SSBI: sex and childhood trauma score. We draw a distinction between moderators and interaction based on Baron and Kenny [70]. In this framework, a mediator is a variable that represents a mechanism through which the independent variable influences the dependent variable (an intermediary variable). In contrast, a moderator is a variable that affects the strength of the relationship between the independent and the dependent variable (effect modifier), and is equivalent to testing an interaction effect. In this framework, we interpret childhood trauma score and sex as moderators rather than a mediator, as any mediating effect is likely due to downstream effects of trauma such as depression and anxiety in line with the diathesis-stress hypothesis. We note that it is not uncommon to test a variable as both mediator and moderator [71,72,73].

Statistical analyses

Genotype quality control

We used genotype and imputed SNPs from the UK Biobank [64]. Imputed dosages converted to hard-calls using Plink [74]. Calls with uncertainty greater than 0.1 were treated as missing. We restricted our analyses to SNPs with minor allele frequency >1%, with an imputation r2 > 0.6, with a per-SNP genotyping rate > 90%, and did not have significant deviations from the Hardy-Weinberg Equilibrium (P < 1 × 10−6). We excluded individuals who were genetically related (KING-estimated kinship > 0.088, equivalent to third-degree relatives), were not of ‘White British’ ethnicity determined by genetic grouping (UKB Data-field 22006), who had discordant reported and genetic sex, who were outliers for genetic heterozygosity, and who had genotyping rate <90%.

Polygenic score generation and regression analyses

PGS were constructed using a clumping and thresholding algorithm in PRSice 2 [75]. While there are a few methods that improve the variance explained of the PGS compared to clumping and thresholding [76,77,78,79], we decided not to use these as: (1) The increase in variance explained is minimal compared to clumping and thresholding, with one study showing no statistically significant difference in variance explained [80]; (2) The current study investigates covariance rather than variance (i.e. a function of genetic correlation rather than a function of h2 SNP ), and it is unclear if other methods improve the covariance explained; (3) The large sample size of the testing dataset (UK Biobank) used in the current study makes using methods such as LDPred [76] computationally inefficient and impractical; and 4. We were specifically investigating the shared genetics between autism and childhood trauma and SSBI, making multi-phenotype polygenic scoring methods [78, 79] unsuitable for this study.

PGS are weighted averages of common risk polymorphisms that represent an individual’s inherited propensity for a condition. Weights are assigned for each allele based on the regression β value of the GWAS (base dataset), and individuals are scored according to the number of trait-increasing alleles they have (0, 1, or 2). The base dataset was the largest autism GWAS meta-analysis based on 18,381 autistic individuals and 27,969 individuals from the general population [43]. As a negative control, we used a second base dataset: a GWAS meta-analysis of Alzheimer’s Disease (17,008 cases and 37,154 controls) [81]. We choose this dataset as a negative control as there is no significant genetic correlation with the autism GWAS (r g = 0.04 ± 0.10; P = 0.102), the two GWAS have similar sample sizes and statistical power (Mean chi-square: Alzheimer’s = 1.114, Autism = 1.2), and Alzheimer’s disease is a neurological condition with typical onset late in life. Both GWAS datasets are independent of the participants from the UK Biobank in this study.

We clumped SNPs using an LD-based r2 of 0.2 and a genomic distance of 250 kb, based on current guidelines [82]. PGS were constructed for seven P-value thresholds (P = 1, 0.75, 0.5, 0.25, 0.1, 0.01, and 0.001, histograms in Supplementary Fig. 5). These thresholds were chosen to balance the signal-to-noise ratio as autism is highly polygenic [43]. The number of SNPs at each threshold is provided in Supplementary Table 2. In addition, for each item in the three primary phenotypes, we conducted individual PGS-based regression analysis using the P-value threshold that explained the maximum variance for the primary phenotype that included the item. We conducted regression analyses using standardized PGS as the independent variable, the first 20 genetic principle components, year of birth, sex, and genotyping batch as covariates in the model, all of which were standardized. Linear regression analyses were conducted for all analyses except for the individual items in the SSBI measures as these were binarized, and thus suitable for a logistic regression. For the variables that were significantly associated with autism PGS, we also investigated the average scores of the variables in the top and the bottom centiles of the PGS uncorrected for any covariates.

The UK Biobank has a healthy volunteer bias and participants were born before 1970. As such only 223 out of 50,099 individuals in the UK Biobank reported a diagnosis of autism, when asked as a part of the mental health questionnaire. This (0.4%) is lower than the reported prevalence of autism in the UK and the US (1–2%). The lower prevalence in this cohort may be attributed to both a healthy volunteer bias, and the fact that this is an older cohort, resulting in an underdiagnosis of autism, though empirical evidence suggests that the estimated prevalence of autism (diagnosed and undiagnosed combined), does not vary with age [83]. Given the small number of individuals with an autism diagnosis in the UK Biobank, power calculations indicated that we had only 50% statistical power, and thus were underpowered to investigate if PGS for autism are associated with case-control status in the UK Biobank. We were, thus, unable to test within the UK Biobank if autistic individuals have higher autism PGS. However, studies have tested the association of PGS from the latest iPSYCH-PGC autism GWAS [43], which we use in the current study, and identified a variance explained of 2.45% [43]. In the typical population, autism PGS from the same GWAS, explained 0.13% of variance in social and communication difficulties in children at age 8 [46].

Polygenic transmission disequilibrium test

We conducted polygenic transmission disequilibrium test (pTDT) [84] in N = 2,234 families from the simons simplex collection (SSC) [85], of primarily European Ancestry (identified by multidimensional scaling) to investigate if PGS for the three primary phenotypes are over-transmitted from parents to autistic probands compared to sibling controls. pTDT is a modified t test which compares the mean PGS in autistic individuals compared to the mean mid-parent PGS. pTDT is a within-family statistical test, and is less confounded by factors such as population stratification and assortative mating. Details of QC in the SSC are provided in the Supplementary Note section 3. We constructed PGS at P = 1 as these phenotypes are highly polygenic. PGS were constructed using PRSice as outlined earlier.

GWAS, genetic correlation analyses, and genomic SEM

To provide further support to the results of the PGS analyses we conducted GWAS of the three primary phenotypes, details of which are provided in the Supplementary Note section 4. We conducted genetic correlation between autism and the three primary phenotypes using LDSC [49, 86]. LD scores were generated using a north-west European population. To better understand the shared genetics between autism and the three primary phenotypes after accounting for the common genetic effects of various co-occuring conditions, we conducted genomic structural equation modelling (SEM) analyses [50]. We used genome-wide summary statistics for:

(1) ADHD [87]: N = 20,183 cases and 35,191 controls (2) Major Depressive Disorder [88]: N = 59,851 cases and 113,154 controls (excluding 23andMe) (3) Schizophrenia [89]: N = 40,675 cases and 64,643 controls (4) Cognitive aptitude [90]: N = 257,828 (5) Educational attainment [90]: N = 766,345 (sample size after excluding data from 23andMe)

These GWAS summary statistics were chosen keeping in mind their modest/high genetic correlation with autism, and the mean sample size.

Mediation and moderation analyses

We modelled interaction between sex and PGS, and childhood trauma scores and PGS. We further conducted a series of mediation analyses to identify potential variables that mediate the association between autism PGS and SSBI. All variables were standardized for both the moderation and the mediation analyses. For the moderation analysis with SSBI as the dependent variable, and for all mediation analyses, we restricted our investigations to a PGS P-value threshold of 0.75 as this explained the maximum variance in SSBI. For the moderation analysis with childhood trauma as the dependent variable, we used a P-value threshold of 1 as this explained the maximum variance in childhood trauma.

Multiple testing correction

For each analysis conducted, we corrected for the multiple tests conducted using Bonferroni correction.