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