Hi All,
I'm looking for a way to extract singleton haplotypes using the haplotype
function in Pegas.
I use the below function to accomplish this:
extract.singleton.haps <- function(freq) {
ind <- which(freq == 1) # index of singleton haplotypes
single <- seqs[ind, ] # extracted haplotypes (only singletons)
}
I have tried the following:
library(pegas)
seqs <- read.dna(file = file.choose(), format = "fasta") # select FASTA
file
freq <- haplotype(seqs) # haplotype distribution
freq <- lengths(attr(freq, "index") # extract haplotypes
singleton.seqs <- extract.singleton.haps(freq)
write.dna(singleton.seqs, file = paste0(taxon, "_singletons.fas"),
format = "fasta")
However, upon viewing the sequences in MEGA, they appear to all be
identical, instead of unique.
Any ideas on what is happening here?
Thanks.
Cheers,
Jarrett
[[alternative HTML version deleted]]
_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/