unique-methods: Extract Unique Sequences

unique-methodsR Documentation

Extract Unique Sequences

Description

unique returns a list with duplicate sequences removed.

Usage

## S4 method for signature 'Dna'
unique(x,gaps=FALSE)

Arguments

x

an object of class Dna.

gaps

boolean; gaps are removed if this is FALSE.

Details

This function behaves somehow similar to haplotype, however indels and missing characters are not taken into account.

Methods

signature(x = "Dna")

Examples

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

##gaps removed.
unique(x)

##gaps not removed.
unique(x,gaps=TRUE)

##unique vs. haplotype
#unique returns 5 unique sequences.
unique(x)
length(unique(x))

#haplotype returns 4 unique haplotypes with simple indel coding.
h<-haplotype(x)
as.list(as.dna(h))
length(h)

#haplotype returns 3 unique haplotypes with gaps as missing.
h<-haplotype(x, indels="m")
as.list(as.dna(h))
length(h)


haplotypes documentation built on July 26, 2023, 5:22 p.m.