@@ -11,7 +11,7 @@
Loading
11 11
	stopifnot(is.data.frame(x))
12 12
	names(x) <- paste0(names(x), ".", type)
13 13
	nom <- names(x)
14 -
	names(x)[nom == paste0("name.", type)] <- "SNP"
14 +
	names(x)[nom == paste0("rsid.", type)] <- "SNP"
15 15
	names(x)[nom == paste0("ea.", type)] <- paste0("effect_allele.", type)
16 16
	names(x)[nom == paste0("nea.", type)] <- paste0("other_allele.", type)
17 17
	names(x)[nom == paste0("eaf.", type)] <- paste0("eaf.", type)

@@ -16,21 +16,21 @@
Loading
16 16
	rsid <- ieugwasr::variants_to_rsid(region)
17 17
	message("Extracting rsids from data")
18 18
	as <- ieugwasr::associations(rsid, id, proxies=0)
19 -
	rsid_avail <- unique(as$name)
19 +
	rsid_avail <- unique(as$rsid)
20 20
	message("Calculating LD for ", length(rsid_avail), " variants")
21 21
	ld <- suppressWarnings(ieugwasr::ld_matrix(rsid_avail, bfile, plink_bin, with_alleles=FALSE)) %>% greedy_remove()
22 22
	rsid_avail <- rownames(ld)
23 23
	message("Data available for ", length(rsid_avail), " variants")
24 -
	as <- subset(as, name %in% rsid_avail)
24 +
	as <- subset(as, rsid %in% rsid_avail)
25 25
	out <- list()
26 26
	for(i in 1:length(unique(id)))
27 27
	{
28 28
		dat <- list()
29 -
		x <- as[as[["name"]] %in% rsid_avail & as[["id"]] == id[i],]
30 -
		dat[["z"]] <- dplyr::tibble(snp = x[["name"]], zscore = x[["beta"]] / x[["se"]])
31 -
		index <- match(x[["name"]], rsid_avail)
29 +
		x <- as[as[["rsid"]] %in% rsid_avail & as[["id"]] == id[i],]
30 +
		dat[["z"]] <- dplyr::tibble(snp = x[["rsid"]], zscore = x[["beta"]] / x[["se"]])
31 +
		index <- match(x[["rsid"]], rsid_avail)
32 32
		dat[["ld"]] <- ld[index, index]
33 -
		stopifnot(all(x[["name"]] == rownames(dat[["ld"]])))
33 +
		stopifnot(all(x[["rsid"]] == rownames(dat[["ld"]])))
34 34
35 35
		n <- x[["n"]]
36 36
		if(all(is.na(n)))

@@ -10,29 +10,27 @@
Loading
10 10
ieugwasr_to_gassocplot <- function(chrpos, id)
11 11
{
12 12
	stopifnot(length(chrpos) == 1)
13 -
	message("Getting regional variants for ", chrpos)
14 -
	variants <- variants_chrpos(chrpos)
15 -
	message("Extracting ", nrow(variants), " variants from the following datasets:\n", paste(id, collapse="\n"))
16 -
	r1 <- associations(variants[["name"]], id, proxies=0)
17 -
	r1 <- dplyr::left_join(r1, variants, by="name")
18 -
	r1 <- r1[!duplicated(paste(r1[["name"]], r1[["id"]])),]
13 +
	r1 <- ieugwasr::associations(chrpos, id, proxies=0)
14 +
	r1 <- r1[!duplicated(paste(r1[["rsid"]], r1[["id"]])),]
19 15
	r1[["z"]] <- r1[["beta"]] / r1[["se"]]
20 -
	r1 <- tidyr::spread(subset(r1, select=c("name", "id", "z", "chr", "pos")), key="id", value="z")
16 +
	r1 <- tidyr::spread(subset(r1, select=c("rsid", "id", "z", "chr", "position")), key="id", value="z")
21 17
	message("Found ", nrow(r1), " variants")
22 18
	message("Extracting LD matrix for ", nrow(r1), " variants")
23 -
	ld <- suppressWarnings(suppressMessages(ld_matrix(r1$name, with_alleles=FALSE)))
19 +
	ld <- suppressWarnings(suppressMessages(
20 +
		ieugwasr::ld_matrix(r1[["rsid"]], with_alleles=FALSE)
21 +
	))
24 22
	message("Found ", nrow(ld), " variants in LD reference panel")
25 -
	r1 <- r1[match(rownames(ld), r1$name), ]
26 -
	stopifnot(all(r1$name == rownames(ld)))
23 +
	r1 <- r1[match(rownames(ld), r1[["rsid"]]), ]
24 +
	stopifnot(all(r1[["rsid"]] == rownames(ld)))
27 25
	if(length(id) == 1)
28 26
	{
29 27
		list(
30 -
			data = dplyr::tibble(marker=r1$name, chr=r1$chr, pos=r1$pos, z=r1[[id]]),
28 +
			data = dplyr::tibble(marker=r1[["rsid"]], chr=r1[["chr"]], pos=r1[["position"]], z=r1[[id]]),
31 29
			corr = ld
32 30
		) %>% return()
33 31
	} else {
34 32
		list(
35 -
			markers = dplyr::tibble(marker=r1$name, chr=r1$chr, pos=r1$pos),
33 +
			markers = dplyr::tibble(marker=r1[["rsid"]], chr=r1[["chr"]], pos=r1[["position"]]),
36 34
			z = subset(r1, select=id),
37 35
			corr = ld,
38 36
			traits = id
Files Coverage
R 34.10%
Project Totals (5 files) 34.10%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading