-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This provides some of the functionality mentioned in #32
- Loading branch information
Showing
6 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#' Find transitions | ||
#' | ||
#' Use the loci table to define which loci are transitions | ||
#' | ||
#' @param .x a vector of class `vctrs_bigSNP` (usually the `genotype` column of | ||
#' a [`gen_tibble`] object), | ||
#' or a [`gen_tibble`]. | ||
#' @param ... other arguments passed to specific methods. | ||
#' @returns a vector of frequencies, one per locus | ||
#' @rdname loci_transitions | ||
#' @export | ||
loci_transitions <- function(.x, ...) { | ||
UseMethod("loci_transitions", .x) | ||
} | ||
|
||
#' @export | ||
#' @rdname loci_transitions | ||
loci_transitions.tbl_df <- function(.x, ...) { | ||
#TODO this is a hack to deal with the class being dropped when going through group_map | ||
stopifnot_gen_tibble(.x) | ||
loci_transitions(.x$genotypes, ...) | ||
} | ||
|
||
|
||
#' @export | ||
#' @rdname loci_transitions | ||
loci_transitions.vctrs_bigSNP <- function(.x, ...) { | ||
rlang::check_dots_empty() | ||
|
||
!loci_transversions(.x) | ||
} | ||
|
||
#' @export | ||
#' @rdname loci_transitions | ||
loci_transitions.grouped_df <- function(.x, ...) { | ||
group_map(.x, .f=~loci_transitions(.x)) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters