diff --git a/DESCRIPTION b/DESCRIPTION index 71e2d74..1368c5e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Encoding: UTF-8 Package: bigsnpr Type: Package Title: Analysis of Massive SNP Arrays -Version: 1.12.14 -Date: 2024-09-10 +Version: 1.12.15 +Date: 2024-09-20 Authors@R: c( person("Florian", "Privé", email = "florian.prive.21@gmail.com", role = c("aut", "cre")), person("Michael", "Blum", role = "ths"), diff --git a/R/apply-parallelize.R b/R/apply-parallelize.R index e01caa0..7cd5ca5 100644 --- a/R/apply-parallelize.R +++ b/R/apply-parallelize.R @@ -10,10 +10,10 @@ #' #' @inheritParams bigsnpr-package #' @param FUN The function to be applied. It must take a -#' [FBM.code256][FBM.code256-class] as first argument and `ind.chr`, +#' [FBM.code256][bigstatsr::FBM.code256-class] as first argument and `ind.chr`, #' an another argument to provide subsetting over SNPs. #' You can access the number of the chromosome by using `attr(ind.chr, "chr")`. -#' @param combine function that is used by [foreach] to process the tasks +#' @param combine function that is used by [foreach::foreach] to process the tasks #' results as they generated. This can be specified as either a function or a #' non-empty character string naming the function. Specifying 'c' is useful #' for concatenating the results into a vector, for example. The values 'cbind' diff --git a/R/bigSNP-class.R b/R/bigSNP-class.R index 44f5aa1..a13fd82 100644 --- a/R/bigSNP-class.R +++ b/R/bigSNP-class.R @@ -19,7 +19,7 @@ CODE_DOSAGE <- c(0, 1, 2, NA, 0, 1, 2, seq(0, 2, by = 0.01), rep(NA, 48)) #' An S3 class for representing information on massive SNP arrays. #' #' @return A named list with at least 3 slots: \describe{ -#' \item{genotypes}{A [FBM.code256][FBM.code256-class] which is +#' \item{genotypes}{A [FBM.code256][bigstatsr::FBM.code256-class] which is #' a special Filebacked Big Matrix encoded with type `raw` (one byte #' unsigned integer), representing genotype calls and possibly imputed #' allele dosages. Rows are individuals and columns are SNPs.} diff --git a/R/external-software.R b/R/external-software.R index 4d617ed..ae548ac 100644 --- a/R/external-software.R +++ b/R/external-software.R @@ -601,7 +601,7 @@ snp_plinkKINGQC <- function(plink2.path, #' @param plink.options Other options to be passed to PLINK as a string. More #' options can be found at \url{https://www.cog-genomics.org/plink2/filter}. #' @param ncores Number of cores used. Default doesn't use parallelism. -#' You may use [nb_cores]. +#' You may use [bigstatsr::nb_cores()]. #' #' @references Browning, Brian L., and Sharon R. Browning. #' "Genotype imputation with millions of reference samples." diff --git a/R/ldsc.R b/R/ldsc.R index fb5dab9..0b97994 100644 --- a/R/ldsc.R +++ b/R/ldsc.R @@ -173,7 +173,6 @@ snp_ldsc <- function(ld_score, ld_size, chi2, sample_size, #' when using a mixed model, the effective sample size needs to be adjusted #' as well, see \doi{10.1016/j.xhgg.2022.100136}. #' @param ind.beta Indices in `corr` corresponding to `df_beta`. Default is all. -#' @inheritDotParams snp_ldsc chi2_thr1 chi2_thr2 #' #' @export #' @@ -195,7 +194,8 @@ snp_ldsc2 <- function(corr, df_beta, intercept = 1, ncores = 1, ind.beta = cols_along(corr), - ...) { + chi2_thr1 = 30, + chi2_thr2 = Inf) { assert_df_with_names(df_beta, c("beta", "beta_se", "n_eff")) assert_lengths(ind.beta, rows_along(df_beta)) @@ -218,7 +218,8 @@ snp_ldsc2 <- function(corr, df_beta, blocks = blocks, intercept = intercept, ncores = ncores, - ... + chi2_thr1 = chi2_thr1, + chi2_thr2 = chi2_thr2 ) } diff --git a/R/modify-positions.R b/R/modify-positions.R index 24e0afe..713bd68 100644 --- a/R/modify-positions.R +++ b/R/modify-positions.R @@ -163,16 +163,19 @@ snp_asGeneticPos <- function(infos.chr, infos.pos, dir = tempdir(), ncores = 1, #' Download a genetic map #' -#' @param type Which genetic map to download. The hg19 ones are downloaded from -#' \url{https://github.com/joepickrell/1000-genomes-genetic-maps/} while the -#' hg38 is downloaded from -#' \url{https://alkesgroup.broadinstitute.org/Eagle/downloads/tables/}. +#' @param type Which genetic map to download. #' @param dir Directory where to download and decompress files. #' @inheritParams bigsnpr-package #' #' @return A data frame with 3 columns: `chr`, `pos`, and `pos_cM`. #' @export #' +#' @details +#' The hg19 genetic maps are downloaded from +#' \url{https://github.com/joepickrell/1000-genomes-genetic-maps/} +#' while the hg38 one is downloaded from +#' `https://alkesgroup.broadinstitute.org/Eagle/downloads/tables/`. +#' #' @rdname snp_asGeneticPos2 #' download_genetic_map <- function(type = c("hg19_OMNI", "hg19_hapmap", "hg38_price"), diff --git a/R/read-bgen.R b/R/read-bgen.R index 56b9db5..cf7366e 100644 --- a/R/read-bgen.R +++ b/R/read-bgen.R @@ -122,7 +122,7 @@ check_bgen_format <- function(bgenfile) { #' file, and use e.g. `match()` to get indices corresponding to the ones you want. #' #' @param ncores Number of cores used. Default doesn't use parallelism. -#' You may use [nb_cores()]. +#' You may use [bigstatsr::nb_cores()]. #' @param read_as How to read BGEN probabilities? Currently implemented: #' - as dosages (rounded to two decimal places), the default, #' - as hard calls, randomly sampled based on those probabilities diff --git a/man/bigSNP-class.Rd b/man/bigSNP-class.Rd index 911900e..f528494 100644 --- a/man/bigSNP-class.Rd +++ b/man/bigSNP-class.Rd @@ -6,7 +6,7 @@ \title{Class bigSNP} \value{ A named list with at least 3 slots: \describe{ -\item{genotypes}{A \link[=FBM.code256-class]{FBM.code256} which is +\item{genotypes}{A \link[bigstatsr:FBM.code256-class]{FBM.code256} which is a special Filebacked Big Matrix encoded with type \code{raw} (one byte unsigned integer), representing genotype calls and possibly imputed allele dosages. Rows are individuals and columns are SNPs.} diff --git a/man/snp_asGeneticPos2.Rd b/man/snp_asGeneticPos2.Rd index 029b8a3..34c9a5b 100644 --- a/man/snp_asGeneticPos2.Rd +++ b/man/snp_asGeneticPos2.Rd @@ -14,10 +14,7 @@ download_genetic_map( snp_asGeneticPos2(infos.chr, infos.pos, genetic_map) } \arguments{ -\item{type}{Which genetic map to download. The hg19 ones are downloaded from -\url{https://github.com/joepickrell/1000-genomes-genetic-maps/} while the -hg38 is downloaded from -\url{https://alkesgroup.broadinstitute.org/Eagle/downloads/tables/}.} +\item{type}{Which genetic map to download.} \item{dir}{Directory where to download and decompress files.} @@ -43,3 +40,9 @@ The new vector of genetic positions. This function uses linear interpolation, whereas \code{snp_asGeneticPos()} uses nearest neighbors. } +\details{ +The hg19 genetic maps are downloaded from +\url{https://github.com/joepickrell/1000-genomes-genetic-maps/} +while the hg38 one is downloaded from +\verb{https://alkesgroup.broadinstitute.org/Eagle/downloads/tables/}. +} diff --git a/man/snp_beagleImpute.Rd b/man/snp_beagleImpute.Rd index 34bec9a..af37d3a 100644 --- a/man/snp_beagleImpute.Rd +++ b/man/snp_beagleImpute.Rd @@ -30,7 +30,7 @@ appending \code{"_impute"} to \code{prefix.in} (\code{bedfile.in} without extens to be an integer. Default is \code{3}.} \item{ncores}{Number of cores used. Default doesn't use parallelism. -You may use \link{nb_cores}.} +You may use \code{\link[bigstatsr:reexports]{bigstatsr::nb_cores()}}.} \item{extra.options}{Other options to be passed to Beagle as a string. More options can be found at Beagle's website.} diff --git a/man/snp_ldsc.Rd b/man/snp_ldsc.Rd index d654821..5231e4e 100644 --- a/man/snp_ldsc.Rd +++ b/man/snp_ldsc.Rd @@ -24,7 +24,8 @@ snp_ldsc2( intercept = 1, ncores = 1, ind.beta = cols_along(corr), - ... + chi2_thr1 = 30, + chi2_thr2 = Inf ) } \arguments{ @@ -72,12 +73,6 @@ as well, see \doi{10.1016/j.xhgg.2022.100136}. }} \item{ind.beta}{Indices in \code{corr} corresponding to \code{df_beta}. Default is all.} - -\item{...}{ - Arguments passed on to \code{\link[=snp_ldsc]{snp_ldsc}} - \describe{ - \item{\code{}}{} - }} } \value{ Vector of 4 values (or only the first 2 if \code{blocks = NULL}): diff --git a/man/snp_prodBGEN.Rd b/man/snp_prodBGEN.Rd index 9b1142e..a155a7b 100644 --- a/man/snp_prodBGEN.Rd +++ b/man/snp_prodBGEN.Rd @@ -45,7 +45,7 @@ file, and use e.g. \code{match()} to get indices corresponding to the ones you w Default is \code{1000}.} \item{ncores}{Number of cores used. Default doesn't use parallelism. -You may use \code{\link[=nb_cores]{nb_cores()}}.} +You may use \code{\link[bigstatsr:reexports]{bigstatsr::nb_cores()}}.} } \value{ The product \code{bgen_data[ind_row, 'list_snp_id'] \%*\% beta}. diff --git a/man/snp_readBGEN.Rd b/man/snp_readBGEN.Rd index e46db43..75b91ae 100644 --- a/man/snp_readBGEN.Rd +++ b/man/snp_readBGEN.Rd @@ -43,7 +43,7 @@ file, and use e.g. \code{match()} to get indices corresponding to the ones you w }} \item{ncores}{Number of cores used. Default doesn't use parallelism. -You may use \code{\link[=nb_cores]{nb_cores()}}.} +You may use \code{\link[bigstatsr:reexports]{bigstatsr::nb_cores()}}.} } \value{ The path to the RDS file \verb{.rds} that stores the \code{bigSNP} diff --git a/man/snp_split.Rd b/man/snp_split.Rd index 6e3bde6..87aeb47 100644 --- a/man/snp_split.Rd +++ b/man/snp_split.Rd @@ -11,11 +11,11 @@ snp_split(infos.chr, FUN, combine, ncores = 1, ...) Typically \verb{$map$chromosome}.} \item{FUN}{The function to be applied. It must take a -\link[=FBM.code256-class]{FBM.code256} as first argument and \code{ind.chr}, +\link[bigstatsr:FBM.code256-class]{FBM.code256} as first argument and \code{ind.chr}, an another argument to provide subsetting over SNPs. You can access the number of the chromosome by using \code{attr(ind.chr, "chr")}.} -\item{combine}{function that is used by \link{foreach} to process the tasks +\item{combine}{function that is used by \link[foreach:foreach]{foreach::foreach} to process the tasks results as they generated. This can be specified as either a function or a non-empty character string naming the function. Specifying 'c' is useful for concatenating the results into a vector, for example. The values 'cbind'