Skip to content

Commit

Permalink
update get_variant()
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgpanw committed Jun 22, 2024
1 parent da231f7 commit 030d66f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 34 deletions.
34 changes: 13 additions & 21 deletions R/get_variant.R
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
#' Get Variant
#'
#' [This service returns information about a variant, including position, dbSNP
#' RS ID, the reference allele, the alternative allele, and whether the minor
#' allele frequency is >=
#' 1%.](https://gtexportal.org/api/v2/redoc#tag/Datasets-Endpoints/operation/get_variant_api_v2_dataset_variant_get)
#'
#' For GTEx v6p, there is also information about whether the whole exome
#' sequence and chip sequencing data are available. Results may be queried by
#' GTEx variant ID (variantId), dbSNP RS ID (snpId) or genomic location
#' (chromosome and pos). Variants are identified based on the genotype data of
#' each dataset cohort, namely, are dataset-dependent. Each variant is assigned
#' a unique GTEx variant ID (i.e. the primary key). Not all variants have a
#' mappable dbSNP RS ID. By default, this service queries the latest GTEx
#' release.
#'
#' Note: searching by chromosome and position can be more easily achieved using
#' [get_variant_by_location()].
#' @description This service returns information about a variant, including
#' position, dbSNP RS ID, the reference allele, the alternative allele, and
#' whether the minor allele frequency is >= 1%. For GTEx v6p, there is also
#' information about whether the whole exome sequence and chip sequencing data
#' are available. Results may be queried by GTEx variant ID (variantId), dbSNP
#' RS ID (snpId) or genomic location (chromosome and pos). Variants are
#' identified based on the genotype data of each dataset cohort, namely, are
#' dataset-dependent. Each variant is assigned a unique GTEx variant ID (i.e.
#' the primary key). Not all variants have a mappable dbSNP RS ID. By default,
#' this service queries the latest GTEx release.
#'
#' [GTEx Portal API
#' documentation](https://gtexportal.org/api/v2/redoc#tag/Datasets-Endpoints/operation/get_variant_api_v2_dataset_variant_get)
#'
#' @inheritParams gtexr_arguments
#'
Expand All @@ -41,10 +38,5 @@ get_variant <- function(snpId = NULL,
page = 0,
itemsPerPage = 250) {

if (is.null(snpId) & is.null(variantId) & (is.null(chromosome) | is.null(pos))) {
cli::cli_abort(c("Either `snpId` or `variantId` must be provided, or both `chromosome` and `pos`.",
"i" = "See {.fn ?get_variant} for examples"))
}

gtex_query(endpoint = "dataset/variant")
}
24 changes: 11 additions & 13 deletions man/get_variant.Rd

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

0 comments on commit 030d66f

Please sign in to comment.