Learn R Programming

pedtools (version 2.8.0)

marker_inplace: Set marker attributes

Description

These S3 methods perform in-place modifications of marker attributes. They work on single marker objects and markers attached to ped objects (or lists of such). Although these functions will continue to exist, we recommend the newer alternatives setGenotype(), setAfreq(), ... in most cases.

Usage

genotype(x, ...) <- value

# S3 method for marker genotype(x, id, ...) <- value

# S3 method for ped genotype(x, marker, id, ...) <- value

mutmod(x, ...) <- value

# S3 method for marker mutmod(x, ...) <- value

# S3 method for ped mutmod(x, marker = NULL, ...) <- value

# S3 method for list mutmod(x, marker = NULL, ...) <- value

afreq(x, ...) <- value

# S3 method for marker afreq(x, ...) <- value

# S3 method for ped afreq(x, marker, ...) <- value

# S3 method for list afreq(x, marker, ...) <- value

name(x, ...) <- value

# S3 method for marker name(x, ...) <- value

# S3 method for ped name(x, markers = NULL, ...) <- value

# S3 method for list name(x, markers = NULL, ...) <- value

chrom(x, ...) <- value

# S3 method for marker chrom(x, ...) <- value

# S3 method for ped chrom(x, markers = NULL, ...) <- value

# S3 method for list chrom(x, markers = NULL, ...) <- value

posMb(x, ...) <- value

# S3 method for marker posMb(x, ...) <- value

# S3 method for ped posMb(x, markers = NULL, ...) <- value

Value

These functions perform in-place modification of x.

Arguments

x

Either a marker object, a ped object or a list of ped objects.

...

Further arguments, not used.

value

Replacement value(s).

id

The ID label of a single pedigree member.

marker, markers

The index or name of a marker (or a vector indicating several markers) attached to ped. Used if x is a ped object.

See Also

Alternative setters (not in-place): marker_setattr. Marker attribute getters: marker_getattr.

Examples

Run this code
x = nuclearPed(1)
x = addMarker(x, alleles = 1:2)

# Set genotypes
genotype(x, marker = 1, id = 1) = "1/2"

# Set marker name
name(x, 1) = "M"

# Change allele freqs
afreq(x, "M") = c(`1` = 0.1, `2` = 0.9)

# Set position
chrom(x, "M") = 1
posMb(x, "M") = 123.45

# Check result
m = marker(x, `1` = "1/2", name = "M", afreq = c(`1` = 0.1, `2` = 0.9),
           chrom = 1, posMb = 123.45)
stopifnot(identical(x$MARKERS[[1]], m))

Run the code above in your browser using DataLab