caitiecollins / treeWAS

treeWAS: A Phylogenetic Tree-Based Tool for Genome-Wide Association Studies in Microbes
Other
94 stars 18 forks source link

Too few positive probabilities Error #54

Closed amzurita closed 3 years ago

amzurita commented 4 years ago

Hi!

I have been trying to use treeWAS to analyze my own dataset of variant calls plus a binary resistance phenotype (Resistant/Sensitive). Without providing a tree or ancestral reconstruction, I keep running into the following error:

out <- treeWAS(snps = t_snps_m,
+                phen = phen_m,
+                seed = 1)
If tree is not a phylo object, please specify one of the following reconstruction methods:
          'NJ', 'BIONJ', 'parsimony', 'NJ*', 'BIONJ*'. Choosing 'BIONJ' by default.
Setting 5 negative branch lengths to zero.
Error in sample.int(length(x), size, replace, prob) : 
  too few positive probabilities
In addition: Warning message:
In if (class(dna) != "DNAbin") { :
  the condition has length > 1 and only the first element will be used

Do you know what the issue is?

I have tried a few things:

Thank you a lot, Aina

muxiaoxin51 commented 2 years ago

I guess in tree="NJ" condition, the following makes 'if (class(dna) != "DNAbin")' error. In function treeWAS() , tree <- tree.reconstruct(dna=snps, method = tree, dist.dna.model = dist.dna.model, plot = FALSE), cause this 'if (class(dna) != "DNAbin")' error. and in function tree.reconstruct(), class(dna) return c("matrix","array") with R version 4.2.1, while 'if (class(dna) != "DNAbin")' need class(dna) return "matrix" only. But I don't know how to set class return "matrix" only.

caitiecollins commented 2 years ago

Thank you for pointing this out. I've just pushed a small change that should fix this in future, if you reinstall treeWAS. But please let me know if you run into any other problems.

Best, Caitlin.