Genome-wide association study of positive and negative affect reveals shared genetic architecture and a potential causal relationship with cognition.
The 1 match
- [1] § Methods and materials › Bidirectional Mendelian randomization ↔ R/ld_clump.R, lines 1–97 · score 0.66 · ld_clump, genomes reference, kb, MAF, r2, threshold
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R · 218 lines · 8.5 KB · other · 1 match
- #' Perform LD clumping on SNP data
- #'
- #' Uses PLINK clumping method, where SNPs in LD within a particular window will be pruned.
- #' The SNP with the lowest p-value is retained.
- #'
- #' @details
- #' This function interacts with the OpenGWAS API, which houses LD reference panels
- #' for the 5 super-populations in the 1000 genomes reference panel.
- #' It includes only bi-allelic SNPs with MAF > 0.01, so it's quite possible that
- #' a variant you want to include in the clumping process will be absent.
- #' If it is absent, it will be automatically excluded from the results.
- #'
- #' You can check if your variants are present in the LD reference panel using
- #' [`ld_reflookup()`].
- #'
- #' This function does put load on the OpenGWAS servers, which makes life more
- #' difficult for other users. We have implemented a method and made available
- #' the LD reference panels to perform clumping locally, see
- #' [`ld_clump()`] and related vignettes for details.
- #'
- #' @param dat Dataframe. Must have a variant name column (`rsid`) and pval column called `pval`.
- #' If `id` is present then clumping will be done per unique id.
- #' @param clump_kb Clumping kb window. Default is very strict, `10000`
- #' @param clump_r2 Clumping r2 threshold. Default is very strict, `0.001`
- #' @param clump_p Clumping sig level for index variants. Default = `1` (i.e. no threshold)
- #' @param pop Super-population to use as reference panel. Default = `"EUR"`.
- #' Options are `"EUR"`, `"SAS"`, `"EAS"`, `"AFR"`, `"AMR"`.
- #' `'legacy'` also available - which is a previously used version of the EUR
- #' panel with a slightly different set of markers
- #' @param opengwas_jwt Used to authenticate protected endpoints. Login to <https://api.opengwas.io> to obtain a jwt. Provide the jwt string here, or store in .Renviron under the keyname OPENGWAS_JWT.
- #' @param bfile If this is provided then will use the API. Default = `NULL`
- #' @param plink_bin If `NULL` and `bfile` is not `NULL` then will detect
- #' packaged plink binary for specific OS. Otherwise specify path to plink binary.
- #' Default = `NULL`,
- #' @param ... Additional arguments passed to [`ld_clump_api()`].
- #'
- #' @export
- #' @return Data frame
- ld_clump <- function(dat=NULL, clump_kb=10000, clump_r2=0.001, clump_p=0.99,
- pop = "EUR", opengwas_jwt=get_opengwas_jwt(), bfile=NULL, plink_bin=NULL, ...)
- {
- stopifnot("rsid" %in% names(dat))
- stopifnot(is.data.frame(dat))
- if(is.null(bfile))
- {
- message("Please look at vignettes for options on running this locally if you need to run many instances of this command.")
- }
- if (!is.null(bfile) && is.null(plink_bin)) {
- plink_bin <- Sys.which("plink")
- if (plink_bin == "" || is.na(plink_bin)) {
- stop("Could not find PLINK executable. Please set plink_bin to the path of the PLINK executable.")
- }
- }
- if(! "pval" %in% names(dat))
- {
- if( "p" %in% names(dat))
- {
- warning("No 'pval' column found in dat object. Using 'p' column.")
- dat[["pval"]] <- dat[["p"]]
- } else {
- warning("No 'pval' column found in dat object. Setting p-values for all SNPs to clump_p parameter.")
- dat[["pval"]] <- clump_p
- }
- }
- if(! "id" %in% names(dat))
- {
- dat$id <- random_string(1)
- }
- ids <- unique(dat[["id"]])
- res <- list()
- for(i in seq_along(ids))
- {
- x <- subset(dat, dat[["id"]] == ids[i])
- if(nrow(x) == 1)
- {
- message("Only one SNP for ", ids[i])
- res[[i]] <- x
- } else {
- if(is.null(bfile))
- {
- message("Clumping ", ids[i], ", ", nrow(x), " variants, using ", pop, " population reference")
- res[[i]] <- ld_clump_api(x, clump_kb=clump_kb, clump_r2=clump_r2, clump_p=clump_p, pop=pop, opengwas_jwt=opengwas_jwt, ...)
- } else {
- message("Clumping ", ids[i], ", ", nrow(x), " variants, using: ", bfile)
- res[[i]] <- ld_clump_local(x, clump_kb=clump_kb, clump_r2=clump_r2, clump_p=clump_p, bfile=bfile, plink_bin=plink_bin)
- }
- }
- }
- res <- dplyr::bind_rows(res)
- return(res)
- }
- #' Perform clumping on the chosen variants using the API
- #'
- #' @param dat Dataframe. Must have a variant name column (`variant`) and pval column called `pval`.
- #' If `id` is present then clumping will be done per unique id.
- #' @param clump_kb Clumping kb window. Default is very strict, `10000`
- #' @param clump_r2 Clumping r2 threshold. Default is very strict, `0.001`
- #' @param clump_p Clumping sig level for index variants. Default = `1` (i.e. no threshold)
- #' @param pop Super-population to use as reference panel. Default = `"EUR"`.
- #' Options are `"EUR"`, `"SAS"`, `"EAS"`, `"AFR"`, `"AMR"`
- #' @param opengwas_jwt Used to authenticate protected endpoints. Login to <https://api.opengwas.io> to obtain a jwt. Provide the jwt string here, or store in .Renviron under the keyname OPENGWAS_JWT.
- #' @param ... Additional arguments passed to `api_query()`.
- #' @return Data frame of only independent variants
- ld_clump_api <- function(dat, clump_kb=10000, clump_r2=0.001, clump_p=1, pop="EUR", opengwas_jwt=get_opengwas_jwt(), ...)
- {
- res <- api_query('ld/clump',
- query = list(
- rsid = dat[["rsid"]],
- pval = dat[["pval"]],
- pthresh = clump_p,
- r2 = clump_r2,
- kb = clump_kb,
- pop = pop
- ),
- opengwas_jwt=opengwas_jwt, ...
- ) %>% get_query_content()
- y <- subset(dat, !dat[["rsid"]] %in% res)
- if(nrow(y) > 0)
- {
- message("Removing ", length(y[["rsid"]]), " of ", nrow(dat), " variants due to LD with other variants or absence from LD reference panel")
- }
- return(subset(dat, dat[["rsid"]] %in% res))
- }
- #' Wrapper for clump function using local plink binary and ld reference dataset
- #'
- #' @param dat Dataframe. Must have a variant name column (`variant`) and pval column called `pval`.
- #' If `id` is present then clumping will be done per unique id.
- #' @param clump_kb Clumping kb window. Default is very strict, `10000`
- #' @param clump_r2 Clumping r2 threshold. Default is very strict, `0.001`
- #' @param clump_p Clumping sig level for index variants. Default = `1` (i.e. no threshold)
- #' @param bfile If this is provided then will use the API. Default = `NULL`
- #' @param plink_bin Specify path to plink binary. Default = `NULL`.
- #' See \url{https://github.com/MRCIEU/genetics.binaRies} for convenient access to plink binaries
- #' @importFrom utils read.table
- #' @importFrom utils write.table
- #' @export
- #' @return data frame of clumped variants
- ld_clump_local <- function(dat, clump_kb, clump_r2, clump_p, bfile, plink_bin)
- {
- # Make textfile
- shell <- ifelse(Sys.info()['sysname'] == "Windows", "cmd", "sh")
- fn <- tempfile()
- write.table(data.frame(SNP=dat[["rsid"]], P=dat[["pval"]]), file=fn, row.names=FALSE, col.names=TRUE, quote=FALSE)
- fun2 <- paste0(
- shQuote(plink_bin, type=shell),
- " --bfile ", shQuote(bfile, type=shell),
- " --clump ", shQuote(fn, type=shell),
- " --clump-p1 ", clump_p,
- " --clump-r2 ", clump_r2,
- " --clump-kb ", clump_kb,
- " --out ", shQuote(fn, type=shell)
- )
- system(fun2)
- res <- read.table(paste(fn, ".clumped", sep=""), header=TRUE)
- unlink(paste(fn, "*", sep=""))
- y <- subset(dat, !dat[["rsid"]] %in% res[["SNP"]])
- if(nrow(y) > 0)
- {
- message("Removing ", length(y[["rsid"]]), " of ", nrow(dat), " variants due to LD with other variants or absence from LD reference panel")
- }
- return(subset(dat, dat[["rsid"]] %in% res[["SNP"]]))
- }
- random_string <- function(n=1, len=6)
- {
- randomString <- character(n)
- for (i in seq_len(n))
- {
- randomString[i] <- paste(sample(c(0:9, letters, LETTERS),
- len, replace=TRUE),
- collapse="")
- }
- return(randomString)
- }
- #' Check which rsids are present in a remote LD reference panel
- #'
- #' Provide a list of rsids that you may want to perform LD operations on to
- #' check if they are present in the LD reference panel. If they are not then
- #' some functions e.g. [`ld_clump`] will exclude them from the analysis,
- #' so you may want to consider how to handle those variants in your data.
- #'
- #' @param rsid Array of rsids to check
- #' @param pop Super-population to use as reference panel. Default = `"EUR"`.
- #' Options are `"EUR"`, `"SAS"`, `"EAS"`, `"AFR"`, `"AMR"`
- #' @param opengwas_jwt Used to authenticate protected endpoints. Login to <https://api.opengwas.io> to obtain a jwt. Provide the jwt string here, or store in .Renviron under the keyname OPENGWAS_JWT.
- #' @param ... Additional arguments passed to `api_query()`.
- #'
- #' @export
- #' @return Array of rsids that are present in the LD reference panel
- ld_reflookup <- function(rsid, pop='EUR', opengwas_jwt=get_opengwas_jwt(), ...)
- {
- res <- api_query('ld/reflookup',
- query = list(
- rsid = rsid,
- pop = pop
- ),
- opengwas_jwt=opengwas_jwt, ...
- ) %>% get_query_content()
- if(length(res) == 0)
- {
- res <- character(0)
- }
- return(res)
- }
ld_clump.R at commit 5097bb9, under other · at the source
Overview
- Medical Research Council Integrative Epidemiology Unit, Bristol Medical School, University of Bristol, Oakfield House, Oakfield Grove, Bristol, BS8 2BN UK
- Centre for Academic Mental Health, Population Health Sciences, Bristol Medical School, University of Bristol, Bristol, UK
- Depression Clinical and Research Program, Department of Psychiatry, Massachusetts General Hospital, Boston, USA
- Department of Epidemiology, University of Groningen, University Medical Center Groningen, Groningen, The Netherlands
- Department of Genetics, University of Groningen, University Medical Center Groningen, Groningen, The Netherlands
- Department of Pediatrics, University of Groningen, University Medical Center Groningen, Groningen, The Netherlands
- Institute for Molecular Bioscience, The University of Queensland, Brisbane, Queensland Australia
- Interdisciplinary Center Psychopathology and Emotion Regulation, Department of Psychiatry, University of Groningen, University Medical Center Groningen, Groningen, The Netherlands
- NIHR Bristol Biomedical Research Centre and NIHR Bristol Clinical Research Facility, University Hospitals Bristol and Weston NHS Foundation Trust, Bristol, UK, Bristol, UK
- Avon and Wiltshire Mental Health Partnership NHS Trust, Bristol, UK
Abstract
Altered affect and cognitive dysfunction are burdensome features of many neuropsychiatric conditions that are highly comorbid, remain poorly understood, and have few efficacious treatments. Exploring their genetic architecture and causal relationships may provide insight into their aetiology and comorbidity. Compared to related but distinct traits (depression, wellbeing, neuroticism), findings from genome-wide association studies (GWAS) of positive and negative affect may be informative due to these phenotypes being less heterogenous (compared to broader phenotypes of wellbeing and depression), whilst still retaining important clinical relevance as potential targets for indirect intervention (compared to neuroticism which may be less modifiable). Using data from the Lifelines Cohort Study, we conducted the first GWAS of positive and negative affect using a validated measure (N = 57,946), and four cognitive domains: working memory, reaction time, learning and memory, and executive function (N ≥ 35,729). We then assessed genetic overlap and potential causal relationships using genetic correlation and bidirectional Mendelian randomization (MR) analyses, incorporating large GWAS on related—albeit distinct—phenotypes (depression, anxiety, wellbeing, general cognitive ability [GCA]). We identified one SNP that reached genome-wide significance (p < 5 × 10–8) for reaction time, and many independent SNPs with suggestive associations for other phenotypes (N = 11–20). For most phenotypes, exploratory gene mapping indicated that SNPs with suggestive associations have higher gene expression in brain tissue compared to other tissues; however, this only met Bonferroni-corrected p-value threshold criteria for positive affect and visual learning and memory. Genetic correlations between negative and positive affect suggest that they are dissociable constructs (rg = − 0.18). GCA has higher genetic overlap with negative affect than with positive affect (rg = − 0.19 vs − 0.06), which could indicate that negative affect and GCA have a higher shared neural basis and/
Supplementary Information: The online version contains supplementary material available at 10.1038/
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.
MRCIEU/ieugwasr
5097bb98167d2a7634ea96b58854ee319a0c6f57, 28 September 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
24 files
- R/
afl2.r , R, 110 lines - R/
api.R , R, 79 lines - R/
backwards.R , R, 49 lines - R/
globals.R , R, 1 line - R/
ieugwasr-package.R , R, 7 lines - R/
ld_clump.R , R, 218 lines, 1 match - R/
ld_matrix.R , R, 135 lines - R/
query.R , R, 528 lines - R/
variants.R , R, 129 lines - R/
zzz.R , R, 48 lines - tests/
testthat.R , R, 4 lines - tests/
testthat/ , R, 34 linestest_afl2.r - tests/
testthat/ , R, 12 linestest_api.r - tests/
testthat/ , R, 21 linestest_backwards.r - tests/
testthat/ , R, 21 linestest_check429.r - tests/
testthat/ , R, 19 linestest_fix_n.r - tests/
testthat/ , R, 62 linestest_ld.r - tests/
testthat/ , R, 164 linestest_query.r - tests/
testthat/ , R, 73 linestest_variants.r - vignettes/
guide.Rmd , R, 261 lines - vignettes/
local_ld.Rmd , R, 101 lines - LICENSE, License, 2 lines
- LICENSE.md, License, 21 lines
- README.md, Text, 51 lines
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 21 scripts, each with its path and the digest of its content;
- 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- mrcieu.github.io/
ieugwasr , at mrcieu.github.io; found in the references
Data availability
Due to the sensitivity of the data involved, these data are published as a restricted dataset at the University of Bristol Research Data Repository data.bris, at 10.5523/
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 28 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 10 authors, 5 keywords, 9 MeSH terms, 2 funders, 73 references.
Cite
This paper
Slaney, C., Mac Giollabhui, N., van der Most, P. J., Palacios, E. R., Lifelines Cohort Study, Snieder, H., Nivard, M., Hemani, G., Hartman, C. A., & Khandaker, G. M. (2026). Genome-wide association study of positive and negative affect reveals shared genetic architecture and a potential causal relationship with cognition. Scientific reports, 16(1), 24055. https://
BibTeX
@article{slaney2026genom
author = {Slaney, Chloe and Mac Giollabhui, Naoise and van der Most, Peter J and Palacios, Ensor R and {Lifelines Cohort Study} and Snieder, Harold and Nivard, Michel and Hemani, Gibran and Hartman, Catharina A and Khandaker, Golam M},
title = {{Genome-wide association study of positive and negative affect reveals shared genetic architecture and a potential causal relationship with cognition}},
journal = {Scientific reports},
year = {2026},
month = may,
volume = {16},
number = {1},
pages = {24055},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/
url = {https://
pmid = {42185370},
pmcid = {PMC13439573}
}
RIS
TY - JOUR
AU - Slaney, Chloe
AU - Mac Giollabhui, Naoise
AU - van der Most, Peter J
AU - Palacios, Ensor R
AU - Lifelines Cohort Study
AU - Snieder, Harold
AU - Nivard, Michel
AU - Hemani, Gibran
AU - Hartman, Catharina A
AU - Khandaker, Golam M
TI - Genome-wide association study of positive and negative affect reveals shared genetic architecture and a potential causal relationship with cognition
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/
VL - 16
IS - 1
SP - 24055
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Genome-wide association study of positive and negative affect reveals shared genetic architecture and a potential causal relationship with cognition",
"container-title": "Scientific reports",
"author": [
{
"family": "Slaney",
"given": "Chloe"
},
{
"family": "Mac Giollabhui",
"given": "Naoise"
},
{
"family": "van der Most",
"given": "Peter J"
},
{
"family": "Palacios",
"given": "Ensor R"
},
{
"literal": "Lifelines Cohort Study"
},
{
"family": "Snieder",
"given": "Harold"
},
{
"family": "Nivard",
"given": "Michel"
},
{
"family": "Hemani",
"given": "Gibran"
},
{
"family": "Hartman",
"given": "Catharina A"
},
{
"family": "Khandaker",
"given": "Golam M"
}
],
"container-title-short":
"volume": "16",
"issue": "1",
"page": "24055",
"DOI": "10.1038/
"PMID": "42185370",
"PMCID": "PMC13439573",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
25
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41562-026-02476-7 [code]
- Genome-wide meta-analysis of quantitatively measured generalized anxiety symptoms in individuals of European ancestry.Journal: Nature human behaviourIn common: tidyverse, genetics / omics, 9 references, author Peter J. van der Most
- [2] doi:10.1038/s41562-026-02486-5 [code]
- Genome-wide association studies of infant and toddler temperament in European and multi-ancestry populations.Journal: Nature human behaviourIn common: tidyverse, genetics / omics, 7 references
- [3] doi:10.1371/journal.pcbi.1014422 [code]
- Deciphering cell type-specific causal genetic effects on brain imaging-derived phenotypes and disorders with single-cell Mendelian randomization.Journal: PLoS computational biologyIn common: tidyverse, genetics / omics, 7 references
- [4] doi:10.1038/s41398-026-04137-9 [code]
- An integrative mendelian randomisation and drug mechanism framework for target prioritisation and therapeutic repurposing in major depression.Journal: Translational psychiatryIn common: depression, genetics / omics, 6 references
- [5] doi:10.1038/s42003-026-10131-0 [code]
- Shared genetic architecture between the topology of brain white matter structural connectome and fluid intelligence.Journal: Communications biologyIn common: genetics / omics, 7 references
- [6] doi:10.1038/s41540-026-00754-8
- Systematic proteomic analysis of neuroimaging metrics identifies therapeutic targets for pituitary neuroendocrine.Journal: NPJ systems biology and applicationsIn common: genetics / omics, 7 references
- [7] doi:10.1038/s41467-026-73428-y [code]
- Regional heterogeneity in phenotypic and genetic associations between bone and brain in humans.Journal: Nature communicationsIn common: tidyverse, genetics / omics, 6 references
- [8] doi:10.1038/s41467-026-73996-z [code]
- Genetic architecture of white matter microstructure captured by unsupervised deep representation learning of fractional anisotropy maps.Journal: Nature communicationsIn common: tidyverse, genetics / omics, 6 references
- [9] doi:10.1073/pnas.2609814123 [code]
- Genetic architectures of brain-related traits are shaped by strong selective constraints.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: tidyverse, genetics / omics, 5 references
- [10] doi:10.3390/genes17080874 [code]
- Multi-Omic Analysis of Cerebrospinal Fluid Metabolites in Autism Spectrum Disorder: Biomarker Identification, Metabolic Genetics Insights, and Network Toxicology.Journal: GenesIn common: genetics / omics, 6 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 21 scripts, and 1 match between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:7834e0720dd8c081…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
