segmentStats: Summary statistics for identified segments

View source: R/segment_utils.R

segmentStatsR Documentation

Summary statistics for identified segments

Description

Compute summary statistics for segments identified by findPattern().

Usage

segmentStats(
  x,
  quantiles = c(0.025, 0.5, 0.975),
  returnAll = FALSE,
  unit = "mb"
)

Arguments

x

A list of matrices produced with findPattern().

quantiles

A vector of quantiles to include in the summary.

returnAll

A logical, by default FALSE. If TRUE, the output includes a vector allSegs containing the lengths of all segments in all simulations.

unit

Either "mb" (megabases) or "cm" (centiMorgan); the length unit for genomic segments.

Value

A list containing a data frame perSim, a matrix summary and (if returnAll is TRUE) a vector allSegs.

Variables used in the output:

  • Count: The total number of segments in a simulation

  • Total: The total sum of the segment lengths in a simulation

  • Average: The average segment lengths in a simulation

  • Shortest: The length of the shortest segment in a simulation

  • Longest: The length of the longest segment in a simulation

  • Overall (only in summary): A summary of all segments from all simulations

See Also

findPattern()

Examples

x = nuclearPed(3)
sims = ibdsim(x, N = 2, map = uniformMap(M = 2), model = "haldane", seed = 1729)

# Segments where all siblings carry the same allele
segs = findPattern(sims, pattern = list(carriers = 3:5))

# Summarise
segmentStats(segs, unit = "mb")

# The unit does not matter in this case (since the map is trivial)
segmentStats(segs, unit = "cm")


ibdsim2 documentation built on Aug. 17, 2023, 5:17 p.m.