Giter Club home page Giter Club logo

rncl's Introduction

Build Status Build status Research software impact

An R interface to the NEXUS Class Library

This R package provides an interface to the C++ library NCL. It can parse efficiently common file formats used to store phylogenetic trees, especially NEXUS and Newick files.

This package is primarily intended to be used by package developers as it extracts the elements needed to build R objects that represent the content of the file. For instance, phylobase uses rncl to extract trees and/or data stored in NEXUS and Newick files to create objects of class phylo4 or phylo4d.

The package however provides two functions for users: read_nexus_phylo() and read_newick_phylo(). They read NEXUS and Newick files respectively, and return (a valid) phylo or multiPhylo object from the package ape. These functions differ from those found in ape (respectively read.tree and read.nexus) as rncl functions can read trees with singletons, and missing branch lengths. However, rncl adheres to the NEXUS standards and only accepts tip labels without white spaces and tip labels cannot be duplicated in the same tree.

Development versions for Windows

Because this package contains some C++ code, it can be tricky to build if you are using Windows. Unless you need a feature only available on GitHub, install rncl from CRAN.

Otherwise, you can obtain a binary version from here (unless the AppVeyor badge on top is gray, in which case you can download an older version or come back in a few minutes, or red meaning the current version is broken and you need to get an older version). Once in appveyor, look for the file named rncl_X.Y.Z.zip where X.Y.Z represent the version number (e.g., rncl_0.4.0.zip). Then you can install this compiled version of the package directly from R.

rncl's People

Contributors

dwinter avatar fmichonneau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rncl's Issues

Unexpected treatment of underscores

Take the example tree string:

> treeString <- "(((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3):6.3,Tyto_alba:13.5);";

Reading this into ape's read.tree OR phytools' read.newick gets us:

> ape::read.tree(text= treeString); # alt: phytools::read.newick(text=treeString);

Phylogenetic tree with 4 tips and 3 internal nodes.

Tip labels:
[1] "Strix_aluco"   "Asio_otus"     "Athene_noctua" "Tyto_alba"    

Rooted; includes branch lengths.

that is, underscores are preserved in names.

rNCL currently returns the following (warning omitted):

> fnm <- tempfile();
> cat(treeString, file=fnm);
> rncl::make_phylo(fnm, file.format="newick");

Phylogenetic tree with 4 tips and 3 internal nodes.

Tip labels:
[1] "Strix aluco"   "Asio otus"     "Athene noctua" "Tyto alba"    

Rooted; no branch lengths.

that is, replacing underscores with spaces. This causes some problems, say, when stripping out names to keep ott_ids (or the reverse).

Obviously the loss of branch lengths with rNCL is also a problem! But this issue involves only the names themselves.

edge matrix contains doubles

Dear @fmichonneau ,
I realized that rncl contains a major undocumented feature (bug?!?). The elements in the edge matrix are stored as double and not as integer. This requires more memory and comparisons like 'which(edge==1L)' are dangerous. I really had hard time finding a bug caused by double matrix once, it is extremely rare but it can happen. Also some function in phangorn would expect integers (I know I am selfish).
Cheers,
Klaus

UBSAN issues

nxstreesblock.h and nxsblock.h are triggering issues with UBSAN.

[CRAN] package documentation issue

You have file 'rncl/man/rncl.Rd' with \docType{package}, likely
intended as a package overview help file, but without the appropriate
PKGNAME-package \alias as per "Documenting packages" in R-exts.

This seems to be the consequence of the breaking change

Using @doctype package no longer automatically adds a -package alias.
Instead document _PACKAGE to get all the defaults for package
documentation.

in roxygen2 7.0.0 (2019-11-12) having gone unnoticed, see
r-lib/roxygen2#1491.

As explained in the issue, to get the desired PKGNAME-package \alias
back, you should either change to the new approach and document the new
special sentinel

"_PACKAGE"

or manually add

@Aliases rncl-package

if remaining with the old approach.

Please fix in your master sources as appropriate, and submit a fixed
version of your package within the next few months.

Fix unused variable warning

g++-5 -std=c++11 -fsanitize=address,undefined -fno-omit-frame-pointer -I/usr/local/lib/R/include -DNDEBUG -I. -DHAVE_INTTYPES_H -DASSERTS_TO_EXCEPTIONS -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -Wall -pedantic -mtune=native  -c GetNCL.cpp -o GetNCL.o
GetNCL.cpp: In function ‘Rcpp::List RNCL(SEXP, SEXP)’:
GetNCL.cpp:76:10: warning: unused variable ‘levelsUnif’ [-Wunused-variable]
     bool levelsUnif = paramsVec[2];

Speed-up removal of singletons

From an rotl user, this takes a very long time:

tol<-read_newick_phylo(file='draftversion4.tre', simplify = TRUE)

Most likely because of the time it takes to recompute the tree each time a singleton is dropped. Is there a way to speed that part up?

annotated tree read_nexus_phylo

Hi,

I am using the read_nexus_phylo command. It is definitely much faster than other similar commands for reading in big phylo trees. But I was wondering if it could take annotated information contained within a tree such as
Begin Trees; Tree tree1=((USA_CA_SCCPHD_UC183_2020:0.00008[&location="North America"],((Singapore_24_2020:0.00004[&location="Asia"],

Still doesn't install on Windows

Same error message:

Input:

install_github("fmichonneau/rncl")

Output, broken up for readability:

Installing github repo rncl/master from fmichonneau
Downloading master.zip from https://github.com/fmichonneau/rncl/archive/master.zip
Installing package from C:\Users\Shan\AppData\Local\Temp\Rtmpm6RsjB/master.zip
Installing rncl
"C:/PROGRA~1/R/R-31~1.1/bin/x64/R" --vanilla CMD INSTALL  \
  "C:\Users\Shan\AppData\Local\Temp\Rtmpm6RsjB\devtools2c6416384460\rncl-master"  \
  --library="C:/Users/Shan/Documents/R/win-library/3.1" --install-tests 

* installing *source* package 'rncl' ...
** libs

*** arch - i386
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf" -f
"C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="rncl.dll"
OBJECTS="GetNCL.o RcppExports.o ancestors.o checkPhylo4.o descendants.o nxsassumptionsblock.o nxsblock.o nxscharactersblock.o
nxscxxdiscretematrix.o nxsdatablock.o nxsdistancedatum.o nxsdistancesblock.o nxsemptyblock.o
nxsexception.o nxsmultiformat.o nxspublicblocks.o nxsreader.o nxssetreader.o nxsstring.o
nxstaxablock.o nxstoken.o nxstreesblock.o nxsunalignedblock.o phyloXX.o reorderBinary.o reorderRobust.o"' had status 127
ERROR: compilation failed for package 'rncl'
* removing 'C:/Users/Shan/Documents/R/win-library/3.1/rncl'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.