Learn R Programming

haplotypes (version 1.1.3.1)

haplotype-methods: Methods for function haplotype in the package haplotypes

Description

Collapses identical DNA sequences into haplotypes or infering haplotypes using user provided absolute pairwise character difference matrix.

Usage

# S4 method for Dna
haplotype(x,indels="sic")
# S4 method for dist
haplotype(x)
# S4 method for matrix
haplotype(x)

Value

haplotype returns an object of class Haplotype, as.list-methods can be used to coerce the object to a list.

Arguments

x

an object of class Dna, dist, or matrix.

indels

the indel coding method to be used. This must be one of "sic", "5th" or "missing". Any unambiguous substring can be given. See distance for details.

Methods

signature(x = "Dna")

Inferring haplotypes from DNA sequences.

signature(x = "dist")

Inferring haplotypes using an absolute pairwise character difference matrix (dist object).

signature(x = "matrix")

Inferring haplotypes using an absolute pairwise character difference matrix.

Author

Caner Aktas, caktas.aca@gmail.com

Examples

Run this code
	
data("dna.obj")
x<-dna.obj[1:6,,as.matrix=FALSE]

##Inferring haplotypes using 'Dna' object.
# coding gaps using simple indel coding method
h<-haplotype(x,indels="sic")
h

# giving DNA sequences of haplotypes
as.dna(h) 

if (FALSE) {
	
## Slots of an object Haplotype	
h@haplist  #haplotype list (names)
h@hapind  #haplotype list (index)
h@uniquehapind  #getting index of the first occurrence of haplotypes
h@sequence  #DNA sequences of haplotypes
h@d  #distance matrix of haplotypes
h@freq  #haplotype frequencies
h@nhap  #total number of haplotypes
}

## Inferring haplotypes using dist object. 
d<-distance(x)
h<-haplotype(d) 
h
if (FALSE) {
# returns an error message 
as.dna(h)
} 

## Inferring haplotypes using distance matrix.
d<-as.matrix(distance(x))
h<-haplotype(d) 
h
if (FALSE) {
# returns an error message
as.dna(h)
}  

Run the code above in your browser using DataLab