Skip to content

Commit 06fb5e5

Browse files
committed
push fixes
1 parent edfcc82 commit 06fb5e5

35 files changed

+133
-156
lines changed

.github/workflows/check-bioc-docker.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ jobs:
9494
# which is only available with Linux as the OS.
9595
- name: Setup R from r-lib
9696
if: runner.os != 'Linux'
97-
uses: r-lib/actions/setup-r@master
97+
uses: r-lib/actions/setup-r@v2
9898
with:
9999
r-version: ${{ matrix.config.r }}
100100
http-user-agent: ${{ matrix.config.http-user-agent }}
101101

102102
## pandoc is already included in the Bioconductor docker images
103103
- name: Setup pandoc from r-lib
104104
if: runner.os != 'Linux'
105-
uses: r-lib/actions/setup-pandoc@master
105+
uses: r-lib/actions/setup-pandoc@v2
106106

107107
- name: Query dependencies
108108
run: |
@@ -362,7 +362,7 @@ jobs:
362362

363363
- name: Upload check results
364364
if: failure()
365-
uses: actions/upload-artifact@master
365+
uses: actions/upload-artifact@v2
366366
with:
367367
name: ${{ runner.os }}-biocversion-${{ matrix.config.bioc }}-r-${{ matrix.config.r }}-results
368368
path: check

DESCRIPTION

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: echoLD
22
Type: Package
33
Title: echoverse module: LD downloading and processing
4-
Version: 0.99.7
4+
Version: 0.99.8
55
Authors@R:
66
c(person(given = "Brian",
77
family = "Schilder",
@@ -31,12 +31,12 @@ Imports:
3131
echotabix,
3232
downloadR,
3333
echodata,
34+
echoconda,
3435
dplyr,
3536
methods,
3637
Matrix,
3738
data.table,
38-
reticulate,
39-
GenomeInfoDb,
39+
reticulate,
4040
GenomicRanges,
4141
VariantAnnotation,
4242
snpStats,
@@ -58,7 +58,8 @@ Suggests:
5858
Remotes:
5959
github::RajLabMSSM/echotabix,
6060
github::RajLabMSSM/downloadR,
61-
github::RajLabMSSM/echodata
61+
github::RajLabMSSM/echodata,
62+
github::RajLabMSSM/echoconda
6263
RoxygenNote: 7.2.1.9000
6364
VignetteBuilder: knitr
6465
License: GPL (>= 3)

NAMESPACE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export(get_LD)
55
export(get_LD_blocks)
66
export(get_LD_matrix)
77
export(get_LD_vcf)
8-
export(get_UKB_MAF)
8+
export(get_MAF_UKB)
99
export(get_lead_r2)
1010
export(plot_LD)
1111
export(r2_to_r)
@@ -24,7 +24,6 @@ importFrom(data.table,fread)
2424
importFrom(data.table,merge.data.table)
2525
importFrom(downloadR,downloader)
2626
importFrom(downloadR,load_rdata)
27-
importFrom(dplyr,"%>%")
2827
importFrom(dplyr,group_by)
2928
importFrom(dplyr,mutate)
3029
importFrom(dplyr,rename)

NEWS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# echoLD 0.99.8
2+
3+
## New features
4+
5+
* `get_UKB_MAF` --> `get_MAF_UKB`
6+
* `get_LD_UKB`:
7+
- New subfunction `load_ld_r``tryFun`:
8+
- Remove `tryFun` function.
9+
10+
## Bug fixes
11+
12+
* Added `echoconda` to *Remotes*: `github::RajLabMSSM/echoconda`
13+
* Remote `GenomeInfoDb` Import (no longer used here).
14+
* Fix GHA: @master --> @v2
15+
* Fix `saveSparse` example.
16+
* Fix `filter_LD` unit test.
17+
* Fix `download_UKB_LD`: Update `downloadR::downloader` arg
18+
from `output_path` --> `output_dir`
19+
120
# echoLD 0.99.7
221

322
## New features

R/download_UKB_LD.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ download_UKB_LD <- function(LD.prefixes,
2929
out.file <- downloadR::downloader(
3030
input_url = furl,
3131
download_method = download_method,
32-
output_path = file.path(locus_dir, "LD"),
32+
output_dir = file.path(locus_dir, "LD"),
3333
background = background,
3434
conda_env = conda_env,
3535
nThread = nThread,

R/get_LD.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ get_LD <- function(query_dat,
8787
conda_env = "echoR_mini",
8888
nThread = 1) {
8989

90-
# echoverseTemplate:::source_all();
91-
# echoverseTemplate:::args2vars(get_LD)
90+
# echoverseTemplate:::source_all();
91+
# echoverseTemplate:::args2vars(echoLD:::get_LD)
9292

9393
LD_reference <- LD_reference[1]
9494
LD_ref_type <- LD_reference_options(LD_reference = LD_reference,
@@ -109,7 +109,7 @@ get_LD <- function(query_dat,
109109
LD_list <- read_LD_list(LD_path=RDS_path,
110110
query_dat=query_dat,
111111
verbose=verbose)
112-
} else if (LD_ref_type == "ukb") {
112+
} else if (LD_ref_type=="ukb") {
113113
#### UK Biobank ####
114114
LD_list <- get_LD_UKB(
115115
query_dat = query_dat,

R/get_LD_1KG.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ get_LD_1KG <- function(locus_dir,
2727
local_storage = NULL,
2828
leadSNP_LD_block = FALSE,
2929
force_new = FALSE,
30-
force_new_MAF = FALSE,
30+
force_new_maf = FALSE,
3131
fillNA = 0,
3232
stats = "R",
3333
as_sparse = TRUE,
@@ -65,7 +65,7 @@ get_LD_1KG <- function(locus_dir,
6565
query_dat <- snpstats_get_MAF(
6666
query_dat = query_dat,
6767
ss = ss,
68-
force_new_MAF = force_new_MAF,
68+
force_new_maf = force_new_maf,
6969
verbose = verbose
7070
)
7171
#### Filter out SNPs not in the same LD block as the lead SNP ####

R/get_LD_UKB.R

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,9 @@ get_LD_UKB <- function(query_dat,
133133
URL <- paste(URL, LD.prefixes, sep="/")
134134
messager("Importing UKB LD file directly to R from:",v = verbose)
135135
}
136-
#### Import LD via python function ####
137-
reticulate::source_python(
138-
system.file("tools", "load_ld.py",package = "echoLD"
139-
))
140-
messager("load_ld() python function input:",URL,v = verbose)
141-
messager("Reading LD matrix into memory.",
142-
"This could take some time...",v = verbose)
143-
server <- FALSE
144-
ld.out <- tryFunc(input = URL, load_ld, server)
136+
#### Import LD via python function ####
137+
ld.out <- load_ld_r(URL=URL,
138+
verbose=verbose)
145139
#### LD matrix: as matrix ####
146140
ld_R <- ld.out[[1]]
147141
messager("+ Full UKB LD matrix:",
@@ -161,7 +155,7 @@ get_LD_UKB <- function(query_dat,
161155
if (is.null(colnames(ld_R))) colnames(ld_R) <- ld_snps$rsid
162156
#### As a last resort download UKB MAF ####
163157
if (!"MAF" %in% colnames(query_dat)) {
164-
query_dat<- get_UKB_MAF(
158+
query_dat<- get_MAF_UKB(
165159
query_dat = query_dat,
166160
nThread = nThread,
167161
download_method = download_method,

R/get_LD_vcf.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#' @param fillNA When pairwise LD between two SNPs is \code{NA},
88
#' replace with 0.
99
#' @inheritParams get_LD
10+
#' @inheritParams get_MAF_UKB
1011
#' @inheritParams echotabix::query_vcf
1112
#' @inheritParams echotabix::query
1213
#' @inheritParams snpStats::ld
@@ -36,7 +37,7 @@ get_LD_vcf <- function(locus_dir = tempdir(),
3637
overlapping_only = TRUE,
3738
leadSNP_LD_block = FALSE,
3839
force_new = FALSE,
39-
force_new_MAF = FALSE,
40+
force_new_maf = FALSE,
4041
fillNA = 0,
4142
stats = "R",
4243
as_sparse = TRUE,
@@ -71,7 +72,7 @@ get_LD_vcf <- function(locus_dir = tempdir(),
7172
query_dat <- snpstats_get_MAF(
7273
query_dat = query_dat,
7374
ss = ss,
74-
force_new_MAF = force_new_MAF,
75+
force_new_maf = force_new_maf,
7576
verbose = verbose
7677
)
7778
#### Filter out SNPs not in the same LD block as the lead SNP ####

R/get_UKB_MAF.R renamed to R/get_MAF_UKB.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' download MAF from UK Biobank and use that instead.
55
#'
66
#' @param query_dat SNP-level data.
7-
#' @param output_path Path to store UKB_MAF file in.
7+
#' @param output_dir Path to store UKB_MAF file in.
88
#' @param force_new_maf Download UKB_MAF file again.
99
#' @param verbose Print messages.
1010
#' @inheritParams downloadR::downloader
@@ -13,17 +13,17 @@
1313
#' @source \href{http://biobank.ctsu.ox.ac.uk/showcase/field.cgi?id=22801}{UKB}
1414
#' @export
1515
#' @importFrom data.table fread merge.data.table data.table
16-
#' @importFrom dplyr %>% group_by slice rename
16+
#' @importFrom dplyr group_by slice rename
1717
#' @importFrom tools R_user_dir
1818
#' @importFrom downloadR downloader
1919
#'
2020
#' @examples
2121
#' query_dat<- echodata::BST1
2222
#' query_dat$MAF <- NULL
23-
#' dat2 <- echoLD::get_UKB_MAF(query_dat = query_dat)
24-
get_UKB_MAF <- function(query_dat,
25-
output_path = tools::R_user_dir(package = "echoLD",
26-
which = "cache"),
23+
#' dat2 <- echoLD::get_MAF_UKB(query_dat = query_dat)
24+
get_MAF_UKB <- function(query_dat,
25+
output_dir = tools::R_user_dir(package = "echoLD",
26+
which = "cache"),
2727
force_new_maf = FALSE,
2828
download_method = "axel",
2929
nThread = 1,
@@ -41,10 +41,10 @@ get_UKB_MAF <- function(query_dat,
4141
),
4242
chrom, "_v3.txt"
4343
)
44-
out_file <- file.path(output_path, basename(input_url))
44+
out_file <- file.path(output_dir, basename(input_url))
4545
if (file.exists(out_file)) {
4646
if (file.size(out_file) == 0) {
47-
messager("+ UKB MAF:: Removing empty UKB MAF ref file.")
47+
messager("+ UKB MAF:: Removing empty UKB MAF ref file.",v=verbose)
4848
file.remove(out_file)
4949
}
5050
}
@@ -53,7 +53,7 @@ get_UKB_MAF <- function(query_dat,
5353
} else {
5454
out_file <- downloadR::downloader(
5555
input_url = input_url,
56-
output_path = output_path,
56+
output_dir = output_dir,
5757
background = FALSE,
5858
force_overwrite = force_new_maf,
5959
download_method = download_method,
@@ -76,10 +76,10 @@ get_UKB_MAF <- function(query_dat,
7676
}
7777
merged_dat <- data.table::merge.data.table(query_dat, maf,
7878
by = "POS"
79-
) %>%
79+
) |>
8080
# Make sure each SNP just appears once
81-
dplyr::group_by(SNP) %>%
82-
dplyr::slice(1) %>%
81+
dplyr::group_by(SNP) |>
82+
dplyr::slice(1) |>
8383
data.table::data.table()
8484
return(merged_dat)
8585
}

0 commit comments

Comments
 (0)