Skip to content

Commit 4bde6f7

Browse files
Merge pull request #46 from R-Computing-Lab/dev_main
implementing 1.3.1.1
2 parents 0c3a7b3 + 72cfe95 commit 4bde6f7

27 files changed

Lines changed: 788 additions & 697 deletions

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: BGmisc
22
Title: An R Package for Extended Behavior Genetics Analysis
3-
Version: 1.3.2
3+
Version: 1.3.2.1
44
Authors@R: c(
55
person("S. Mason", "Garrison", , "garrissm@wfu.edu", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0002-4804-6003")),
@@ -45,4 +45,4 @@ Config/testthat/edition: 3
4545
Encoding: UTF-8
4646
Language: en-US
4747
LazyData: true
48-
RoxygenNote: 7.3.1
48+
RoxygenNote: 7.3.2

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# BGmisc 1.3.2.1
2+
* Added ability to pass additional arguments to the ped2FOO functions
3+
14
# BGmisc 1.3.2
25
* Added some more tests of identifyModel.R
36
* Modified tests to be MKL friendly

R/buildPedigree.R

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#' @param momID character. Name of the column in ped for the mother ID variable
1010
#' @param dadID character. Name of the column in ped for the father ID variable
1111
#' @param famID character. Name of the column to be created in ped for the family ID variable
12+
#' @param ... additional arguments to be passed to \code{\link{ped2com}}
1213
#' @details
1314
#' The general idea of this function is to use person ID, mother ID, and father ID to
1415
#' create an extended family ID such that everyone with the same family ID is in the
@@ -25,14 +26,17 @@
2526
#'
2627
#' @export
2728
#'
28-
ped2fam <- function(ped, personID = "ID", momID = "momID", dadID = "dadID", famID = "famID") {
29+
ped2fam <- function(ped, personID = "ID",
30+
momID = "momID", dadID = "dadID", famID = "famID",
31+
...) {
2932
# Call to wrapper function
3033
.ped2id(ped = ped, personID = personID, momID = momID, dadID = dadID, famID = famID, type = "parents")
3134
}
3235

3336
.ped2id <- function(ped,
3437
personID = "ID", momID = "momID", dadID = "dadID",
35-
famID = "famID", type) {
38+
famID = "famID", type,
39+
...) {
3640
# Turn pedigree into family
3741
pg <- ped2graph(ped = ped, personID = personID, momID = momID, dadID = dadID, adjacent = type)
3842

@@ -79,7 +83,8 @@ ped2graph <- function(ped,
7983
momID = "momID",
8084
dadID = "dadID",
8185
directed = TRUE,
82-
adjacent = c("parents", "mothers", "fathers")) {
86+
adjacent = c("parents", "mothers", "fathers"),
87+
...) {
8388
# Check ped/data.fram
8489
if (!inherits(ped, "data.frame")) stop("ped should be a data.frame or inherit to a data.frame")
8590
# Handle adjacent argument
@@ -171,7 +176,8 @@ ped2graph <- function(ped,
171176
#' for creating paternal line IDs
172177
#' @export
173178
#'
174-
ped2maternal <- function(ped, personID = "ID", momID = "momID", dadID = "dadID", matID = "matID") {
179+
ped2maternal <- function(ped, personID = "ID",
180+
momID = "momID", dadID = "dadID", matID = "matID", ...) {
175181
# Call to wrapper function
176182
.ped2id(ped = ped, personID = personID, momID = momID, dadID = dadID, famID = matID, type = "mothers")
177183
}
@@ -189,7 +195,9 @@ ped2maternal <- function(ped, personID = "ID", momID = "momID", dadID = "dadID",
189195
#' for creating maternal line IDs
190196
#' @export
191197
#'
192-
ped2paternal <- function(ped, personID = "ID", momID = "momID", dadID = "dadID", patID = "patID") {
198+
ped2paternal <- function(ped, personID = "ID",
199+
momID = "momID", dadID = "dadID",
200+
patID = "patID", ...) {
193201
# Call to wrapper function
194202
.ped2id(ped = ped, personID = personID, momID = momID, dadID = dadID, famID = patID, type = "fathers")
195203
}

R/checkIDs.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,26 +76,26 @@ checkIDs <- function(ped, verbose = FALSE, repair = FALSE) {
7676
))
7777
}
7878
validation_results$within_row_duplicates <- TRUE
79-
if(validation_results$total_own_father > 0){
80-
validation_results$is_own_father_ids <- unique(is_own_father)
79+
if (validation_results$total_own_father > 0) {
80+
validation_results$is_own_father_ids <- unique(is_own_father)
8181
if (verbose) {
8282
cat(paste0(
8383
validation_results$total_own_father,
8484
" individuals are their own fathers.\n"
8585
))
8686
}
8787
}
88-
if(validation_results$total_own_mother > 0){
89-
validation_results$is_own_mother_ids <- unique(is_own_mother)
88+
if (validation_results$total_own_mother > 0) {
89+
validation_results$is_own_mother_ids <- unique(is_own_mother)
9090
if (verbose) {
9191
cat(paste0(
9292
validation_results$total_own_mother,
9393
" individuals are their own mothers.\n"
9494
))
9595
}
9696
}
97-
if(validation_results$total_duplicated_parents > 0){
98-
validation_results$duplicated_parents_ids <- unique(duplicated_parents)
97+
if (validation_results$total_duplicated_parents > 0) {
98+
validation_results$duplicated_parents_ids <- unique(duplicated_parents)
9999
if (verbose) {
100100
cat(paste0(
101101
validation_results$total_duplicated_parents,

R/computeRelatedness.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ calculateRelatedness <- function(
5959
denom_emp <- denom_m * total_m * weight_m + total_a * weight_a
6060
if (denom_emp == 0) stop("Denominator in empirical adjustment is zero.")
6161

62-
coef <- (coef * total_a * weight_a + maternal * total_m * weight_m)/denom_emp
62+
coef <- (coef * total_a * weight_a + maternal * total_m * weight_m) / denom_emp
6363
}
6464
return(coef)
6565
}

R/convertPedigree.R

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,11 @@ ped2com <- function(ped, component,
204204
#' @inherit ped2com details
205205
#' @export
206206
#'
207-
ped2add <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE, gc = FALSE, flatten.diag = FALSE, standardize.colnames = TRUE,
208-
tcross.alt.crossprod = FALSE, tcross.alt.star = FALSE) {
207+
ped2add <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE,
208+
gc = FALSE,
209+
flatten.diag = FALSE, standardize.colnames = TRUE,
210+
tcross.alt.crossprod = FALSE, tcross.alt.star = FALSE,
211+
...) {
209212
ped2com(
210213
ped = ped,
211214
max.gen = max.gen,
@@ -226,7 +229,13 @@ ped2add <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE, gc = FAL
226229
#' @export
227230
#' @aliases ped2mt
228231
#'
229-
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) {
232+
ped2mit <- ped2mt <- function(ped, max.gen = 25,
233+
sparse = FALSE,
234+
verbose = FALSE, gc = FALSE,
235+
flatten.diag = FALSE,
236+
standardize.colnames = TRUE,
237+
tcross.alt.crossprod = FALSE, tcross.alt.star = FALSE,
238+
...) {
230239
ped2com(
231240
ped = ped,
232241
max.gen = max.gen,
@@ -246,7 +255,11 @@ ped2mit <- ped2mt <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE
246255
#' @inherit ped2com details
247256
#' @export
248257
#'
249-
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) {
258+
ped2cn <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE,
259+
gc = FALSE, flatten.diag = FALSE,
260+
standardize.colnames = TRUE,
261+
tcross.alt.crossprod = FALSE, tcross.alt.star = FALSE,
262+
...) {
250263
ped2com(
251264
ped = ped,
252265
max.gen = max.gen,
@@ -266,6 +279,7 @@ ped2cn <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE, gc = FALS
266279
#' @inherit ped2com details
267280
#' @export
268281
#'
269-
ped2ce <- function(ped) {
282+
ped2ce <- function(ped,
283+
...) {
270284
matrix(1, nrow = nrow(ped), ncol = nrow(ped), dimnames = list(ped$ID, ped$ID))
271285
}

0 commit comments

Comments
 (0)