Skip to content

Commit

Permalink
allow more argumements
Browse files Browse the repository at this point in the history
  • Loading branch information
smasongarrison committed Aug 20, 2024
1 parent 0c3a7b3 commit d8ec569
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 18 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# BGmisc 1.3.2.1
* Added ability to pass additional arguments to the ped2FOO functions

# BGmisc 1.3.2
* Added some more tests of identifyModel.R
* Modified tests to be MKL friendly
Expand Down
18 changes: 13 additions & 5 deletions R/buildPedigree.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#' @param momID character. Name of the column in ped for the mother ID variable
#' @param dadID character. Name of the column in ped for the father ID variable
#' @param famID character. Name of the column to be created in ped for the family ID variable
#' @param ... additional arguments to be passed to \code{\link{ped2com}}
#' @details
#' The general idea of this function is to use person ID, mother ID, and father ID to
#' create an extended family ID such that everyone with the same family ID is in the
Expand All @@ -25,14 +26,17 @@
#'
#' @export
#'
ped2fam <- function(ped, personID = "ID", momID = "momID", dadID = "dadID", famID = "famID") {
ped2fam <- function(ped, personID = "ID",
momID = "momID", dadID = "dadID", famID = "famID",
...) {
# Call to wrapper function
.ped2id(ped = ped, personID = personID, momID = momID, dadID = dadID, famID = famID, type = "parents")
}

.ped2id <- function(ped,
personID = "ID", momID = "momID", dadID = "dadID",
famID = "famID", type) {
famID = "famID", type,
...) {
# Turn pedigree into family
pg <- ped2graph(ped = ped, personID = personID, momID = momID, dadID = dadID, adjacent = type)

Expand Down Expand Up @@ -79,7 +83,8 @@ ped2graph <- function(ped,
momID = "momID",
dadID = "dadID",
directed = TRUE,
adjacent = c("parents", "mothers", "fathers")) {
adjacent = c("parents", "mothers", "fathers"),
...) {
# Check ped/data.fram
if (!inherits(ped, "data.frame")) stop("ped should be a data.frame or inherit to a data.frame")
# Handle adjacent argument
Expand Down Expand Up @@ -171,7 +176,8 @@ ped2graph <- function(ped,
#' for creating paternal line IDs
#' @export
#'
ped2maternal <- function(ped, personID = "ID", momID = "momID", dadID = "dadID", matID = "matID") {
ped2maternal <- function(ped, personID = "ID",
momID = "momID", dadID = "dadID", matID = "matID",...) {
# Call to wrapper function
.ped2id(ped = ped, personID = personID, momID = momID, dadID = dadID, famID = matID, type = "mothers")
}
Expand All @@ -189,7 +195,9 @@ ped2maternal <- function(ped, personID = "ID", momID = "momID", dadID = "dadID",
#' for creating maternal line IDs
#' @export
#'
ped2paternal <- function(ped, personID = "ID", momID = "momID", dadID = "dadID", patID = "patID") {
ped2paternal <- function(ped, personID = "ID",
momID = "momID", dadID = "dadID",
patID = "patID",...) {
# Call to wrapper function
.ped2id(ped = ped, personID = personID, momID = momID, dadID = dadID, famID = patID, type = "fathers")
}
24 changes: 19 additions & 5 deletions R/convertPedigree.R
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,11 @@ ped2com <- function(ped, component,
#' @inherit ped2com details
#' @export
#'
ped2add <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE, gc = FALSE, flatten.diag = FALSE, standardize.colnames = TRUE,
tcross.alt.crossprod = FALSE, tcross.alt.star = FALSE) {
ped2add <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE,
gc = FALSE,
flatten.diag = FALSE, standardize.colnames = TRUE,
tcross.alt.crossprod = FALSE, tcross.alt.star = FALSE,
...) {
ped2com(
ped = ped,
max.gen = max.gen,
Expand All @@ -226,7 +229,13 @@ ped2add <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE, gc = FAL
#' @export
#' @aliases ped2mt
#'
ped2mit <- ped2mt <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE, gc = FALSE, flatten.diag = FALSE, standardize.colnames = TRUE, tcross.alt.crossprod = FALSE, tcross.alt.star = FALSE) {
ped2mit <- ped2mt <- function(ped, max.gen = 25,
sparse = FALSE,
verbose = FALSE, gc = FALSE,
flatten.diag = FALSE,
standardize.colnames = TRUE,
tcross.alt.crossprod = FALSE, tcross.alt.star = FALSE,
...) {
ped2com(
ped = ped,
max.gen = max.gen,
Expand All @@ -246,7 +255,11 @@ ped2mit <- ped2mt <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE
#' @inherit ped2com details
#' @export
#'
ped2cn <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE, gc = FALSE, flatten.diag = FALSE, standardize.colnames = TRUE, tcross.alt.crossprod = FALSE, tcross.alt.star = FALSE) {
ped2cn <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE,
gc = FALSE, flatten.diag = FALSE,
standardize.colnames = TRUE,
tcross.alt.crossprod = FALSE, tcross.alt.star = FALSE,
...) {
ped2com(
ped = ped,
max.gen = max.gen,
Expand All @@ -266,6 +279,7 @@ ped2cn <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE, gc = FALS
#' @inherit ped2com details
#' @export
#'
ped2ce <- function(ped) {
ped2ce <- function(ped,
...) {
matrix(1, nrow = nrow(ped), ncol = nrow(ped), dimnames = list(ped$ID, ped$ID))
}
5 changes: 4 additions & 1 deletion man/ped2add.Rd

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

4 changes: 3 additions & 1 deletion man/ped2ce.Rd

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

5 changes: 4 additions & 1 deletion man/ped2cn.Rd

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

5 changes: 4 additions & 1 deletion man/ped2fam.Rd

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

5 changes: 4 additions & 1 deletion man/ped2graph.Rd

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

5 changes: 4 additions & 1 deletion man/ped2maternal.Rd

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

5 changes: 4 additions & 1 deletion man/ped2mit.Rd

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

5 changes: 4 additions & 1 deletion man/ped2paternal.Rd

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

0 comments on commit d8ec569

Please sign in to comment.