Skip to content

Commit

Permalink
prepping for rcran update
Browse files Browse the repository at this point in the history
  • Loading branch information
smasongarrison committed Feb 23, 2024
1 parent ccabd1c commit c80b964
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 133 deletions.
14 changes: 7 additions & 7 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
Description
-----------------------------------------------

This is a hotfix for the BGmisc package, as we discovered that the plotPedigree wrapper function broke for pedigrees that contained multiple families.
This update reflects a substantial improvement in the codebase as part of the peer review process for JOSS, including the addition of numerous function checks, increased code coverage to 85%, and the replacement of sapply usage. We also added a new function to simulate twins and the ability to trace paternal and maternal lines. We also added a Harry Potter pedigree.


Test Environments
-----------------------------------------------

1. Local OS: Windows 10, R version 4.2.3
2. Local OS: Windows 10, R version 4.3.1
3. **GitHub Actions**:
- [Link](https://github.com/R-Computing-Lab/BGmisc/actions/runs/6317831880)
1. Local OS: Windows 11, R version 4.3.2
2. **GitHub Actions**:
- [Link](https://github.com/R-Computing-Lab/BGmisc/actions/runs/8008686394)
- macOS (latest version) with the latest R release.
- Windows (latest version) with the latest R release.
- Ubuntu (latest version) with:
Expand All @@ -20,8 +20,8 @@ Test Environments

## R CMD check results

──────────────────────── BGmisc 1.0.1 ────
Duration: 1m 1.4s
── R CMD check results BGmisc 1.2.0 ────
Duration: 1m 0.6s

0 errors ✔ | 0 warnings ✔ | 0 notes ✔

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-network.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,6 @@ test_that("ped2maternal/paternal produces correct matrix dims", {
pat <- ped2paternal(hazard)
expect_equal(dim(pat), c(nrow(hazard), ncol(hazard)+1))

expect_less_than(cor(pat$patID, mat$matID), 1)
expect_lt(cor(pat$patID, mat$matID), 1)
})

22 changes: 7 additions & 15 deletions vignettes/pedigree.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,20 @@ knitr::opts_chunk$set(
options(rmarkdown.html_vignette.check_title = FALSE)
```


# Introduction

This vignette provides a detailed guide to the pedigree-related functions within the `BGmisc` package.

## Loading Required Libraries

```{r setup}
library(BGmisc)
```

# Simulating Pedigrees



Unlike Tolstoy, where *only* happy families are alike, all pedigrees are alike -- or at least, all simulated pedigrees are alike. The `simulatePedigree` function generates a pedigree with a user-specified number of generations and individuals per generation. This function provides users the opportunity to test family models in pedigrees with a customized pedigree length and width.

These pedigrees can be simulated as a function of several parameters, including the number of children per mate, generations, sex ratio of newborns, and mating rate. Given that large family pedigrees are difficult to collect or access, simulated pedigrees serve as an efficient tool for researchers. These simulated pedigrees are useful for building family-based statistical models, and evaluating their statistical properties, such as power, bias, and computational efficiency.

To illustrate this, let us generate a pedigree. This pedigree has a total of four generations, in which each person who "mates", grows a family with four offspring. In our scenario, the number of male and female newborns is equal. In this illustration 70% of individuals will mate and bear offspring. Such a pedigree structure can be simulated by running:

To illustrate this functionality, let us generate a pedigree. This pedigree has a total of four generations (`Ngen`), in which each person who "mates", grows a family with four offspring (`kpc`). In our scenario, the number of male and female newborns is equal, but can be adjusted via (`sexR`). In this illustration 70% of individuals will mate and bear offspring (`marR`). Such a pedigree structure can be simulated by running the following code:

```{r}
## Loading Required Libraries
library(BGmisc)
set.seed(5)
df_ped <- simulatePedigree(
kpc = 4,
Expand All @@ -58,7 +50,7 @@ The columns represents the individual's family ID, the individual's personal ID,
## Plotting Pedigree


Pedigrees are visual diagrams that represent family relationships across generations. They are commonly used in genetics to trace the inheritance of specific traits or conditions. This vignette will guide you through visualizing simulated pedigrees using the `plotPedigree` function. This function is a wrapper function for Kinship2's base R plotting.
Pedigrees are visual diagrams that represent family relationships across generations. They are commonly used in genetics to trace the inheritance of specific traits or conditions. This vignette will guide you through visualizing simulated pedigrees using the `plotPedigree` function. This function is a wrapper function for `Kinship2`'s base R plotting.

### Single Pedigree Visualization

Expand Down
Loading

0 comments on commit c80b964

Please sign in to comment.