unique-methods: Extract Unique Sequences

Description Usage Arguments Details Methods Examples

Description

unique returns a list with duplicate sequences removed.

Usage

1
2
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
	
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 Feb. 28, 2020, 5:08 p.m.