ggtree
ggtree copied to clipboard
Function "msaplot" shows bug when running with Package"seqinr".
The "read.fasta" function inside "msaplot" was masked by another function with the same name in "seqinr", lead to a error showing " Error in data.frame(name = names(seqs)[i], xmin = xmin, xmax = xmax, ymin = ymin[i], : arguments imply differing number of rows".
Thanks.
any reproducible example?
msaplot
should know the correct read.fasta
to be called.
I had the same problem. I don't think it is the problem of confusing seqinr
function through. I didn't library seqinr
, and still had the problem.
I am also having this problem.
# test.tree: (SampleID28:0.19693, SampleID2:0.19372);
# test.fasta:
# >SampleID2
# AACCGGCCAAGGGGCCAAAA
# >SampleID3
# AACCGGCCAAGGGGCCACAA
msaplot(ggtree(read.tree("ignore/repro/test.tree")), "ignore/repro/test.fasta")
After updating R to 3.5.1 and reinstalling seqinr, I no longer have this issue.
Hope it helps...
I also had this problem. For me, updating to R 3.5.1 and reinstalling seqinr did not help. I don't understand the cause of the issue. I can run the sample code for msaplot at https://bioc.ism.ac.jp/packages/3.2/bioc/vignettes/ggtree/inst/doc/advanceTreeAnnotation.html with no issue, so I think the cause is likely the format of one of my files. I did check that treeio::read.fasta()
works on my alignment, and it looks like it did just fine. I can also plot my tree in ggtree()
, but I just can't use msaplot()
to show the two side by side. If I try, I get the OP's error message ( Error in data.frame(name = names(seqs)[i], xmin = xmin, xmax = xmax, ymin = ymin[i], : arguments imply differing number of rows
).
I'm giving up for now and will just use other means to create my graph. If I figure out the core issue I'll post again here. I suspect the specs for the file format needed for msaplot are more brittle than documentation would have lead one to believe, but I can't be sure.
I'd be curious if the other commenters can (or could prior to upgrading R) run the example code:
beast_file <- system.file("examples/MCC_FluA_H3.tree", package="ggtree")
beast_tree <- read.beast(beast_file)
fasta <- system.file("examples/FluA_H3_AA.fas", package="ggtree")
msaplot(ggtree(beast_tree), fasta)
@curt-f don't use out-dated pkg and vignette.
Thanks for the advice -- and for writing ggtree
in the first place! It really is a marvelous tool. I rely on Google search to find the right documents, and I gather from your comment that maybe I shouldn't be? What would you recommend instead?
this commit should fixed the seqinr
issue.
@GuangchuangYu thanks for answering me in Wechat, I've edited the source code and reinstalled ggtree, but still got the same problem :(
this is simply due to taxa names in tree and sequence file are not consistent.
With example of @breckuh, now ggtree
throw more easy to follow msg:
taxa name in input sequences are not match with the ones on the tree, please check your input files...
I saved breckuh's testfile, modified taxa names in fasta file to SampleID28 and SampleID2, runned msaplot
and got error message like this:
Error: data
must be a data frame, or other object coercible by fortify()
, not a character vector
I'm totally confused now......
you need to follow https://github.com/GuangchuangYu/ggtree/issues/new and learn how to ask question. @achuiertu