Skip to content

Commit bac8eed

Browse files
committed
minor changes + versioning
1 parent d0fd598 commit bac8eed

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Encoding: UTF-8
22
Package: bigsnpr
33
Type: Package
44
Title: Analysis of Massive SNP Arrays
5-
Version: 1.12.6
6-
Date: 2023-10-18
5+
Version: 1.12.7
6+
Date: 2024-04-17
77
Authors@R: c(
88
person("Florian", "Privé", email = "[email protected]", role = c("aut", "cre")),
99
person("Michael", "Blum", role = "ths"),

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## bigsnpr 1.12.7
2+
3+
- In function `snp_modifyBuild()`, fix a ftp broken link, and add the possibility to use a local chain file specified by the new parameter `local_file`.
4+
15
## bigsnpr 1.12.6
26

37
- Fix issue with `snp_subset()` when either `$fam` or `$map` are missing.

R/modify-positions.R

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#' @param to Genome build to convert to. Default is `hg19`.
1515
#' @param check_reverse Whether to discard positions for which we cannot go back
1616
#' to initial values by doing 'from -> to -> from'. Default is `TRUE`.
17+
#' @param local_chain Local chain file (e.g. `hg18ToHg19.over.chain.gz`) to use
18+
#' instead of downloading one from parameters `from` and `to` (the default).
19+
#' You can download one such file from e.g.
20+
#' \url{https://hgdownload.soe.ucsc.edu/goldenPath/hg18/liftOver/}.
1721
#'
1822
#' @references
1923
#' Hinrichs, Angela S., et al. "The UCSC genome browser database: update 2006."
@@ -25,7 +29,7 @@
2529
snp_modifyBuild <- function(info_snp, liftOver,
2630
from = "hg18", to = "hg19",
2731
check_reverse = TRUE,
28-
local.chain = NULL) {
32+
local_chain = NULL) {
2933

3034
if (!all(c("chr", "pos") %in% names(info_snp)))
3135
stop2("Expecting variables 'chr' and 'pos' in input 'info_snp'.")
@@ -45,16 +49,15 @@ snp_modifyBuild <- function(info_snp, liftOver,
4549
BED, col.names = FALSE, sep = " ", scipen = 50)
4650

4751
# Need chain file
48-
if (is.null(local.chain) || !file.exists(local.chain)) {
52+
if (is.null(local_chain)) {
4953
url <- paste0("https://hgdownload.soe.ucsc.edu/goldenPath/", from, "/liftOver/",
5054
from, "To", tools::toTitleCase(to), ".over.chain.gz")
51-
message(paste0("Downloading from ", url))
52-
local.chain <- tempfile(fileext = ".over.chain.gz")
53-
utils::download.file(url, destfile = local.chain, quiet = TRUE)
55+
chain <- tempfile(fileext = ".over.chain.gz")
56+
utils::download.file(url, destfile = chain, quiet = TRUE)
5457
} else {
55-
message("Using the local chain file")
58+
assert_exist(local_chain)
59+
chain <- local_chain
5660
}
57-
chain <- local.chain
5861

5962
# Run liftOver (usage: liftOver oldFile map.chain newFile unMapped)
6063
lifted <- tempfile(fileext = ".BED")

docs/news/index.html

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/snp_modifyBuild.Rd

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)