lociInfo: R6 Class representing a set of SNP markers

lociInfoR Documentation

R6 Class representing a set of SNP markers

Description

lociInfo object store specific information of a set of SNP markers including QTLs

Details

This class is useful for setting the Haplotype class. (see: haplotype)

Public fields

genoMap

[data.frame] Coordinate of all SNPs.

3 columns:

  • lociNames: SNP&QTL's IDs

  • chr: Chromosome holding the SNP

  • pos: SNP position on the chromosome

specie

[specie class] Specie of the SNPs (see:specie)

posGeneticDist

[logical] Position is based on genetic distance or not (physical distance). If you simulate genome data, this argument will automatically be TRUE. If this argument is FALSE, 'specie$recombRateOneVal' will be TRUE.

seedSimGeno

[numeric] Seed for simulating marker genotype

founderHaplo

[matrix] Haplotype of founders (n \times m matrix) by simulation (for real data, founderHaplo = NULL)

genoMapList

[list] Named list of dataframes with the coordinate of all SNPs. for each chromosomes

ids

[list] Named list of the SNP ids for all chromosomes

recombBetweenMarkersList

[list] Named list of matrix representing recombination between markers for each chromosome

Methods

Public methods


Method new()

Create a new lociInfo object.

Usage
lociInfo$new(
  genoMap = NULL,
  specie,
  posGeneticDist = TRUE,
  seedSimGeno = NA,
  lociNames = NULL,
  founderNames = NULL
)
Arguments
genoMap

[data.frame] Coordinate of all SNPs. (needed for real data)

3 columns:

  • chr: Chromosome holding the SNP

  • pos: SNP position on the chromosome

  • lociNames: SNP's IDs

specie

[specie class] Specie of the SNPs (see:specie)

posGeneticDist

[logical] Position is based on genetic distance or not (physical distance). If you simulate genome data, this argument will automatically be TRUE. If this argument is FALSE, 'specie$recombRateOneVal' will be TRUE.

seedSimGeno

[numeric] Random seed for simulation of marker genotype (optional)

lociNames

[character] Names of the markers used for simulated marker genotype (optional)

founderNames

[character] Names of the founders. It should be equal to ploidy * effective population size (optional)

Returns

A new 'lociInfo' object.

Examples
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)

### create SNP information
myLoci <- lociInfo$new(genoMap = NULL,
                     specie = mySpec,
                     seedSimGeno = NA,
                     lociNames = NULL,
                     founderNames = NULL)
print(myLoci)


Method nLoci()

Get the number of SNPs per chromosomes

Usage
lociInfo$nLoci(chr = NA)
Arguments
chr

[str or numeric] chromosome id

Examples
myLoci$nLoci()
myLoci$nLoci(c("C2","C3"))

Method getInfo()

Get information about specific SNPs

Usage
lociInfo$getInfo(lociNames)
Arguments
lociNames

[str] loci ids

Examples
myLoci$getInfo("Loci_1")
myLoci$getInfo(c("Loci_1", "Loci_3"))

Method computeRecombBetweenMarkers()

Compute named list of matrix representing recombination between markers for each chromosome

Usage
lociInfo$computeRecombBetweenMarkers()

Method print()

Display summary information about the object: specie, number of SNP, SNP coordinates.

Usage
lociInfo$print(fh = TRUE, fl = TRUE, rown = 6, coln = 6, rowst = 1, colst = 1)
Arguments
fh

From head. If this argument is TRUE, first part (row) of data will be shown (like head() function). If FALSE, last part (row) of your data will be shown (like tail() function).

fl

From left. If this argument is TRUE, first part (column) of data will be shown (like head() function). If FALSE, last part (column) of your data will be shown (like tail() function).

rown

The number of rows shown in console.

coln

The number of columns shown in console.

rowst

The start point for the direction of row.

colst

The start point for the direction of column.


Method plot()

plot chromosome map using the plotly package

Usage
lociInfo$plot(alpha = 0.01)
Arguments
alpha

transparency see plot_ly

Examples
myLoci$plot(alpha = 0.1)

Method clone()

The objects of this class are cloneable with this method.

Usage
lociInfo$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `lociInfo$new`
## ------------------------------------------------

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)

### create SNP information
myLoci <- lociInfo$new(genoMap = NULL,
                     specie = mySpec,
                     seedSimGeno = NA,
                     lociNames = NULL,
                     founderNames = NULL)
print(myLoci)


## ------------------------------------------------
## Method `lociInfo$nLoci`
## ------------------------------------------------

myLoci$nLoci()
myLoci$nLoci(c("C2","C3"))

## ------------------------------------------------
## Method `lociInfo$getInfo`
## ------------------------------------------------

myLoci$getInfo("Loci_1")
myLoci$getInfo(c("Loci_1", "Loci_3"))

## ------------------------------------------------
## Method `lociInfo$plot`
## ------------------------------------------------

myLoci$plot(alpha = 0.1)

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