gtonkinhill / fastbaps

A fast approximation to a Dirichlet Process Mixture model (DPM) for clustering genetic data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Index out of bounds

pedrosenna opened this issue · comments

Hi,

I was testing fastbaps with mitochondrial DNA sequences and these errors popped out when running some functions. Here's an example:

library(ape)
library(fastbaps)

data("woodmouse")

wood.sparse <- import_fasta_sparse_nt(woodmouse)
wood.sparse.optim <- optimise_prior(wood.sparse, type="optimise.baps")

Error in tree_llk(temp.sparse.data, temp.h$merge) :
Mat::operator(): index out of bounds

baps.res <- fast_baps(wood.sparse)

[1] "Calculating initial clustering..."
[1] "Calculating initial dk values..."
[1] "Clustering using hierarchical Bayesian clustering..."
Error in bhier_parallel(sparse.data, initial.partition, dk.initial, n.cores) :
Mat::operator(): index out of bounds

What can i do?

Hi Pedro,

Thanks very much for pointing this out. This turned out to be due to inconsistencies in the way fastbaps handles data loaded directly using the import_fasta_sparse_nt function and indirectly using ape. In the latter case, if the alignment included gaps or Ns the subsequent functions would crash.

I have now pushed an update that should hopefully fix this issue.

These updates are now available in the latest release (v1.0.8)