ggtree icon indicating copy to clipboard operation
ggtree copied to clipboard

Function "msaplot" shows bug when running with Package"seqinr".

Open Koohoko opened this issue 6 years ago • 12 comments

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.

Koohoko avatar Apr 04 '18 07:04 Koohoko

any reproducible example?

msaplot should know the correct read.fasta to be called.

GuangchuangYu avatar Apr 11 '18 06:04 GuangchuangYu

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.

ml3958 avatar Sep 17 '18 02:09 ml3958

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")

breckuh avatar Oct 23 '18 04:10 breckuh

After updating R to 3.5.1 and reinstalling seqinr, I no longer have this issue.

Hope it helps...

ml3958 avatar Oct 31 '18 15:10 ml3958

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 avatar Nov 06 '18 22:11 curt-f

@curt-f don't use out-dated pkg and vignette.

GuangchuangYu avatar Nov 07 '18 02:11 GuangchuangYu

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?

curt-f avatar Nov 07 '18 02:11 curt-f

this commit should fixed the seqinr issue.

GuangchuangYu avatar Nov 07 '18 08:11 GuangchuangYu

@GuangchuangYu thanks for answering me in Wechat, I've edited the source code and reinstalled ggtree, but still got the same problem :(

achuiertu avatar Nov 07 '18 10:11 achuiertu

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...

GuangchuangYu avatar Nov 07 '18 10:11 GuangchuangYu

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......

achuiertu avatar Nov 07 '18 11:11 achuiertu

you need to follow https://github.com/GuangchuangYu/ggtree/issues/new and learn how to ask question. @achuiertu

GuangchuangYu avatar Nov 08 '18 00:11 GuangchuangYu