Learn R Programming

coala (version 0.7.2)

create_segsites: Segregating Sites

Description

These functions create and modify segregating sites objects, which are one of the basic intermediary statistics that is calculated in coala. Segregating sites consist primarily of a SNP matrix that contains all SNPs for one locus, with some additional information attached. The parts of the S3 class are detailed below.

Usage

create_segsites(snps, positions, trio_locus = numeric(0), check = TRUE)

get_snps(segsites)

get_positions(segsites)

set_positions(segsites, positions)

get_trio_locus(segsites)

set_trio_locus(segsites, trio_locus)

is_segsites(segsites)

create_locus_trio(left, middle, right)

Arguments

snps

The SNP Matrix (see Details).

positions

A numeric vector indicating the relative positions of each SNP on the locus (see Details).

trio_locus

If the locus consists of a locus trio (see Details).

check

Whether non-segregating sites are removed from the segregating sites (TRUE) or not (FALSE).

segsites

The segregating sites object

left

The segregating sites from the left locus

middle

The segregating sites from the middle locus

right

The segregating sites from the right locus

Functions

  • create_segsites(): Creates segregating sites

  • get_snps(): Returns the SNP matrix from a segregating sites object.

  • get_positions(): Returns the SNP's positions from a segregating sites object.

  • set_positions(): Sets the SNP's positions in a segregating sites object.

  • get_trio_locus(): Returns the trio locus positions from a segregating sites object.

  • set_trio_locus(): Sets the trio locus in a segregating sites object.

  • is_segsites(): Checks whether an object is a segsites object.

  • create_locus_trio(): Combines three segregating sites to a locus trio

Author

Paul Staab

Details

A segregating sites object contains all SNPs for one genetic locus. Each object consists of three parts: A SNP matrix, a vector of SNP positions and a vector that states which transcript a SNP belong to, if the locus consists of multiple transscripts ('locus trio').

  • In the SNP matrix, each row represents a haplotype and each column represents a SNP. An entry is either 1 if the haplotype carries the derived allele for the SNP, or 0 if it carries the ancestral one.

  • In the positions vector, each entry gives the relative position of SNP in the corresponding column of the SNP matrix.

  • The trio_locus vector contains the trio locus each SNP belongs to. Entry of -1,0, 1 represent the left, middle, and right locus, respectively. For normal loci, this just consists of 0's

See Also

For converting biological data to segsites: as.segsites

Examples

Run this code
snps <- matrix(c(1, 0, 0,
                 1, 1, 0,
                 0, 0, 1), 3, 3, TRUE)
pos <- c(.1, .3, .5)
segsites <- create_segsites(snps, pos)
print(segsites)
get_snps(segsites)
get_positions(segsites)

# When subsetting individuals, sites that are not
# segregating in these are automatically removed:
segsites[1:2, 1:3]

Run the code above in your browser using DataLab