specie: R6 Class Representing a Specie

specieR Documentation

R6 Class Representing a Specie

Description

Specie object store specific information of one specie.

Public fields

nChr

[numeric] Number of chromosomes

lChr

[numeric] Length of all chromosomes

specName

[str] Specie's name

ploidy

[numeric] Number of possible alleles at one locus

mutRate

[numeric] Mutation rate at each base

recombRate

[numeric] Recombination rate at each base

chrNames

[str] Names of the chromosomes

nLoci

[numeric] Number of loci (including both markers (SNPs) & QTLs)

effPopSize

[numeric] Effective population size

recombRateOneVal

[logical] Assume same recombination rate across genome

simInfo

[simInfo class] Simulation information (see:simInfo)

Methods

Public methods


Method new()

Create a new specie object.

Usage
specie$new(
  nChr,
  lChr,
  specName = "Undefinded",
  ploidy = NA,
  mutRate = NA,
  recombRate = NA,
  chrNames = NA,
  nLoci = NA,
  effPopSize = NA,
  recombRateOneVal = TRUE,
  simInfo = NULL,
  verbose = TRUE
)
Arguments
nChr

[numeric] Number of chromosomes

lChr

[numeric] length of all chromosomes

specName

[str] Specie's name (optional)

ploidy

[numeric] Number of possible alleles at one locus (optional)

mutRate

[numeric] Mutation rate at each base (optional)

recombRate

[numeric] Recombination rate at each base (optional)

chrNames

[str] Names of the chromosomes (optional)

nLoci

[numeric] Number of loci (including both markers (SNPs) & QTLs)

effPopSize

[numeric] Effective population size

recombRateOneVal

[logical] Assume same recombination rate across genome or not

simInfo

[simInfo class] Simulation information (see:simInfo)

verbose

[logical] Display info (optional)

Returns

A new 'specie' object.

Examples
### create simulation information
mySimInfo <- simInfo$new(simName = "Simulation Example",
                         simGeno = TRUE,
                         simPheno = TRUE,
                         nSimGeno = 1,
                         nSimPheno = 3,
                         nCoreMax = 4,
                         nCorePerGeno = 1,
                         nCorePerPheno = 3,
                         saveDataFileName = NULL)

### create specie information
mySpec <- specie$new(nChr = 3,
                     lChr = c(100, 150, 200),
                     specName = "Example 1",
                     ploidy = 2,
                     mutRate = 10^-8,
                     recombRate = 10^-7,
                     recombRateOneVal = FALSE,
                     chrNames = c("C1", "C2", "C3"),
                     nLoci = 100,
                     effPopSize = 100,
                     simInfo = mySimInfo,
                     verbose = TRUE)
print(mySpec)

Method print()

Display information about the object

Usage
specie$print()

Method getChrLength()

Get the chromosomes length

Usage
specie$getChrLength(chr = NA)
Arguments
chr

[str or numeric] chromosome ids

Examples
mySpec$getChrLength()
mySpec$getChrLength(2)
mySpec$getChrLength("Chr3")

Method clone()

The objects of this class are cloneable with this method.

Usage
specie$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `specie$new`
## ------------------------------------------------

### create simulation information
mySimInfo <- simInfo$new(simName = "Simulation Example",
                         simGeno = TRUE,
                         simPheno = TRUE,
                         nSimGeno = 1,
                         nSimPheno = 3,
                         nCoreMax = 4,
                         nCorePerGeno = 1,
                         nCorePerPheno = 3,
                         saveDataFileName = NULL)

### create specie information
mySpec <- specie$new(nChr = 3,
                     lChr = c(100, 150, 200),
                     specName = "Example 1",
                     ploidy = 2,
                     mutRate = 10^-8,
                     recombRate = 10^-7,
                     recombRateOneVal = FALSE,
                     chrNames = c("C1", "C2", "C3"),
                     nLoci = 100,
                     effPopSize = 100,
                     simInfo = mySimInfo,
                     verbose = TRUE)
print(mySpec)

## ------------------------------------------------
## Method `specie$getChrLength`
## ------------------------------------------------

mySpec$getChrLength()
mySpec$getChrLength(2)
mySpec$getChrLength("Chr3")

KosukeHamazaki/myBreedSimulatR documentation built on Aug. 31, 2024, 3:55 p.m.