Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with read.nexus.data and write.nexus.data #42

Closed
cboettig opened this issue Nov 22, 2013 · 11 comments
Closed

Compatibility with read.nexus.data and write.nexus.data #42

cboettig opened this issue Nov 22, 2013 · 11 comments
Milestone

Comments

@cboettig
Copy link
Member

Might imagine a user would want to extract character data that comes in nexus format (used by http://www.morphobank.org/, for instance) into NeXML.

Unfortunately, though ape provides read.nexus.data, the function is extraordinarily limited. For instance, it cannot handle spaces in species names or sequences, and appears to return only a list of elements named by taxa without any metadata about the traits themselves, at least in reading in my hand-edited nexus matrix from morpho. read.nexus.data also fails to read in (after a minute of cpu effort) even the example nexus file produced by ape's own write.nexus.data ...

Guessing these ape functions are not widely used. Perhaps there's a better alternative pipeline for getting the nexus data into NeXML that we can wrap?

@rvosa
Copy link
Contributor

rvosa commented Nov 25, 2013

How useful is phylobase's readNexus()?

@hlapp
Copy link
Contributor

hlapp commented Nov 25, 2013

Phylobase uses NCL for that. This is great on the one hand (using a known reference parser implementation rather than reinventing one), but getting NCL to compile and the package to link to is has been a repeated source of trouble, so I'm hesitant about recommending it.

@cboettig
Copy link
Member Author

@rvosa Thanks for reminding me about the phylobase version, certainly sounds like a promising alternative for R users to extract character data. As @hlapp says, we didn't want to introduce a hard dependency on phylobase since it occasionally disappears from CRAN due to complications from the NCL, but in this context we could add it to our SUGGESTS or ENHANCES list instead and merely point to it as a way R users can extract character data in the nexus format.

Unfortunately I haven't had any luck parsing my example nexus character file that a I downloaded from the MorphoBank repo.

Though this is not really an RNeXML issue, I thought showing the serializing of character data from MorphoBank into NeXML might be a good example.

@rvosa
Copy link
Contributor

rvosa commented Nov 26, 2013

By the way, you could also pipe the nexus through the nexus2nexml web
service and then read it as nexml :)

On Tue, Nov 26, 2013 at 12:48 AM, Carl Boettiger
[email protected]:

@rvosa https://github.com/rvosa Thanks for reminding me about the
phylobase version, certainly sounds like a promising alternative for R
users to extract character data. As @hlapp https://github.com/hlappsays, we didn't want to introduce a hard dependency on phylobase since it
occasionally disappears from CRAN due to complications from the NCL, but in
this context we could add it to our SUGGESTS or ENHANCES list instead and
merely point to it as a way R users can extract character data in the nexus
format.

Unfortunately I haven't had any luck parsing my example nexus character
filehttps://github.com/ropensci/RNeXML/blob/4894724c859b486e82aa4383fd2b2f0e4ead91f1/inst/examples/mbank_X962_11-22-2013_1534.nexthat a I downloaded from the MorphoBank repo.

Though this is not really an RNeXML issue, I thought showing the
serializing of character data from MorphoBank into NeXML might be a good
example.


Reply to this email directly or view it on GitHubhttps://github.com//issues/42#issuecomment-29254724
.

Dr. Rutger A. Vos
Bioinformaticist
Naturalis Biodiversity Center
Visiting address: Office A109, Einsteinweg 2, 2333 CC, Leiden, the
Netherlands
Mailing address: Postbus 9517, 2300 RA, Leiden, the Netherlands
http://rutgervos.blogspot.com

@cboettig
Copy link
Member Author

@rvosa That's a great idea. Um, can you point me to the nexus2nexml web service endpoint and documentation? Not seeing a link to it on the nexml.org homepage...

@hlapp
Copy link
Contributor

hlapp commented Nov 27, 2013

@cboettig @rvosa this is a useful service for testing etc, but I'm not sure it's a good idea to make important functions of the library dependent on an online connection and a website that I'm not sure is built for a lot of traffic.

@cboettig
Copy link
Member Author

@hlapp Thanks for the heads up. I don't think this is a core function RNeXML, as we're obviously focused on the nexml side and there are already the two nexus parsers available for R already; it's just a pity that they aren't as robust as one might hope (but that's part of the motivation for nexml after all). I guess we can just point users to phylobase::readNexus() for reading in nexus character data. As far as I can tell, ape::read.nexus is the popular solution for reading in nexus phylogenies in R, which we can then write out to nexml. As I've speculated in #44, I think most R users read in comparative trait data from csv/excel formats instead of nexus anyway, so I don't see this as getting heavy use.

@rvosa
Copy link
Contributor

rvosa commented Nov 27, 2013

You can POST a file to http://nexml.org/nexml/phylows/nex2xml (parameter
name 'file')

Dr. Rutger A. Vos
Bioinformaticist
Naturalis Biodiversity Center
Visiting address: Office A109, Einsteinweg 2, 2333 CC, Leiden, the
Netherlands
Mailing address: Postbus 9517, 2300 RA, Leiden, the Netherlands
http://rutgervos.blogspot.com

@cboettig
Copy link
Member Author

Cool that seems to work, but it doesn't seem to be able to parse this morphobank nexus file: https://github.com/ropensci/RNeXML/blob/master/inst/examples/mbank_X962_11-22-2013_1534.nex probably something weird with the file since none of the parsers can do anything with it.

@rvosa
Copy link
Contributor

rvosa commented Nov 28, 2013

Yup, it's probably the way the charlabels/statelabels construct is used.

Dr. Rutger A. Vos
Bioinformaticist
Naturalis Biodiversity Center
Visiting address: Office A109, Einsteinweg 2, 2333 CC, Leiden, the
Netherlands
Mailing address: Postbus 9517, 2300 RA, Leiden, the Netherlands
http://rutgervos.blogspot.com

@bomeara
Copy link

bomeara commented Nov 29, 2013

phylobase hasn't been booted off CRAN for quite some time now, and developers have responded fairly quickly (at least compared to many phylogenetics CRAN packages) in the past when it has been booted. That said, C++ code in R (the NCL) does introduce another point of failure, with the benefit being NCL's flexible Nexus handling. I'd personally go with phylobase for reading nexus files rather than creating another parser.

@cboettig cboettig added this to the CRAN Release milestone Mar 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants