Skip to content

Commit

Permalink
improve doc
Browse files Browse the repository at this point in the history
  • Loading branch information
privefl committed Mar 31, 2024
1 parent 41b086f commit 94b1058
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
30 changes: 16 additions & 14 deletions R/read-bgen.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ check_bgen_format <- function(bgenfile) {
#' Function to read the UK Biobank BGEN files into a [bigSNP][bigSNP-class].
#'
#' For more information on this format, please visit
#' \href{https://bitbucket.org/gavinband/bgen/}{BGEN webpage}.
#' \href{https://code.enkre.net/bgen}{BGEN webpage}.
#'
#' This function is designed to read UK Biobank imputation files. This assumes
#' that variants have been compressed with zlib, that there are only 2 possible
Expand All @@ -110,11 +110,11 @@ check_bgen_format <- function(bgenfile) {
#' @param backingfile The path (without extension) for the backing files (".bk"
#' and ".rds") that are created by this function for storing the
#' [bigSNP][bigSNP-class] object.
#' @param list_snp_id List (same length as the number of BGEN files) of
#' character vector of SNP IDs to read. These should be in the form
#' `"<chr>_<pos>_<a1>_<a2>"` (e.g. `"1_88169_C_T"` or `"01_88169_C_T"`).
#' If you have one BGEN file only, just wrap your vector of IDs with `list()`.
#' **This function assumes that these IDs are uniquely identifying variants.**
#' @param list_snp_id List of character vectors of SNP IDs to read, with one
#' vector per BGEN file. Each SNP ID should be in the form
#' `"<chr>_<pos>_<a1>_<a2>"` (e.g. `"1_88169_C_T"` or `"01_88169_C_T"`).
#' If you have one BGEN file only, just wrap your vector of IDs with `list()`.
#' **This function assumes that these IDs are uniquely identifying variants.**
#' @param bgi_dir Directory of index files. Default is the same as `bgenfiles`.
#' @param ind_row An optional vector of the row indices (individuals) that
#' are used. If not specified, all rows are used. **Don't use negative indices.**
Expand All @@ -129,15 +129,17 @@ check_bgen_format <- function(bgenfile) {
#' (similar to PLINK option '`--hard-call-threshold random`').
#'
#' @return The path to the RDS file `<backingfile>.rds` that stores the `bigSNP`
#' object created by this function. Note that this function creates another
#' file (*.bk*) which stores the values of the FBM (`$genotypes`). The `$map`
#' component of the `bigSNP` object stores some information on the variants
#' (including allele frequencies and INFO scores computed from the probabilities).
#' object created by this function.\cr
#' Note that this function creates another file (*.bk*) which stores the values
#' of the FBM (`$genotypes`). The rows corresponds to the order of `ind_row`;
#' the columns to the order of `list_snp_id`. The `$map` component of the
#' `bigSNP` object stores some information on the variants (including allele
#' frequencies and INFO scores computed from the imputation probabilities).
#' However, it does not have a `$fam` component; you should use the individual
#' IDs in the *.sample* file (filtered with `ind_row`) to add external information
#' on the individuals.\cr
#' __You shouldn't read from BGEN files more than once.__ Instead, use
#' [snp_attach] to load the "bigSNP" object in any R session from backing files.
#' IDs in the *.sample* file (filtered with `ind_row`) to add external
#' information on the individuals.\cr
#' __You shouldn't read from BGEN files more than once.__ Instead, use
#' [snp_attach] to load the "bigSNP" object in any R session from backing files.
#'
#' @importFrom magrittr %>%
#'
Expand Down
4 changes: 2 additions & 2 deletions man/snp_prodBGEN.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions man/snp_readBGEN.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 94b1058

Please sign in to comment.