Skip to content

Commit

Permalink
Simplify code in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusdv committed Feb 28, 2023
1 parent 784bfc9 commit a2b6343
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 36 deletions.
5 changes: 2 additions & 3 deletions R/checkPairwise.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
#' ### Example with realistic data
#'
#' x = avuncularPed() |>
#' setMarkers(locus = NorwegianFrequencies) |>
#' profileSim(N = 1, simplify1 = TRUE, seed = 1729)
#' profileSim(markers = NorwegianFrequencies, seed = 1729)
#'
#' checkPairwise(x)
#'
Expand All @@ -53,7 +52,7 @@
#' # Combined plot of pedigree and IBD estimates
#' dev.new(height = 5, width = 8, noRStudioGD = TRUE)
#' layout(rbind(1:2), widths = 2:3)
#' plot(y, margins = c(4,2,4,2), title = "Sample swap 1 - 3")
#' plot(y, margins = c(4,2,4,2), title = "Swapped 1 - 3")
#' checkPairwise(y, labels = TRUE)
#' }
#'
Expand Down
8 changes: 4 additions & 4 deletions R/findExclusions.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
#'
#' @examples
#'
#' db = NorwegianFrequencies[1:5]
#'
#' # Pedigree with 3 siblings; simulate data for first two
#' x = nuclearPed(3) |>
#' setMarkers(locusAttributes = NorwegianFrequencies[1:5]) |>
#' profileSim(ids = 3:4, seed = 1)
#' profileSim(ids = 3:4, markers = db, seed = 1)
#'
#' # Simulate random person
#' poi = singleton("POI") |>
#' setMarkers(locusAttributes = NorwegianFrequencies[1:5]) |>
#' profileSim(seed = 1)
#' profileSim(markers = db, seed = 1)
#'
#' # Identify incompatible markers
#' findExclusions(x, id = 5, candidate = poi) # D21S11
Expand Down
3 changes: 1 addition & 2 deletions R/missingPersonLR.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
#' db = NorwegianFrequencies[1:5]
#'
#' # Simulate reference data for grandmother and MP (5 STR markers)
#' x = setMarkers(x, locusAttributes = db)
#' x = profileSim(x, N = 1, ids = c(2, "MP"), seed = 2509)
#' x = profileSim(x, markers = db, ids = c(2, "MP"), seed = 2509)
#'
#' # Compute LR
#' lr = missingPersonLR(x, missing = "MP")
Expand Down
17 changes: 8 additions & 9 deletions R/powerPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@
#'
#' ### Example 1: Comparing the power of 3 reference families ###
#'
#' # Helper function for simulating a single profile
#' sim = function(x, id) {
#' y = setMarkers(x, locusAttributes = NorwegianFrequencies[1:3])
#' profileSim(y, N = 1, ids = id)
#' }
#' # Frequencies for 3 STR markers
#' db = NorwegianFrequencies[1:3]
#'
#' # Define pedigrees and simulate data
#' PAR = nuclearPed(1, child = "MP") |> sim(id = 1)
#' SIB = nuclearPed(2) |> relabel(old = 4, new = "MP") |> sim(id = 3)
#' GRA = linearPed(2) |> relabel(old = 5, new = "MP") |> sim(id = 1)
#' PAR = nuclearPed(1, child = "MP") |>
#' profileSim(markers = db, ids = 1)
#' SIB = nuclearPed(2) |> relabel(old = 4, new = "MP") |>
#' profileSim(markers = db, ids = 3)
#' GRA = linearPed(2) |> relabel(old = 5, new = "MP") |>
#' profileSim(markers = db, ids = 1)
#'
#' # Collect in list and plot
#' peds = list(PAR = PAR, SIB = SIB, GRA = GRA)
Expand All @@ -91,7 +91,6 @@
#'
#' # Plot
#' powerPlot(ep, ip, size = 2)
#' powerPlot(ep, ip, size = 2, jitter = TRUE)
#'
#' # Different plot type, not dependent of `threshold`
#' powerPlot(ep, ip, size = 2, type = 3)
Expand Down
5 changes: 2 additions & 3 deletions man/checkPairwise.Rd

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

8 changes: 4 additions & 4 deletions man/findExclusions.Rd

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

3 changes: 1 addition & 2 deletions man/missingPersonLR.Rd

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

17 changes: 8 additions & 9 deletions man/powerPlot.Rd

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

0 comments on commit a2b6343

Please sign in to comment.