Loading .jplace file in R: Premature EOF (right here) ---------^

1,232 views
Skip to first unread message

Michael Doane

unread,
Nov 29, 2017, 4:22:43 PM11/29/17
to ggtree
Hi all,

This may be a simple fix, however looking online, I have been unable to resolve my issue. When attempting to import my .jplace file into R, I received this error:

Error: parse error: premature EOF
                                       
                     (right here) ------^

Searching this error, it appears this is a common output and there are a variety of ways discussed for clearing the problem. However, I am unable to resolved this issue for .jplace files. Is the complexity of this type of JSON file causing this problem?

How can in proceed in determining a fix to this problem for a .jplace file?

Thank you in advance for any and all help.
Michael Doane

Yu, Guangchuang

unread,
Nov 29, 2017, 10:20:30 PM11/29/17
to Michael Doane, ggtree

you need to follow the guide and provide reproducible example.


--
G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data, Methods in Ecology and Evolution, 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
 
Homepage: https://guangchuangyu.github.io/ggtree
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree+unsubscribe@googlegroups.com.
To post to this group, send email to bioc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/c860e384-39d6-44dc-aaa9-0489204bf0c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
--~--~---------~--~----~------------~-------~--~----~
Guangchuang Yu PhD
Postdoc researcher
State Key Laboratory of Emerging Infectious Diseases
School of Public Health
The University of Hong Kong
Hong Kong SAR, China
-~----------~----~----~----~------~----~------~--~---

Michael Doane

unread,
Nov 30, 2017, 3:20:02 PM11/30/17
to ggtree
Hi,

Here is the command being used:

#load library
library("ggtree")

#parsing jplace file
sharks <- system.file("sharks.jplace",  package="treeio")

#reading jplace file
sharks_jp <- read.jplace(sharks)

#error upon reading jplace file
Error: parse error: premature EOF
                                       
                     (right here) ------^

Here is my jplace file I am attempting to parse and read in R. The .jplace file was generated using the workflow software Phylosift, which incorporates pplacer.

Thank you

On Wednesday, November 29, 2017 at 7:20:30 PM UTC-8, Yu, Guangchuang wrote:

you need to follow the guide and provide reproducible example.

On Thu, Nov 30, 2017 at 5:22 AM, Michael Doane <mpdo...@gmail.com> wrote:
Hi all,

This may be a simple fix, however looking online, I have been unable to resolve my issue. When attempting to import my .jplace file into R, I received this error:

Error: parse error: premature EOF
                                       
                     (right here) ------^

Searching this error, it appears this is a common output and there are a variety of ways discussed for clearing the problem. However, I am unable to resolved this issue for .jplace files. Is the complexity of this type of JSON file causing this problem?

How can in proceed in determining a fix to this problem for a .jplace file?

Thank you in advance for any and all help.
Michael Doane

--
G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data, Methods in Ecology and Evolution, 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
 
Homepage: https://guangchuangyu.github.io/ggtree
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree...@googlegroups.com.

To post to this group, send email to bioc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/c860e384-39d6-44dc-aaa9-0489204bf0c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
sharks_cat.fastq.jplace.gz

Yu, Guangchuang

unread,
Dec 4, 2017, 2:21:30 AM12/4/17
to Michael Doane, ggtree

To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree+unsubscribe@googlegroups.com.

To post to this group, send email to bioc-...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

lucas...@h-its.org

unread,
Apr 23, 2019, 1:30:32 PM4/23/19
to ggtree
The link is no longer available. But it seems this might be the new location: https://guangchuangyu.github.io/software/ggtree/faq/

The error message "premature EOF" is not really helpful, and using `system.file` in the examples when this is actually not intended for working code might not be the best idea. Maybe the examples should use normal file paths instead, so that copying the code just works out of the box. This is more user-friendly in my opinion.

By the way, the FAQ says: "A very common issue is that users always copy-paste command without looking at the function’s behavior." - while this is certainly true, it is still better to provide exemplary code that just works, instead of something that only works for the specific test files...

Lucas

To unsubscribe from this group and stop receiving emails from it, send an email to bioc-...@googlegroups.com.

To post to this group, send email to bioc-...@googlegroups.com.

Michael Doane

unread,
Apr 23, 2019, 5:58:32 PM4/23/19
to ggtree
Hi,

Glad there was a post here as I forgot about this. To get around this issue, my group developed an alternative to using the treeio function for reading .jplace files right into ggtree. The code we developed takes .jplace and convert it to .nwk for use in many different programs for visualization and analysis. The .nwk can be then read into ggtree quite easily. 

The link to our github is: https://github.com/linsalrob/pbj_placer

Cheers,

lucas...@h-its.org

unread,
Apr 24, 2019, 11:04:28 AM4/24/19
to ggtree
Hi Michael,

thanks for sharing the link, that looks like an interesting tool. However, I do not yet fully understand what its use case is.

Firstly, as stated in the ggtree FAQ that I linked to in my previous post, there is no real issue with reading in jplace in ggtree. It's just that the `system.file` command needs to be left out, meaning that simply `read.jplace("path/to/file.jplace")` does the job. So, ggtree can work with jplace files.

Furthermore, iTOL also offers to read jplace files (see https://itol.embl.de/help.cgi), and can for example visualize the distribution of reads on the tree.

Your tool seems to expect some additional information such as a taxonomy. I am not really familiar with PhyloSift - is the additonal information available anyway when using PhyloSift? Can your tool also be used for the "normal" use case of phylogenetic placement of reads, outside of the PhyloSift workflow? Maybe an example of what the end result looks like after using your tool might help.

Finally, as a side note, you might be interested in a few other resources relating to phylogenetic placement. Recently, we introduced EPA-ng (https://github.com/Pbdas/epa-ng), a new, way faster implementation of the algorithm compared to pplacer and RAxML-EPA. Furthermore, we have developed a library for working with placement data (https://github.com/lczech/genesis) as well as a tool for analyzing such data (https://github.com/lczech/gappa), which might be interesting for you. Lastly, we have started a little Google Group for discussing placement stuff (https://groups.google.com/forum/#!forum/phylogenetic-placement). Maybe these resources help you.

All the best
Lucas
Reply all
Reply to author
Forward
0 new messages