From 257e1aa50801ccaa7a2da6df9bc51c9aba6c6bab Mon Sep 17 00:00:00 2001
From: Ararder <48621063+Ararder@users.noreply.github.com>
Date: Wed, 24 Jul 2024 14:11:42 +0000
Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20Ararder/?=
=?UTF-8?q?ldsR@3f8b1286d0599af8a97968f2669ae02c5fab761f=20=F0=9F=9A=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
articles/ldsR.html | 44 ++++++++++++++++++++++++++++----------------
pkgdown.yml | 2 +-
reference/index.html | 6 ------
reference/munge.html | 2 +-
search.json | 2 +-
sitemap.xml | 1 -
6 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/articles/ldsR.html b/articles/ldsR.html
index ab66e56..e88c431 100644
--- a/articles/ldsR.html
+++ b/articles/ldsR.html
@@ -66,26 +66,29 @@
Introduction
-
ldsR exposes six functions: 1. celltype_analysis()
to
-estimate partitioned heritability for many annotations one at a time 2.
-ldsc_h2()
to estimate heritability for a single trait 3.
-ldsc_rg()
to estimate the genetic correlation between two
-traits 4. munge()
to apply quality control filters to a
-summary statistics file 5. parse_gwas()
a function to read
-in summary statistics in the many different formats they can be found in
-the wild. 6. partitioned_h2()
to estimate partitioned
-heritability
+
ldsR exposes five functions:
+
1. celltype_analysis()
to estimate partitioned
+heritability for many annotations one at a time, while adjusting for a
+common set of annotations
+
2. ldsc_h2()
to estimate heritability for a single
+trait
+
3. ldsc_rg()
to estimate the genetic correlation between
+two traits
+
4. munge()
to apply quality control filters to a summary
+statistics file
+
6. partitioned_h2()
to estimate partitioned heritability
+- OBS, correct enrichemnt estimates for overlapping annotations has not
+yet been implemented.
Use ldsR to directly estimate heritability inside R
-
Tired of preparing your files for ldsc? Use ldsR to directly estimate
-heritability inside R.
+
Estimate heritability with one line inside R.
ldsc_h2()
has only one required argument, a dataframe
with the columns SNP
, Z
and N
.
The ref-ld-chr
and w-ld-chr
files are shipped
with the ldsR package, but you can also provide your own. By default
-the, ldsR uses the ldscores derived from the European subset of 1000
+ldsR uses the ldscores derived from the European subset of 1000
Genomes.
# example file, 100 000 rows to be lightweight.
@@ -190,8 +193,17 @@
+
ldscore_dir = system.file ( "extdata" , "baseline1.1_test" , package = "ldsR" )
+
)
+
#> ℹ Removed 449 rows after merging with weights
+
#> ℹ Removed 5961 rows after merging with ldscores
+
#> # A tibble: 4 × 8
+
#> annot coef coef_se enrich prop z tot tot_se
+
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+
#> 1 Conserved_LindbladToh.bedL2 8.54e -7 2.55e -7 18.2 0.0212 3.35 0.339 0.0380
+
#> 2 baseL2 2.65e -8 8.51e -9 0.563 0.827 3.12 0.339 0.0380
+
#> 3 H3K4me1_peaks_Trynka.bedL2 6.92e -8 4.66e -8 1.47 0.140 1.48 0.339 0.0380
+
#> 4 Coding_UCSC.bedL2 -2.28 e -7 1.61e -7 -4.85 0.0118 -1.42 0.339 0.0380
On this page
diff --git a/pkgdown.yml b/pkgdown.yml
index 7e7073c..9a1dab1 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -3,7 +3,7 @@ pkgdown: 2.1.0
pkgdown_sha: ~
articles:
articles/ldsR: ldsR.html
-last_built: 2024-07-22T08:47Z
+last_built: 2024-07-24T14:11Z
urls:
reference: http://arvidharder.com/ldsR/reference
article: http://arvidharder.com/ldsR/articles
diff --git a/reference/index.html b/reference/index.html
index 39a3b11..34d713d 100644
--- a/reference/index.html
+++ b/reference/index.html
@@ -68,12 +68,6 @@ All functionsparse_gwas()
-
-
- Parse a GWAS summary statistics
-
-
partitioned_h2()
diff --git a/reference/munge.html b/reference/munge.html
index 9ce1c24..bb6e5bd 100644
--- a/reference/munge.html
+++ b/reference/munge.html
@@ -66,7 +66,7 @@ Value
Examples
if ( FALSE ) { # \dontrun{
-parse_gwas ( tbl )
+parse_gwas ( tbl )
} # }
diff --git a/search.json b/search.json
index 805a5d9..60ea4ab 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"","text":"ldsR exposes six functions: 1. celltype_analysis() estimate partitioned heritability many annotations one time 2. ldsc_h2() estimate heritability single trait 3. ldsc_rg() estimate genetic correlation two traits 4. munge() apply quality control filters summary statistics file 5. parse_gwas() function read summary statistics many different formats can found wild. 6. partitioned_h2() estimate partitioned heritability","code":""},{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"use-ldsr-to-directly-estimate-heritability-inside-r","dir":"Articles","previous_headings":"","what":"Use ldsR to directly estimate heritability inside R","title":"","text":"Tired preparing files ldsc? Use ldsR directly estimate heritability inside R. ldsc_h2() one required argument, dataframe columns SNP, Z N. ref-ld-chr w-ld-chr files shipped ldsR package, can also provide . default , ldsR uses ldscores derived European subset 1000 Genomes.","code":"# example file, 100 000 rows to be lightweight. df <- arrow::read_parquet(system.file(\"extdata\", \"sumstats.parquet\", package = \"ldsR\")) tdf <- dplyr::rename(df, Z = Z.x, N = N.x) ldsc_h2(tdf) #> # A tibble: 1 × 6 #> h2 h2_se int int_se mean_chi2 lambda_gc #> #> 1 0.371 0.0358 1.09 0.0328 2.14 1.80"},{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"genetic-correlations","dir":"Articles","previous_headings":"","what":"Genetic correlations","title":"","text":"calculate genetic correlation two traits, pass data.frames ldsc_rg(). Note now five mandatory columns data.frame: SNP Z N A1 A2. A1 A2 required align direction Z value across two summary statistics. ldsc_rg() provides interface easily run make genetic correlations index trait. sumstats2 can provide list data.frames, ldsc_rg calculate genetic correlation summary statistic list. provide named list, names saved trait2 column.","code":"sumstat1 <- dplyr::rename(df, Z = Z.x, N = N.x) |> dplyr::mutate(A1 = \"A\", A2 = \"G\") sumstat2 <- dplyr::rename(df, Z = Z.y, N = N.y) |> dplyr::mutate(A1 = \"A\", A2 = \"G\") ldsc_rg(sumstat1, sumstat2) #> ! 0 SNPs were removed when merging summary statistics #> # A tibble: 1 × 14 #> trait2 rg rg_se h2_trait1 h2_trait_se h2_trait2 h2_trait2_se gcov gcov_se #> #> 1 1 0.734 0.0496 0.371 0.0358 0.0732 0.00685 0.121 0.0113 #> # ℹ 5 more variables: gcov_int , gcov_int_se , mean_z1z2 , #> # z , p sumstats <- list( \"trait1\" = sumstat2, \"trait2\" = sumstat2, \"trait4\" = sumstat2 ) ldsc_rg(sumstat1, sumstats) #> ! 0 SNPs were removed when merging summary statistics #> ⠙ 1/3 ETA: 3s | Computing genetic correlations... #> ! 0 SNPs were removed when merging summary statistics #> ⠙ 1/3 ETA: 3s | Computing genetic correlations... ! 0 SNPs were removed when merging summary statistics #> ⠙ 1/3 ETA: 3s | Computing genetic correlations... #> # A tibble: 3 × 14 #> trait2 rg rg_se h2_trait1 h2_trait_se h2_trait2 h2_trait2_se gcov gcov_se #> #> 1 trait1 0.734 0.0496 0.371 0.0358 0.0732 0.00685 0.121 0.0113 #> 2 trait2 0.734 0.0496 0.371 0.0358 0.0732 0.00685 0.121 0.0113 #> 3 trait4 0.734 0.0496 0.371 0.0358 0.0732 0.00685 0.121 0.0113 #> # ℹ 5 more variables: gcov_int , gcov_int_se , mean_z1z2 , #> # z , p "},{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"munge","dir":"Articles","previous_headings":"","what":"Munge","title":"","text":"munge() function can used mimic filters munge_sumstats.py file ldsc.","code":"munge(sumstat1) #> ! Removed 0 rows with duplicated RSIDs #> ! Removed 0 rows due to strand ambigious alleles #> ! Removed 0 rows with a sample size smaller than 87096 #> # A tibble: 100,000 × 5 #> SNP Z N A1 A2 #> #> 1 rs3094315 0.289 126849 A G #> 2 rs3131972 0.269 126849 A G #> 3 rs3131969 -0.074 126849 A G #> 4 rs1048488 0.273 126849 A G #> 5 rs3115850 0.263 126849 A G #> 6 rs2286139 0.034 126849 A G #> 7 rs12562034 0.346 118583 A G #> 8 rs4040617 0.13 127964 A G #> 9 rs2980300 -0.303 127964 A G #> 10 rs4970383 -2.37 114957 A G #> # ℹ 99,990 more rows"},{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"partitioned-heritability","dir":"Articles","previous_headings":"","what":"Partitioned heritability","title":"","text":"estimate partitioned heritability, partitioned_h2() available, requires ldscore_dir argument, directory containing partitioned ldscore files ld.parquet annot.parquet M50 M values. OBS, overlapping annotations, functionality adjust enrichment estimate yet implemented. Therefore enrichment estimate used.","code":"partitioned_h2( sumstat1, ldscore_dir = test_path(\"testdata/baseline\") )"},{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"cell-type-analysis","dir":"Articles","previous_headings":"","what":"Cell-type analysis","title":"","text":"Another common usage version partitioned heritability sometimes referred “cell-type analysis”. like estimate significance heritability enrichment specific set genomic locations (example specifically expressed genes neurons), adjusting another set annotations (genes, genes expressed brain, transcription factor binding sites etc). Typically, several different cell-types test. pass annotations model covariate_dir, ldscores cell-type ldscore_dir","code":"celltype_analysis( sumstat1, covariate_dir = test_path(\"testdata/baseline\"), ldscore_dir = test_path(\"testdata/superclusters\") )"},{"path":"http://arvidharder.com/ldsR/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Arvid Harder. Maintainer.","code":""},{"path":"http://arvidharder.com/ldsR/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"harder (2024). ldsR: R implementation LDscore regression (LDSC). R package version 0.1.0, http://arvidharder.com/ldsR/, https://github.com/Ararder/ldsR.","code":"@Manual{, title = {ldsR: An R implementation of LDscore regression (LDSC)}, author = {Arvid harder}, year = {2024}, note = {R package version 0.1.0, http://arvidharder.com/ldsR/}, url = {https://github.com/Ararder/ldsR}, }"},{"path":"http://arvidharder.com/ldsR/index.html","id":"ldsr","dir":"","previous_headings":"","what":"An R implementation of LDscore regression (LDSC)","title":"An R implementation of LDscore regression (LDSC)","text":"core functions ldsc python package estimating heritability, intercept, genetic correlations partitioned heritability extremely common analysis genetic data. However, interface functions longer user friendly difficulties installation python 2.7 dependencies getting nessecary reference data. addition, R commonly used everyday tasks inspecting, munging working data, making time costly swap command line interface analysis takes seconds. introduce core ldsc algorithms rewritten R make common reference data available within R package making estimation genetic correlations, heritability, intercept partitioned heritabiliy easier ever. Compare code estimate heritability ldsc using command line interface ldsR: ldsR, ldscore data contained eur_w_ld_chr folder comes R package, core functions take seconds run modern computer.","code":"# NOTE that these links are no longer valid wget https://data.broadinstitute.org/alkesgroup/LDSCORE/eur_w_ld_chr.tar.bz2 wget https://data.broadinstitute.org/alkesgroup/LDSCORE/w_hm3.snplist.bz2 tar -jxvf eur_w_ld_chr.tar.bz2 unzip -o pgc.cross.scz.zip bunzip2 w_hm3.snplist.bz2 munge_sumstats.py \\ --sumstats pgc.cross.SCZ17.2013-05.txt \\ --N 17115 \\ --out scz \\ --merge-alleles w_hm3.snplist ldsc.py \\ --h2 scz.sumstats.gz \\ --ref-ld-chr eur_w_ld_chr/ \\ --w-ld-chr eur_w_ld_chr/ \\ --out scz library(ldsR) sumstats <- readr::read_tsv(\"my_sumstats.tsv\") |> munge() h2_res <- ldsc_h2(sumstats) # estimate rg with itself rg_est = ldsc_rg(sumstats, sumstats)"},{"path":"http://arvidharder.com/ldsR/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"An R implementation of LDscore regression (LDSC)","text":"can install development version ldsR GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"Ararder/ldsR\")"},{"path":"http://arvidharder.com/ldsR/reference/celltype_analysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Perform cell-type analysis using partitioned heritability — celltype_analysis","title":"Perform cell-type analysis using partitioned heritability — celltype_analysis","text":"common usage partitioned heritability estimate enrichment significance annotation typical specific cell-type. analysis, useful adjust baseline set annotations, estimate association large set annotations (\"cell-types\")","code":""},{"path":"http://arvidharder.com/ldsR/reference/celltype_analysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Perform cell-type analysis using partitioned heritability — celltype_analysis","text":"","code":"celltype_analysis(sumstat, covariate_dir, ldscore_dir, weights = NULL)"},{"path":"http://arvidharder.com/ldsR/reference/celltype_analysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Perform cell-type analysis using partitioned heritability — celltype_analysis","text":"sumstat dplyr::tibble() columns SNP, Z N covariate_dir directory containing files ld.parquet annot.parquet ldscore_dir filepath directory annot.parquet ldscores.parquet files weights Optional, data.frame tbl columns SNP, L2","code":""},{"path":"http://arvidharder.com/ldsR/reference/celltype_analysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Perform cell-type analysis using partitioned heritability — celltype_analysis","text":"dplyr::tibble()","code":""},{"path":"http://arvidharder.com/ldsR/reference/celltype_analysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Perform cell-type analysis using partitioned heritability — celltype_analysis","text":"","code":"if (FALSE) { # \\dontrun{ celltype_analysis(ss_tbl, \"/path/to_baseline\", \"path/to/celltype_ldscores\") } # }"},{"path":"http://arvidharder.com/ldsR/reference/ldsc_h2.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","title":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","text":"R implementation LD score regression method estimate SNP heritability, mimicking ldsc --h2 ldsc package. LDscores European subset 1000g (2015 release) 1,290,028 HapMap3 SNPs (1,173,569 SNPs freq > 5%) bundled within ldsR package used default. corresponds eur_w_ld_chr folder previously shared LDSC github. can inspect LDscores used default: arrow::read_parquet(system.file(\"extdata\", \"eur_w_ld.parquet\", package = \"ldsR\")) ldsc_h2 perform quality control input summary statistics, except merge 1,290,028 HapMap3 SNPs reference panel. See munge() function mimic munge_sumstats.py function.","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_h2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","text":"","code":"ldsc_h2(sumstat, weights = NULL, M = NULL, n_blocks = 200)"},{"path":"http://arvidharder.com/ldsR/reference/ldsc_h2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","text":"sumstat dplyr::tibble() columns SNP, Z N weights Optional, data.frame tbl columns SNP, L2 M Optional, number SNPs reference panel n_blocks Number blocks use jackknife estimator","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_h2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","text":"dplyr::tibble() columns h2 h2_se","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_h2.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","text":"","code":"p <- system.file(\"extdata\", \"eur_w_ld.parquet\", package = \"ldsR\") snps <- arrow::read_parquet(p, col_select = c(\"SNP\")) snps$N <- 130000 snps$Z <- rnorm(nrow(snps)) ldsc_h2(snps) #> # A tibble: 1 × 6 #> h2 h2_se int int_se mean_chi2 lambda_gc #> #> 1 -0.000113 0.00110 1.00 0.00312 0.999 0.996"},{"path":"http://arvidharder.com/ldsR/reference/ldsc_rg.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the genetic correlation between two traits — ldsc_rg","title":"Compute the genetic correlation between two traits — ldsc_rg","text":"Compute genetic correlation two traits","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_rg.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the genetic correlation between two traits — ldsc_rg","text":"","code":"ldsc_rg(sumstats1, sumstats2, weights = NULL, M = NULL, n_blocks = 200)"},{"path":"http://arvidharder.com/ldsR/reference/ldsc_rg.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the genetic correlation between two traits — ldsc_rg","text":"sumstats1 dplyr::tibble() atleast columns SNP, A1, A2, Z, N. perform quality checks, use munge() running ldsc_rg() sumstats2 dplyr::tibble() atleast columns SNP, A1, A2, Z, N. estimate rG sumstats1 several traits, wrap data.frames list. names lost, column trait2 correspond index list. Use named list retain names trait2 column list(dataframe1, dataframe2, ...) weights Optional, data.frame tbl columns SNP, L2 M Optional, number SNPs reference panel n_blocks Number blocks use jackknife estimator","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_rg.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the genetic correlation between two traits — ldsc_rg","text":"dplyr::tibble()","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_rg.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute the genetic correlation between two traits — ldsc_rg","text":"","code":"path <- system.file(\"extdata\", \"eur_w_ld.parquet\", package = \"ldsR\") snps <- arrow::read_parquet(path, col_select = c(\"SNP\")) # to make example faster snps <- dplyr::slice_head(snps, n = 100000) snps$A1 <- \"A\" snps$A2 <- snps$N <- 130000 snps$Z <- rnorm(nrow(snps)) snps2 <- snps snps2$N <- 75000 snps2$Z <- rnorm(nrow(snps)) ldsc_rg(snps, snps2) #> ! 0 SNPs were removed when merging summary statistics #> Warning: NaNs produced #> Warning: NaNs produced #> # A tibble: 1 × 14 #> trait2 rg rg_se h2_trait1 h2_trait_se h2_trait2 h2_trait2_se gcov #> #> 1 1 NaN NA 0.000682 0.00392 -0.00572 0.00633 0.000787 #> # ℹ 6 more variables: gcov_se , gcov_int , gcov_int_se , #> # mean_z1z2 , z , p # to run estimate the genetic correlations for many traits, wrap s2 in a list # ldsc_rg(snps, list(snps2, snps2)) # use a named list to create the `trait2` column in the output # ldsc_rg(snps, list(\"trait2\" = s2, \"trait3\" = s3, \"trait4\" = s4))"},{"path":"http://arvidharder.com/ldsR/reference/munge.html","id":null,"dir":"Reference","previous_headings":"","what":"Munge GWAS summary statistics — munge","title":"Munge GWAS summary statistics — munge","text":"Munge GWAS summary statistics","code":""},{"path":"http://arvidharder.com/ldsR/reference/munge.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Munge GWAS summary statistics — munge","text":"","code":"munge(dset, info_filter = 0.9, maf_filter = 0.01)"},{"path":"http://arvidharder.com/ldsR/reference/munge.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Munge GWAS summary statistics — munge","text":"dset dplyr::tibble() columns SNP, A1 A2 Z N possibly EAF INFO info_filter INFO score filter threshold remove rows maf_filter Minor allele frequenc filter remove rows","code":""},{"path":"http://arvidharder.com/ldsR/reference/munge.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Munge GWAS summary statistics — munge","text":"data.frame","code":""},{"path":"http://arvidharder.com/ldsR/reference/munge.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Munge GWAS summary statistics — munge","text":"","code":"if (FALSE) { # \\dontrun{ parse_gwas(tbl) } # }"},{"path":"http://arvidharder.com/ldsR/reference/parse_gwas.html","id":null,"dir":"Reference","previous_headings":"","what":"Parse a GWAS summary statistics — parse_gwas","title":"Parse a GWAS summary statistics — parse_gwas","text":"Parse GWAS summary statistics","code":""},{"path":"http://arvidharder.com/ldsR/reference/parse_gwas.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse a GWAS summary statistics — parse_gwas","text":"","code":"parse_gwas(df)"},{"path":"http://arvidharder.com/ldsR/reference/parse_gwas.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse a GWAS summary statistics — parse_gwas","text":"df memory base::data.frame() filepath ldsc-munged summary statistics file filepath tidyGWAS folder.","code":""},{"path":"http://arvidharder.com/ldsR/reference/parse_gwas.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parse a GWAS summary statistics — parse_gwas","text":"dplyr::tibble() columns SNP, A1, A2, Z, N","code":""},{"path":"http://arvidharder.com/ldsR/reference/parse_gwas.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parse a GWAS summary statistics — parse_gwas","text":"","code":"if (FALSE) { # \\dontrun{ parse_gwas(tbl) } # }"},{"path":"http://arvidharder.com/ldsR/reference/partitioned_h2.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate partitioned SNP heritability — partitioned_h2","title":"Estimate partitioned SNP heritability — partitioned_h2","text":"R implementation LD score regression method estimate SNP heritability, mimicking ldsc --h2 ldsc package. partitioned heritablity, noMHC weights used instead eur_w_ld_chr weights. can inspect LDscores used default, column L2_celltype arrow::read_parquet(system.file(\"extdata\", \"eur_w_ld.parquet\", package = \"ldsR\")) partitioned_heritability perform quality control input summary statistics, except merge SNPs reference panel. See munge() function mimic munge_sumstats.py function.","code":""},{"path":"http://arvidharder.com/ldsR/reference/partitioned_h2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate partitioned SNP heritability — partitioned_h2","text":"","code":"partitioned_h2(sumstat, ldscore_dir, weights = NULL, n_blocks = 200)"},{"path":"http://arvidharder.com/ldsR/reference/partitioned_h2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate partitioned SNP heritability — partitioned_h2","text":"sumstat dplyr::tibble() columns SNP, Z N ldscore_dir filepath directory annot.parquet ldscores.parquet files weights Optional, data.frame tbl columns SNP, L2 n_blocks Number blocks use jackknife estimator","code":""},{"path":"http://arvidharder.com/ldsR/reference/partitioned_h2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate partitioned SNP heritability — partitioned_h2","text":"dplyr::tibble()","code":""},{"path":"http://arvidharder.com/ldsR/reference/partitioned_h2.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Estimate partitioned SNP heritability — partitioned_h2","text":"","code":"if (FALSE) { # \\dontrun{ partitioned_heritability(sumstats, \"path/to_dir/\") } # }"}]
+[{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"","text":"ldsR exposes five functions: 1. celltype_analysis() estimate partitioned heritability many annotations one time, adjusting common set annotations 2. ldsc_h2() estimate heritability single trait 3. ldsc_rg() estimate genetic correlation two traits 4. munge() apply quality control filters summary statistics file 6. partitioned_h2() estimate partitioned heritability - OBS, correct enrichemnt estimates overlapping annotations yet implemented.","code":""},{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"use-ldsr-to-directly-estimate-heritability-inside-r","dir":"Articles","previous_headings":"","what":"Use ldsR to directly estimate heritability inside R","title":"","text":"Estimate heritability one line inside R. ldsc_h2() one required argument, dataframe columns SNP, Z N. ref-ld-chr w-ld-chr files shipped ldsR package, can also provide . default ldsR uses ldscores derived European subset 1000 Genomes.","code":"# example file, 100 000 rows to be lightweight. df <- arrow::read_parquet(system.file(\"extdata\", \"sumstats.parquet\", package = \"ldsR\")) tdf <- dplyr::rename(df, Z = Z.x, N = N.x) ldsc_h2(tdf) #> # A tibble: 1 × 6 #> h2 h2_se int int_se mean_chi2 lambda_gc #> #> 1 0.371 0.0358 1.09 0.0328 2.14 1.80"},{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"genetic-correlations","dir":"Articles","previous_headings":"","what":"Genetic correlations","title":"","text":"calculate genetic correlation two traits, pass data.frames ldsc_rg(). Note now five mandatory columns data.frame: SNP Z N A1 A2. A1 A2 required align direction Z value across two summary statistics. ldsc_rg() provides interface easily run make genetic correlations index trait. sumstats2 can provide list data.frames, ldsc_rg calculate genetic correlation summary statistic list. provide named list, names saved trait2 column.","code":"sumstat1 <- dplyr::rename(df, Z = Z.x, N = N.x) |> dplyr::mutate(A1 = \"A\", A2 = \"G\") sumstat2 <- dplyr::rename(df, Z = Z.y, N = N.y) |> dplyr::mutate(A1 = \"A\", A2 = \"G\") ldsc_rg(sumstat1, sumstat2) #> ! 0 SNPs were removed when merging summary statistics #> # A tibble: 1 × 14 #> trait2 rg rg_se h2_trait1 h2_trait_se h2_trait2 h2_trait2_se gcov gcov_se #> #> 1 1 0.734 0.0496 0.371 0.0358 0.0732 0.00685 0.121 0.0113 #> # ℹ 5 more variables: gcov_int , gcov_int_se , mean_z1z2 , #> # z , p sumstats <- list( \"trait1\" = sumstat2, \"trait2\" = sumstat2, \"trait4\" = sumstat2 ) ldsc_rg(sumstat1, sumstats) #> ! 0 SNPs were removed when merging summary statistics #> ⠙ 1/3 ETA: 3s | Computing genetic correlations... #> ! 0 SNPs were removed when merging summary statistics #> ⠙ 1/3 ETA: 3s | Computing genetic correlations... ! 0 SNPs were removed when merging summary statistics #> ⠙ 1/3 ETA: 3s | Computing genetic correlations... #> # A tibble: 3 × 14 #> trait2 rg rg_se h2_trait1 h2_trait_se h2_trait2 h2_trait2_se gcov gcov_se #> #> 1 trait1 0.734 0.0496 0.371 0.0358 0.0732 0.00685 0.121 0.0113 #> 2 trait2 0.734 0.0496 0.371 0.0358 0.0732 0.00685 0.121 0.0113 #> 3 trait4 0.734 0.0496 0.371 0.0358 0.0732 0.00685 0.121 0.0113 #> # ℹ 5 more variables: gcov_int , gcov_int_se , mean_z1z2 , #> # z , p "},{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"munge","dir":"Articles","previous_headings":"","what":"Munge","title":"","text":"munge() function can used mimic filters munge_sumstats.py file ldsc.","code":"munge(sumstat1) #> ! Removed 0 rows with duplicated RSIDs #> ! Removed 0 rows due to strand ambigious alleles #> ! Removed 0 rows with a sample size smaller than 87096 #> # A tibble: 100,000 × 5 #> SNP Z N A1 A2 #> #> 1 rs3094315 0.289 126849 A G #> 2 rs3131972 0.269 126849 A G #> 3 rs3131969 -0.074 126849 A G #> 4 rs1048488 0.273 126849 A G #> 5 rs3115850 0.263 126849 A G #> 6 rs2286139 0.034 126849 A G #> 7 rs12562034 0.346 118583 A G #> 8 rs4040617 0.13 127964 A G #> 9 rs2980300 -0.303 127964 A G #> 10 rs4970383 -2.37 114957 A G #> # ℹ 99,990 more rows"},{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"partitioned-heritability","dir":"Articles","previous_headings":"","what":"Partitioned heritability","title":"","text":"estimate partitioned heritability, partitioned_h2() available, requires ldscore_dir argument, directory containing partitioned ldscore files ld.parquet annot.parquet M50 M values. OBS, overlapping annotations, functionality adjust enrichment estimate yet implemented. Therefore enrichment estimate used.","code":"partitioned_h2( sumstat1, ldscore_dir = system.file(\"extdata\", \"baseline1.1_test\", package = \"ldsR\") ) #> ℹ Removed 449 rows after merging with weights #> ℹ Removed 5961 rows after merging with ldscores #> # A tibble: 4 × 8 #> annot coef coef_se enrich prop z tot tot_se #> #> 1 Conserved_LindbladToh.bedL2 8.54e-7 2.55e-7 18.2 0.0212 3.35 0.339 0.0380 #> 2 baseL2 2.65e-8 8.51e-9 0.563 0.827 3.12 0.339 0.0380 #> 3 H3K4me1_peaks_Trynka.bedL2 6.92e-8 4.66e-8 1.47 0.140 1.48 0.339 0.0380 #> 4 Coding_UCSC.bedL2 -2.28e-7 1.61e-7 -4.85 0.0118 -1.42 0.339 0.0380"},{"path":"http://arvidharder.com/ldsR/articles/ldsR.html","id":"cell-type-analysis","dir":"Articles","previous_headings":"","what":"Cell-type analysis","title":"","text":"Another common usage version partitioned heritability sometimes referred “cell-type analysis”. like estimate significance heritability enrichment specific set genomic locations (example specifically expressed genes neurons), adjusting another set annotations (genes, genes expressed brain, transcription factor binding sites etc). Typically, several different cell-types test. pass annotations model covariate_dir, ldscores cell-type ldscore_dir","code":"celltype_analysis( sumstat1, covariate_dir = system.file(\"extdata\", \"baseline1.1_test\", package = \"ldsR\"), ldscore_dir = system.file(\"extdata\", \"superclusters\", package = \"ldsR\") )"},{"path":"http://arvidharder.com/ldsR/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Arvid Harder. Maintainer.","code":""},{"path":"http://arvidharder.com/ldsR/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"harder (2024). ldsR: R implementation LDscore regression (LDSC). R package version 0.1.0, http://arvidharder.com/ldsR/, https://github.com/Ararder/ldsR.","code":"@Manual{, title = {ldsR: An R implementation of LDscore regression (LDSC)}, author = {Arvid harder}, year = {2024}, note = {R package version 0.1.0, http://arvidharder.com/ldsR/}, url = {https://github.com/Ararder/ldsR}, }"},{"path":"http://arvidharder.com/ldsR/index.html","id":"ldsr","dir":"","previous_headings":"","what":"An R implementation of LDscore regression (LDSC)","title":"An R implementation of LDscore regression (LDSC)","text":"core functions ldsc python package estimating heritability, intercept, genetic correlations partitioned heritability extremely common analysis genetic data. However, interface functions longer user friendly difficulties installation python 2.7 dependencies getting nessecary reference data. addition, R commonly used everyday tasks inspecting, munging working data, making time costly swap command line interface analysis takes seconds. introduce core ldsc algorithms rewritten R make common reference data available within R package making estimation genetic correlations, heritability, intercept partitioned heritabiliy easier ever. Compare code estimate heritability ldsc using command line interface ldsR: ldsR, ldscore data contained eur_w_ld_chr folder comes R package, core functions take seconds run modern computer.","code":"# NOTE that these links are no longer valid wget https://data.broadinstitute.org/alkesgroup/LDSCORE/eur_w_ld_chr.tar.bz2 wget https://data.broadinstitute.org/alkesgroup/LDSCORE/w_hm3.snplist.bz2 tar -jxvf eur_w_ld_chr.tar.bz2 unzip -o pgc.cross.scz.zip bunzip2 w_hm3.snplist.bz2 munge_sumstats.py \\ --sumstats pgc.cross.SCZ17.2013-05.txt \\ --N 17115 \\ --out scz \\ --merge-alleles w_hm3.snplist ldsc.py \\ --h2 scz.sumstats.gz \\ --ref-ld-chr eur_w_ld_chr/ \\ --w-ld-chr eur_w_ld_chr/ \\ --out scz library(ldsR) sumstats <- readr::read_tsv(\"my_sumstats.tsv\") |> munge() h2_res <- ldsc_h2(sumstats) # estimate rg with itself rg_est = ldsc_rg(sumstats, sumstats)"},{"path":"http://arvidharder.com/ldsR/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"An R implementation of LDscore regression (LDSC)","text":"can install development version ldsR GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"Ararder/ldsR\")"},{"path":"http://arvidharder.com/ldsR/reference/celltype_analysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Perform cell-type analysis using partitioned heritability — celltype_analysis","title":"Perform cell-type analysis using partitioned heritability — celltype_analysis","text":"common usage partitioned heritability estimate enrichment significance annotation typical specific cell-type. analysis, useful adjust baseline set annotations, estimate association large set annotations (\"cell-types\")","code":""},{"path":"http://arvidharder.com/ldsR/reference/celltype_analysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Perform cell-type analysis using partitioned heritability — celltype_analysis","text":"","code":"celltype_analysis(sumstat, covariate_dir, ldscore_dir, weights = NULL)"},{"path":"http://arvidharder.com/ldsR/reference/celltype_analysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Perform cell-type analysis using partitioned heritability — celltype_analysis","text":"sumstat dplyr::tibble() columns SNP, Z N covariate_dir directory containing files ld.parquet annot.parquet ldscore_dir filepath directory annot.parquet ldscores.parquet files weights Optional, data.frame tbl columns SNP, L2","code":""},{"path":"http://arvidharder.com/ldsR/reference/celltype_analysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Perform cell-type analysis using partitioned heritability — celltype_analysis","text":"dplyr::tibble()","code":""},{"path":"http://arvidharder.com/ldsR/reference/celltype_analysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Perform cell-type analysis using partitioned heritability — celltype_analysis","text":"","code":"if (FALSE) { # \\dontrun{ celltype_analysis(ss_tbl, \"/path/to_baseline\", \"path/to/celltype_ldscores\") } # }"},{"path":"http://arvidharder.com/ldsR/reference/ldsc_h2.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","title":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","text":"R implementation LD score regression method estimate SNP heritability, mimicking ldsc --h2 ldsc package. LDscores European subset 1000g (2015 release) 1,290,028 HapMap3 SNPs (1,173,569 SNPs freq > 5%) bundled within ldsR package used default. corresponds eur_w_ld_chr folder previously shared LDSC github. can inspect LDscores used default: arrow::read_parquet(system.file(\"extdata\", \"eur_w_ld.parquet\", package = \"ldsR\")) ldsc_h2 perform quality control input summary statistics, except merge 1,290,028 HapMap3 SNPs reference panel. See munge() function mimic munge_sumstats.py function.","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_h2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","text":"","code":"ldsc_h2(sumstat, weights = NULL, M = NULL, n_blocks = 200)"},{"path":"http://arvidharder.com/ldsR/reference/ldsc_h2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","text":"sumstat dplyr::tibble() columns SNP, Z N weights Optional, data.frame tbl columns SNP, L2 M Optional, number SNPs reference panel n_blocks Number blocks use jackknife estimator","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_h2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","text":"dplyr::tibble() columns h2 h2_se","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_h2.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Estimate SNP heritability using LDscore regression for a single annotation — ldsc_h2","text":"","code":"p <- system.file(\"extdata\", \"eur_w_ld.parquet\", package = \"ldsR\") snps <- arrow::read_parquet(p, col_select = c(\"SNP\")) snps$N <- 130000 snps$Z <- rnorm(nrow(snps)) ldsc_h2(snps) #> # A tibble: 1 × 6 #> h2 h2_se int int_se mean_chi2 lambda_gc #> #> 1 -0.000113 0.00110 1.00 0.00312 0.999 0.996"},{"path":"http://arvidharder.com/ldsR/reference/ldsc_rg.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the genetic correlation between two traits — ldsc_rg","title":"Compute the genetic correlation between two traits — ldsc_rg","text":"Compute genetic correlation two traits","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_rg.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the genetic correlation between two traits — ldsc_rg","text":"","code":"ldsc_rg(sumstats1, sumstats2, weights = NULL, M = NULL, n_blocks = 200)"},{"path":"http://arvidharder.com/ldsR/reference/ldsc_rg.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the genetic correlation between two traits — ldsc_rg","text":"sumstats1 dplyr::tibble() atleast columns SNP, A1, A2, Z, N. perform quality checks, use munge() running ldsc_rg() sumstats2 dplyr::tibble() atleast columns SNP, A1, A2, Z, N. estimate rG sumstats1 several traits, wrap data.frames list. names lost, column trait2 correspond index list. Use named list retain names trait2 column list(dataframe1, dataframe2, ...) weights Optional, data.frame tbl columns SNP, L2 M Optional, number SNPs reference panel n_blocks Number blocks use jackknife estimator","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_rg.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the genetic correlation between two traits — ldsc_rg","text":"dplyr::tibble()","code":""},{"path":"http://arvidharder.com/ldsR/reference/ldsc_rg.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute the genetic correlation between two traits — ldsc_rg","text":"","code":"path <- system.file(\"extdata\", \"eur_w_ld.parquet\", package = \"ldsR\") snps <- arrow::read_parquet(path, col_select = c(\"SNP\")) # to make example faster snps <- dplyr::slice_head(snps, n = 100000) snps$A1 <- \"A\" snps$A2 <- snps$N <- 130000 snps$Z <- rnorm(nrow(snps)) snps2 <- snps snps2$N <- 75000 snps2$Z <- rnorm(nrow(snps)) ldsc_rg(snps, snps2) #> ! 0 SNPs were removed when merging summary statistics #> Warning: NaNs produced #> Warning: NaNs produced #> # A tibble: 1 × 14 #> trait2 rg rg_se h2_trait1 h2_trait_se h2_trait2 h2_trait2_se gcov #> #> 1 1 NaN NA 0.000682 0.00392 -0.00572 0.00633 0.000787 #> # ℹ 6 more variables: gcov_se , gcov_int , gcov_int_se , #> # mean_z1z2 , z , p # to run estimate the genetic correlations for many traits, wrap s2 in a list # ldsc_rg(snps, list(snps2, snps2)) # use a named list to create the `trait2` column in the output # ldsc_rg(snps, list(\"trait2\" = s2, \"trait3\" = s3, \"trait4\" = s4))"},{"path":"http://arvidharder.com/ldsR/reference/munge.html","id":null,"dir":"Reference","previous_headings":"","what":"Munge GWAS summary statistics — munge","title":"Munge GWAS summary statistics — munge","text":"Munge GWAS summary statistics","code":""},{"path":"http://arvidharder.com/ldsR/reference/munge.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Munge GWAS summary statistics — munge","text":"","code":"munge(dset, info_filter = 0.9, maf_filter = 0.01)"},{"path":"http://arvidharder.com/ldsR/reference/munge.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Munge GWAS summary statistics — munge","text":"dset dplyr::tibble() columns SNP, A1 A2 Z N possibly EAF INFO info_filter INFO score filter threshold remove rows maf_filter Minor allele frequenc filter remove rows","code":""},{"path":"http://arvidharder.com/ldsR/reference/munge.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Munge GWAS summary statistics — munge","text":"data.frame","code":""},{"path":"http://arvidharder.com/ldsR/reference/munge.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Munge GWAS summary statistics — munge","text":"","code":"if (FALSE) { # \\dontrun{ parse_gwas(tbl) } # }"},{"path":"http://arvidharder.com/ldsR/reference/partitioned_h2.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate partitioned SNP heritability — partitioned_h2","title":"Estimate partitioned SNP heritability — partitioned_h2","text":"R implementation LD score regression method estimate SNP heritability, mimicking ldsc --h2 ldsc package. partitioned heritablity, noMHC weights used instead eur_w_ld_chr weights. can inspect LDscores used default, column L2_celltype arrow::read_parquet(system.file(\"extdata\", \"eur_w_ld.parquet\", package = \"ldsR\")) partitioned_heritability perform quality control input summary statistics, except merge SNPs reference panel. See munge() function mimic munge_sumstats.py function.","code":""},{"path":"http://arvidharder.com/ldsR/reference/partitioned_h2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate partitioned SNP heritability — partitioned_h2","text":"","code":"partitioned_h2(sumstat, ldscore_dir, weights = NULL, n_blocks = 200)"},{"path":"http://arvidharder.com/ldsR/reference/partitioned_h2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate partitioned SNP heritability — partitioned_h2","text":"sumstat dplyr::tibble() columns SNP, Z N ldscore_dir filepath directory annot.parquet ldscores.parquet files weights Optional, data.frame tbl columns SNP, L2 n_blocks Number blocks use jackknife estimator","code":""},{"path":"http://arvidharder.com/ldsR/reference/partitioned_h2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate partitioned SNP heritability — partitioned_h2","text":"dplyr::tibble()","code":""},{"path":"http://arvidharder.com/ldsR/reference/partitioned_h2.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Estimate partitioned SNP heritability — partitioned_h2","text":"","code":"if (FALSE) { # \\dontrun{ partitioned_heritability(sumstats, \"path/to_dir/\") } # }"}]
diff --git a/sitemap.xml b/sitemap.xml
index 26899cf..34bfeeb 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -10,7 +10,6 @@
http://arvidharder.com/ldsR/reference/ldsc_h2.html
http://arvidharder.com/ldsR/reference/ldsc_rg.html
http://arvidharder.com/ldsR/reference/munge.html
-http://arvidharder.com/ldsR/reference/parse_gwas.html
http://arvidharder.com/ldsR/reference/partitioned_h2.html