haplotype network analysis with Pegas package in R

Hi all,
I am very new in haplotype analysis and have faced with some problems that I do not know how to solve.
I want to generate haplotype networks for sodium channel (DKr gene) in anopheles species. I have converted my vcf into fast file, produced multiple alignment with ClustalW and I am using “Pegas” package in R in order to generate the networks.
This is simply the R-code that I am using

library("ape")
library("pegas")
naso<-read.dna("test.2.fasta", format="fasta") 
naso

# list of indivduals
table(rownames(naso))
nasoHaps1 <- haplotype(naso)
nasoHaps1

ind.hap<-with(
  stack(setNames(attr(nasoHaps1, "index"), rownames(nasoHaps1))), 
  table(hap=ind, pop=rownames(naso)[values])
)
ind.hap[1:10, 1:9]  #print just a chunk


net <- haploNet(nasoHaps1)
plot(net, size = attr(net, "freq"))

plot(nasoNet, size=attr(net, "freq"), scale.ratio = 2, cex = 0.8, pie=ind.hap)
legend(50,50, colnames(ind.hap), col=rainbow(ncol(ind.hap)), pch=20)

I keep getting these error message:

> Warning messages: 1: In haplotype.DNAbin(naso) :   some sequences of
> different lengths were assigned to the same haplotype 2: In
> haplotype.DNAbin(naso) :   some sequences were not assigned to the
> same haplotype because of ambiguities

Could someone please guide me how I can resolve these two! how can I find ambiguous positions?
I appreciate any help.

Read more here: Source link