Skip to content

Commit 1db5c68

Browse files
authored
Removing concept of group thresholds from gpmapr (#5)
1 parent adba52d commit 1db5c68

File tree

10 files changed

+19
-39
lines changed

10 files changed

+19
-39
lines changed

R/genes.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#' @param gene_id A numeric value specifying the gene id
44
#' @param include_associations A logical value specifying whether to include associations
55
#' (BETA, SE, P), defaults to FALSE
6-
#' @param coloc_group_threshold A character value specifying the group threshold for coloc groups, defaults to 'strong'
76
#' @param include_coloc_pairs A logical value specifying whether to include coloc pairs, defaults to FALSE
87
#' @param h4_threshold A numeric value specifying the h4 threshold for coloc pairs, defaults to 0.8
98
#' @return A list which contains the following elements:
@@ -28,17 +27,12 @@
2827
#' @export
2928
gene <- function(gene_id,
3029
include_associations = FALSE,
31-
coloc_group_threshold = "strong",
3230
include_coloc_pairs = FALSE,
3331
h4_threshold = 0.8) {
3432
if (is.null(gene_id)) {
3533
stop("gene_id is required")
3634
}
37-
if (!coloc_group_threshold %in% c("strong", "moderate")) {
38-
stop("coloc_group_threshold must be either 'strong' or 'moderate'")
39-
}
4035
gene_info <- gene_api(gene_id, include_associations, include_coloc_pairs, h4_threshold)
41-
gene_info$coloc_groups <- dplyr::filter(gene_info$coloc_groups, group_threshold == coloc_group_threshold)
4236
gene_info$tissues <- NULL
4337

4438
gene_info <- cleanup_api_object(gene_info)

R/region.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#' @param region_id A numeric value specifying the region id
44
#' @param include_associations A logical value specifying whether to include associations
55
#' (BETA, SE, P), defaults to FALSE
6-
#' @param coloc_group_threshold A character value specifying the group threshold for coloc groups, defaults to 'strong'
76
#' @param include_coloc_pairs A logical value specifying whether to include coloc pairs, defaults to FALSE
87
#' @param h4_threshold A numeric value specifying the h4 threshold for coloc pairs, defaults to 0.8
98
#' @return A list which contains the following elements:
@@ -29,17 +28,12 @@
2928
#' @export
3029
region <- function(region_id,
3130
include_associations = FALSE,
32-
coloc_group_threshold = "strong",
3331
include_coloc_pairs = FALSE,
3432
h4_threshold = 0.8) {
3533
if (is.null(region_id)) {
3634
stop("region_id is required")
3735
}
38-
if (!coloc_group_threshold %in% c("strong", "moderate")) {
39-
stop("coloc_group_threshold must be either 'strong' or 'moderate'")
40-
}
4136
region_info <- region_api(region_id, include_associations, include_coloc_pairs, h4_threshold)
42-
region_info$coloc_groups <- dplyr::filter(region_info$coloc_groups, group_threshold == coloc_group_threshold)
4337

4438
region_info <- cleanup_api_object(region_info)
4539
region_info <- merge_associations(region_info)

R/traits.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#' @param trait_id A numeric value specifying the trait id
55
#' @param include_associations A logical value specifying whether to include associations
66
#' (BETA, SE, P), defaults to FALSE
7-
#' @param coloc_group_threshold A character value specifying the group threshold for coloc groups, defaults to 'strong'
87
#' @param include_coloc_pairs A logical value specifying whether to include coloc pairs, defaults to FALSE
98
#' @param h4_threshold A numeric value specifying the h4 threshold for coloc pairs, defaults to 0.8
109
#' @return A list which contains the following elements:
@@ -29,18 +28,13 @@
2928
#' @export
3029
trait <- function(trait_id,
3130
include_associations = FALSE,
32-
coloc_group_threshold = "strong",
3331
include_coloc_pairs = FALSE,
3432
h4_threshold = 0.8) {
3533
if (is.null(trait_id)) {
3634
stop("trait_id is required")
3735
}
38-
if (!coloc_group_threshold %in% c("strong", "moderate")) {
39-
stop("coloc_group_threshold must be either 'strong' or 'moderate'")
40-
}
4136

4237
trait_info <- trait_api(trait_id, include_associations, include_coloc_pairs, h4_threshold)
43-
trait_info$coloc_groups <- dplyr::filter(trait_info$coloc_groups, group_threshold == coloc_group_threshold)
4438

4539
trait_info <- cleanup_api_object(trait_info)
4640
if (include_associations) trait_info <- merge_associations(trait_info)

R/variants.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#' @title Variant
22
#' @description A collection of studies that are associated with a particular variant.
33
#' @param snp_id A character string specifying the SNP ID
4-
#' @param coloc_group_threshold A character value specifying the group threshold for coloc groups, defaults to 'strong'
54
#' @param include_coloc_pairs A logical value specifying whether to include coloc pairs
65
#' @param h4_threshold A numeric value specifying the cutoff for included coloc pairs, defaults to 0.8.
76
#' Only used if include_coloc_pairs is TRUE.
@@ -25,19 +24,14 @@
2524
#' @inheritSection coloc_pairs_doc coloc_pairs_dataframe
2625
#' @export
2726
variant <- function(snp_id,
28-
coloc_group_threshold = "strong",
2927
include_coloc_pairs = FALSE,
3028
h4_threshold = 0.8,
3129
include_summary_stats = FALSE) {
3230
if (is.null(snp_id)) {
3331
stop("snp_id is required")
3432
}
35-
if (!coloc_group_threshold %in% c("strong", "moderate")) {
36-
stop("coloc_group_threshold must be either 'strong' or 'moderate'")
37-
}
3833

3934
variant_info <- variant_api(snp_id, include_coloc_pairs = include_coloc_pairs, h4_threshold = h4_threshold)
40-
variant_info$coloc_groups <- dplyr::filter(variant_info$coloc_groups, group_threshold == coloc_group_threshold)
4135

4236
if (include_summary_stats) {
4337
summary_stats <- variant_summary_stats_api(snp_id)

man/cleanup_api_object.Rd

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

man/gene.Rd

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

man/region.Rd

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

man/trait.Rd

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

man/variant.Rd

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

vignettes/gpmapr.Rmd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ You can get more information about a trait by subsequently calling the `trait()`
6565
Each trait, gene, or variant call have optional parameters:
6666

6767
* `include_associations`: Whether to include associations (BETA, SE, P) of the variants in which it's colocalised in the output.
68-
* `group_threshold`: The threshold for coloc groups, can be 'strong' (h4 > 0.8) or 'moderate' (h4 > 0.6), defaults to 'strong'.
6968
* `include_coloc_pairs`: Whether to include coloc pairs in the output (which include h3 and h4), as opposed to just the coloc groups.
7069
* `h4_threshold`: The h4 threshold for coloc pairs.
7170

@@ -85,10 +84,10 @@ This returns a list of elements, which you can access by name. More detailed ex
8584
* `coloc_pairs`: (optional) a dataframe containing all pairwise coloc results for this trait.
8685

8786
```{r gene-example}
88-
slc44a1 <- gene("SLC44A1", coloc_group_threshold = "moderate")
87+
slc44a1 <- gene("SLC44A1")
8988
names(slc44a1)
9089
nrow(slc44a1$coloc_groups)
91-
head(slc44a1$coloc_groups[, c("coloc_group_id", "group_threshold", "trait_name", "data_type", "tissue")])
90+
head(slc44a1$coloc_groups[, c("coloc_group_id", "trait_name", "data_type", "tissue")])
9291
```
9392

9493
# Accessing summary statistics

0 commit comments

Comments
 (0)