Re: [R-sig-phylo] Extracting only FASTA sequences from a FASTQ file

2024-03-11 Thread Emmanuel Paradis
Hi Jarrett, First, there are a lot of tools in the bioinformatics community that can convert FATSQ files to FASTA far more efficiently than ape does (I think cutadapt can do that, but surely many others too). But with a small file like this one, ape can do the job :) See below for specific

Re: [R-sig-phylo] chronos ape substitution rate strict clock

2024-03-07 Thread Emmanuel Paradis
re how to make ape::node.dating() >> accept a >> >> substitution rate rather than try to estimate one. Maybe an option >> could be >> >> added to allow mu to equal a user-specified number rather than the >> output >> >> of ape::estimate.mu()? >> >&

Re: [R-sig-phylo] chronos ape substitution rate strict clock

2024-03-07 Thread Emmanuel Paradis
also apply that logic to date all > of the nodes by using the mean pairwise distances between taxa on either side > of a node and converting that to divergence times (although the R code for > such > a calculation would likely take me a while to figure out). Would that be > another o

Re: [R-sig-phylo] chronos ape substitution rate strict clock

2024-03-02 Thread Emmanuel Paradis
Hi Vincenzo, There's no direct way to do this with ape::chronos(). You may have a look at the function phangorn::pml_bb() but I'm not sure it can estimate the dates if the rate is provided in a model object given as main argument(?) That said, I expect that estimating so many dates to be very

Re: [R-sig-phylo] Highlighting Specific Clades in a Lineage-Through-Time Plot

2023-10-26 Thread Emmanuel Paradis
Hi Russell, There are several implementations of LTT plots among several packages, so the details certainly differ depending on which one(s) you use. Maybe you can use the ape function ltt.plot.coords() which returns a matrix with 2 columns giving the number of lineages for each node time of

Re: [R-sig-phylo] Correlation coefficient from a PGLS

2023-07-21 Thread Emmanuel Paradis
Hi Lior, R-squared and Pearson's coefficient are two different things: R-squared (aka coefficient of determination) quantifies the quantity of variance of a variable (the response, 'y' in your example) that is explained by the model where some predictors can be controlled by the experimenter.

Re: [R-sig-phylo] Parallelization in ape::dist.topo

2023-03-07 Thread Emmanuel Paradis
To follow (tangently) on Klaus' message, I've released a book last year on some advanced topics in R programming and development: https://hal.ird.fr/ird-03850685 Chapter 9 is on parallelization and HPC. There are a few (detailed) examples showing when multi-core is benefitial and when it is

Re: [R-sig-phylo] Parallelization in ape::dist.topo

2023-03-07 Thread Emmanuel Paradis
Hi Vojtěch, The GH repos for ape is: https://github.com/emmanuelparadis/ape I had a quick look at your code and these are interesting improvements. It seems also possible to improve the basic code of dist.topo() (e.g., using bitsplits) so it is worth opening an issue. Cheers, Emmanuel

Re: [R-sig-phylo] NAMESPACE issue

2023-02-28 Thread Emmanuel Paradis
Hi Kevin, Do you run the checks of a new version of windex on this site: win-builder.r-project.org/ ? It runs the checks both on Debian and Windowns with several choices of R versions, and you can access the detailed log files. Best, Emmanuel - Le 28 Fév 23, à 17:38, Arbuckle

Re: [R-sig-phylo] Extracting intraspecific and interspecific distances from dist.dna() object

2022-11-01 Thread Emmanuel Paradis
> intraspecific and interspecific distances. However, it differs as well, so > there is some added confusion. > x3 <- sppDist(anoDist, anoSpp) > intra <- x3$intra > inter <- x4$inter This gives me: R> identical(x3$intra, intra1) [1] TRUE Be careful that the distances in x3$inter

Re: [R-sig-phylo] Extracting intraspecific and interspecific distances from dist.dna() object

2022-10-18 Thread Emmanuel Paradis
Hi Jarrett, If you have a vector of species names (say 'taxa'), then: o <- outer(taxa, taxa, "==") returns a logical matrix with TRUE when the two strings in 'taxa' are the same, FALSE if they are different (so the diagonal is TRUE). Since you return the output of dist.dna() as a matrix, then

[R-sig-phylo] [2nd announcement] "Bioinformatics: The Next 20 Years" (Oct 27)

2022-09-28 Thread Emmanuel Paradis
Dear all, Registration is now open: https://meeting-nstda.webex.com/meeting-nstda/j.php?RGID=r49da897c6a68260a5bf2bdf41763bcba Cheers, Emmanuel ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org

[R-sig-phylo] wrong behaviour of is.monophyletic() with duplicated labels

2022-02-20 Thread Emmanuel Paradis
(Posted to: r-sig-phylo and GitHub) Hi all, is.monophyletic() does not work correctly when some tip labels are duplicated. Here's a simple example: R> tr <- read.tree(text = "((A,B),(A,C));") The two tips labelled "A" are not sister-lineages, but the current version of ape gives: R>

Re: [R-sig-phylo] Substitution model rate matrix - how to read it?

2021-11-27 Thread Emmanuel Paradis
Hi Martin, Rates are generally relative quantities in phylogenetics. You cannot estimate the substitution rate(s) together with the branch lengths of the tree, but rates can be estimated relative to each others. That's why one rate is fixed to 1 in the GTR model. In the JC69 model the

Re: [R-sig-phylo] Trimming protein alignment

2021-11-02 Thread Emmanuel Paradis
Ha! That's because gaps are coded with dashes in your files; I assumed it was X's (as returned by ape::trans). So this line 7 should be: foo <- function(x) sum(x == 0x58 | x == 0x2d) Or (probably easier to modify): foo <- function(x) sum(x == charToRaw("X") | x == charToRaw("-"))

Re: [R-sig-phylo] Trimming protein alignment

2021-11-02 Thread Emmanuel Paradis
Hi Vojtěch, In addition to removing lines 3 and 4, replace line 7: foo <- function(x) sum(x == 4) by: foo <- function(x) sum(x == 0x58) That sh(c)ould do it. Best, Emmanuel - Le 2 Nov 21, à 17:37, Vojtěch Zeisek vo...@trapa.cz a écrit : > Hello, > I try to trim protein

Re: [R-sig-phylo] Ancestral state reconstruction, polytomies and the absence of branch lengths

2021-09-17 Thread Emmanuel Paradis
Hi Jake & Diego, Maybe a very small modification to ace() could help to accomodate some of these issues. Currently, ace(type = "discrete") checks the branch lengths of the tree and throws an error if any of them is zero or negative. I think zero-length branches could be allowed. This seems

Re: [R-sig-phylo] dist.nodes

2021-09-06 Thread Emmanuel Paradis
Hi, A tree has n terminal nodes (aka tips) and m internal nodes (aka nodes simply). In the edge matrix, the tips are numbered 1:n and the nodes are numbered (n+1):(n+m) (same than n+1:m). n and m can be found with: n <- Ntip(tree) # or length(tree$tip.label) m <- Nnode(tree) # or tree$Nnode

Re: [R-sig-phylo] Extracting sequences from DNAbin according to a condition

2021-06-27 Thread Emmanuel Paradis
Hi Jarrett, - Le 28 Juin 21, à 5:08, Jarrett Phillips phillipsjarre...@gmail.com a écrit : > Hello All, > > I have a COI FASTA alignment file with 11926 sequences spanning 668 species. > > According to my code, a total of 361 species are represented by 6 or more > sequences. > > I need to

Re: [R-sig-phylo] Phylogenetic network / ARG representation in ape

2021-05-21 Thread Emmanuel Paradis
Hi Yan, - Le 18 Mai 21, à 23:48, Yan Wong y...@pixie.org.uk a écrit : > Dear R-Sig-Phylo, > > I’m interested in representations of ancestral recombination graphs (ARGs). > From > my reading of the extended Newick format (G. Cardona et al., 2008), and the > ape/evonet documentation, it

Re: [R-sig-phylo] Error in Fitting OU Model in R

2021-05-18 Thread Emmanuel Paradis
Hi Russell , It can happen that PGLS models have difficulties to fit to the data when there is a free parameter in the correlation structure. This is the case of corMartins and corPagel. A way around is to set 'fixed = TRUE' when creating these correlation structures which has the effect of

Re: [R-sig-phylo] How to sort trait data according to tree

2021-05-17 Thread Emmanuel Paradis
es are ordered correctly whether they are involved as predictors (in 'model = '), in the correlation structure, or in the variance function ('weights = '). Best, Emmanuem > Anyway, thank you! > Marguerite > On Sun, May 16, 2021 at 7:03 PM Emmanuel Paradis < [ > mailto:emmanuel.pa

Re: [R-sig-phylo] How to sort trait data according to tree

2021-05-16 Thread Emmanuel Paradis
Hi Marguerite, The issue is about nlme::gls. The help page ?gls says: data: an optional data frame containing the variables named in ‘model’, ‘correlation’, ‘weights’, and ‘subset’. By default the variables are taken from the environment from which ‘gls’ is

Re: [R-sig-phylo] Extract singleton haplotypes with pegas::haplotype()

2021-04-26 Thread Emmanuel Paradis
Hi Jarrett, - Le 27 Avr 21, à 0:09, Jarrett Phillips phillipsjarre...@gmail.com a écrit : > Hi All, > > I'm looking for a way to extract singleton haplotypes using the haplotype > function in Pegas. > > I use the below function to accomplish this: > >extract.singleton.haps <-

Re: [R-sig-phylo] ape: error in pcoa

2021-04-24 Thread Emmanuel Paradis
Hi Juan, There is a bug in pcoa() when only one axis is selected by the function. You can fix it by editing the function with fix(pcoa) and modify line 38 (or close depending on how the editor arranges the lines of code): vectors <- sweep(D.eig$vectors[, 1:k], 2, sqrt(eig[1:k]), FUN = "*")

Re: [R-sig-phylo] identifying phylogenetically equivalent nodes

2021-02-18 Thread Emmanuel Paradis
Hi Jacob, ape::makeNodeLabel(phy, method = "md5sum") returns 'phy' with node labels that depend on the tips descendant from each node. For instance: tr3 <- makeNodeLabel(rtree(3), m = "m") tr4 <- makeNodeLabel(rtree(4), m = "m") any(tr3$node.label %in% tr4$node.label) If you repeat these 3

Re: [R-sig-phylo] Nonsensical likelihoods returned when using the 'ace' function and the 'all rates different' model in the R package: 'Ape'

2021-01-29 Thread Emmanuel Paradis
Hi Joe, I'd say this issue is related to these particular data: there are four states so the ARD model has 12 parameters which is quite a lot considering that one state ('3') is overwhelming represented in the data. If you simulate data with two states, then the ARD model has only 2 parameters

Re: [R-sig-phylo] Phylogenetic Signal in Internal Node Data

2021-01-26 Thread Emmanuel Paradis
Hi Matt, You can think about a randomization procedure: rTraitDisc(), rTraitCont(), and rTraitMult() all have the option 'ancestor' to output the values of a trait simulated along a phylogeny for all terminal and internal nodes. HTH Best, Emmanuel - Le 27 Jan 21, à 0:42, Matthew Helmus

Re: [R-sig-phylo] Plotting phylogenetic tree

2021-01-19 Thread Emmanuel Paradis
Hi Saleh, Two functions in ape can help you: ?zoom ?trex There may be others in other packages. Best, Emmanuel - Le 19 Jan 21, à 19:42, Saleh Rahimlou saleh_rahim...@hotmail.com a écrit : > Hello, > > How can I collapse some clades plotting a big phylogenetic tree to magnify my >

Re: [R-sig-phylo] Error in corFactor when running gls to obtain lambda

2021-01-03 Thread Emmanuel Paradis
Hi Chris, It is not clear from your message where the error occurred. Can you please send a reproducible example? I don't think the last model fit (output named 'OLS') gives an error since gls() with no correlation structure is equivalent to using lm(). Also if you use fixed=1 this is the

Re: [R-sig-phylo] error with bind.tree + ladderize

2020-10-25 Thread Emmanuel Paradis
Hi Joseph, Thanks for reporting this. It seems indeed that reordering the output of bind.tree() fixes it. A way to do it is: attr(t2, "order") <- NULL t2 <- reorder(t2) It seems to solve the different problems (balance(t2) doesn't work correctly too). I'll add these 2 lines as the end

Re: [R-sig-phylo] Multi2di still not generating equiprobable trees

2020-10-20 Thread Emmanuel Paradis
Hi Yan, You're correct: multi2di() calls rtree(, equiprob = TRUE) which generates the random topology. Actually, the unlabelled topologies are generated with equal probabilities. For the labelled topologies, this is a bit more complicated. In the case n = 4 tips, there are two unlabelled

Re: [R-sig-phylo] ape package in R

2020-09-19 Thread Emmanuel Paradis
Hi, Actually, Ranjita can use the number of gene copies if it is reasonable to assume that these numbers evolve among samples, maybe a stepwise model with transitions: n -> n + 1 n -> n - 1 In that case, a simple approach is to calculate the Euclidean distances among samples and do an NJ or

Re: [R-sig-phylo] Problem - removing the extinct taxa from trees

2020-08-26 Thread Emmanuel Paradis
Hi Elvira, If you are interested in keeping the "surviving species" from phylogenies, it may be better to use a birth-death model to simulate the trees. There are 3 functions in ape to do this: they are documented in the same help page than drop.fossil() and they have options that make them

[R-sig-phylo] bug in boot.phylo

2020-07-19 Thread Emmanuel Paradis
Hi all, The current version of ape on CRAN (5.4) has a bug in its function boot.phylo: all returned values are 0. The bug has been fixed; however, because it was in ape's internal C code, this requires a complete reinstallation of the package. A new version of ape with the version number

Re: [R-sig-phylo] Warning in ape::mst() in R 4.0

2020-07-01 Thread Emmanuel Paradis
Hi Kelly, Thanks! This is fixed. Best, Emmanuel - Le 1 Juil 20, à 23:20, Kelly Street street.ke...@gmail.com a écrit : > Hello, > > Thank you for all your work developing and maintaining this great package! > This is likely a known issue already (and not a critical one), but since > the

Re: [R-sig-phylo] Breaking polytomies such that all topologies are equiprobable

2020-06-29 Thread Emmanuel Paradis
re is also a connection between tree ranking and topological distances (see ?nni in phangorn). Best, Emmanuel > Cheers > > Yan > >> On 27 Jun 2020, at 10:33, Emmanuel Paradis wrote: >> >> Hi Yan, >> >> multi2di() calls rtree() if random = TRUE. As you ri

Re: [R-sig-phylo] Breaking polytomies such that all topologies are equiprobable

2020-06-27 Thread Emmanuel Paradis
Hi Yan, multi2di() calls rtree() if random = TRUE. As you rightly guessed, the algorithm used by this latter function is (described in APER2, p. 313): 1. Draw randomly an integer a on the interval [1, n − 1]. Set b = n − a. 2. If a > 1, apply (recursively) step 1 after substituting n by a. 3.

Re: [R-sig-phylo] collapsing sets of nodes based on label values

2020-05-22 Thread Emmanuel Paradis
Hi, Brian is 100% right about interpreting bootstrap values. When the tree is input into R with read.tree() or read.nexus(), these values are attached to the nodes but they relate to their subtending branches. The function root() has the option 'edgelabel' to specify whether these node labels

Re: [R-sig-phylo] Improves haplotype() function in pegas 0.13

2020-05-14 Thread Emmanuel Paradis
Hi Jarrett, I'm Cc'ing to r-sig-genetics since we had a recent discussion on a similar topic (see below). - Le 14 Mai 20, à 9:59, Jarrett Phillips phillipsjarre...@gmail.com a écrit : > Hello, > > Emmanuel Paradis has recently updated the haplotype() function in pegas > 0.1

Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of ape in R

2020-04-06 Thread Emmanuel Paradis
one thing I did not think of yet, and you can help me figure > it > out. In any case, thank you for your help. I really appreciated it. > Kind regards, > Coline > From: Emmanuel Paradis [mailto:emmanuel.para...@ird.fr] > Sent: Monday, 6 April 2020 16:47 > To: Coline Boonman >

Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of ape in R

2020-04-06 Thread Emmanuel Paradis
(converted to a matrix: is.complex(as.matrix(mat_dissim_Eucl)) ) R gives me the result FALSE. That means that there are no complex numbers in the input for the pcoa, right? I hope you or someone else has another suggestion on why I get this error. Kind regards, Coline From: Emmanuel

Re: [R-sig-phylo] Question on min(D.eig$values) in pcoa function of ape in R

2020-04-01 Thread Emmanuel Paradis
Hi Coline, This is strange: you calculate a distance matrix with daisy(), so the as.matrix() operation should return a symmetric matrix. Symmetric (real) matrices have all their eigenvalues real numbers. Maybe some complex values were produced by daisy()? Best, Emmanuel - Le 30 Mar

Re: [R-sig-phylo] BD process in Nee et al. (1994)

2020-03-14 Thread Emmanuel Paradis
Hi Karla, ape has several functions to simulate trees that make use of these formulas (see ?rphylo). However, the formulas you are looking for may not be directly accessible from R, so you need to check the sources of ape. You may also need to use the last testing version of ape since a bug

Re: [R-sig-phylo] Iterating though multiple FASTA files via rbind.DNAbin

2020-03-12 Thread Emmanuel Paradis
Hi Jarrett, read.FASTA() always returns a list. So you may do something (quite general) like: fls <- dir(pattern = "\\.fas$|\\.fasta$", ignore.case = TRUE) # add more file extensions if needed X <- lapply(fls, read.FASTA) seqlen <- lengths(X) if (length(unique(seqlen)) == 1) X <- as.matrix(X)

Re: [R-sig-phylo] PEGAS: assignment to haplotype when missing information

2020-02-26 Thread Emmanuel Paradis
Hi Hirra, The assignment is not random, it follows the order of the sequences in the data: - Seqs. A and B are compared and found to be identical so they are both assigned to haplotype I. - Seq. C is compared to haplotype I (effectively seq. A) and found to be different so it is assigned to

Re: [R-sig-phylo] A test for valid phylo object (ape package) for package developers

2019-11-07 Thread Emmanuel Paradis
Hi, To answer Elizabeth's question: there is no function that does what you asked for in your first message. Liam's solution is certainly the best solution for the moment. I'll have a look at it later. The code checkValidPhylo() needs to be dusted off a bit: the diagnostic " MODERATE: some

Re: [R-sig-phylo] Recursive addition along a tree

2019-08-05 Thread Emmanuel Paradis
Hi Mario, In the class "phylo", nodes and tips are numbered sequentially so it is no problem to have data associated with both. This is done in many functions in ape and in phangorn. I think the solution to your headaches is in this document (§ 4.4):

Re: [R-sig-phylo] comparePhylo

2019-06-13 Thread Emmanuel Paradis
Hi Saleh & Will, I'm not sure whether phytools::cophylo does the same thing than ape::comparePhylo (maybe rather ape::cophyloplot). comparePhylo() is actually aimed for data exploration/summary rather than for producing publication-ready graphs. That said, there is a trick to play with the

[R-sig-phylo] new package phylobench

2019-03-21 Thread Emmanuel Paradis
Hi all, The package 'phylobench' has recently been released on GitHub. It aims to provide tools for "phylogenetic benchmarking" by performing data analyses, tests, or simulations using functions in other packages, and comparing the outputs with expected or predicted values. Currently, 12

Re: [R-sig-phylo] Problem date consensus phylogeny

2019-01-25 Thread Emmanuel Paradis
, nice to know that I have a plan B! I will take a look! Thanks in advance, Best Regards, Alina Em qua, 23 de jan de 2019 às 16:29, Emmanuel Paradis mailto:emmanuel.para...@ird.fr>> escreveu: Hi Alina, Did you try multi2di() to remove polytomies? Best, Emmanuel Le 23/

Re: [R-sig-phylo] Problem date consensus phylogeny

2019-01-23 Thread Emmanuel Paradis
Hi Alina, Did you try multi2di() to remove polytomies? Best, Emmanuel Le 23/01/2019 à 17:41, Alina van dijk a écrit : Hi everyone, My name is Alina, I'm attending master degree in ecology and I have a little problem with my consensus phylogeny. I used 1000 phylogeny of birdtree to construct

Re: [R-sig-phylo] exponential time with write.tree

2019-01-23 Thread Emmanuel Paradis
Hi Jérémie, You're correct: the current version of write.tree() scales with n^2. This seems to be related to calling the generic '[[' operator. You can modify the code with the usual fix(write.tree), then insert these two lines: phy <- .uncompressTipLabel(phy) class(phy) <- NULL

Re: [R-sig-phylo] Logarithmic Scales for Plotting Dated Phyogenies (e.g. Log of Time Axis?)

2019-01-08 Thread Emmanuel Paradis
Hi David, Have you tried ape::plotBreakLongEdges? I think that would be the simplest solution to your problem. I'm not clear how a non-linear transformation could be implemented easily (and be meaningful in most situations). Le 02/01/2019 à 21:15, David Bapst a écrit : Hi all, I've been

Re: [R-sig-phylo] ape chronos function returning pLL of -1E100

2018-12-17 Thread Emmanuel Paradis
Hi John, It looks like that the constraints on the dates with the 4 calibrations are such that the penalized likelihood cannot be calculated. There are several occasions when a value of -1e100 is returned (non finite value, negative branch lenghts, ...) so it's hard to see what is the problem

Re: [R-sig-phylo] Extended Majority Consensus Topology (Allcompat Summary) in R? And some observations on ape's consensus() function

2018-10-27 Thread Emmanuel Paradis
Hi David, phangorn has the function consensusNet that builds consensus networks (objects of class "networx") which is more appropriate than ape::consensus is p < 0.5. There is a nice plotting function using RGL for "networx" objects. Of course, you won't get a fully bifurcating tree if there

Re: [R-sig-phylo] No PCOA Correction Applied but Corrected Eigenvalues Returned? (ape::pcoa)

2018-10-25 Thread Emmanuel Paradis
n is defined by the user. -Dave On Tue, Oct 23, 2018 at 10:26 PM Emmanuel Paradis mailto:emmanuel.para...@ird.fr>> wrote: Hi David, Have you tried one of the two possible corrections? R> res <- pcoa(dmat) R> res.lingoes <- pcoa(dmat, correction = "lin

Re: [R-sig-phylo] No PCOA Correction Applied but Corrected Eigenvalues Returned? (ape::pcoa)

2018-10-23 Thread Emmanuel Paradis
Hi David, Have you tried one of the two possible corrections? R> res <- pcoa(dmat) R> res.lingoes <- pcoa(dmat, correction = "lingoes") R> res.lingoes$note [1] "Lingoes correction applied to negative eigenvalues: D' = -0.5*D^2 - 0.310850908498892 , except diagonal elements" The matrix

Re: [R-sig-phylo] Building phlyogenies from DNA alignments

2018-09-25 Thread Emmanuel Paradis
Hi Zhong, A few good places where to start: http://ape-package.ird.fr/ https://github.com/KlausVigo/phangorn For basic introductions, see the vignettes in the package phangorn: https://CRAN.R-project.org/package=phangorn Best, Emmanuel Le 25/09/2018 à 17:34, Zhong Huang a écrit : Hello,

Re: [R-sig-phylo] plot heatmap at nodes

2018-08-30 Thread Emmanuel Paradis
is can be generalized to different dimensions (even non-square). The options of rect() can be used (border, ...) par(xpd = TRUE) is to make the heatmap at the root completely visible. Best, Emmanuel Le 30/08/2018 à 12:45, Emmanuel Paradis a écrit : Hi Jacob, It is possible to call nodelab

Re: [R-sig-phylo] plot heatmap at nodes

2018-08-30 Thread Emmanuel Paradis
Hi Jacob, It is possible to call nodelabels() several times to do something similar to what you want by playing with the adj argument which is c(0.5, 0.5) by default (ie, the label is centered on the node). You can try this: tr <- rcoal(5) plot(tr, "p", FALSE) for (h in c(0.4, 0.5, 0.6))

Re: [R-sig-phylo] understanding variance-covariance matrix

2018-08-25 Thread Emmanuel Paradis
Hi Agus & Brian, To complete Brian's response, vcv() is a generic function which works with trees (class "phylo") and phylogenetic correlation structures (class "corPhyl"). The latter can be used to define an OU model, see ?vcv, and ?corPhyl for the correlation structures available in ape.

Re: [R-sig-phylo] Aligning tree tip labels together in ape

2018-08-25 Thread Emmanuel Paradis
Hi Nick, This can be fixed by editing the code of tiplabels() with the usual procedure: fix(tiplabels) then find this line of code: tmp <- rect2polar(XX, YY) and insert below the following one: if (lastPP$align.tip.label) tmp$r[] <- max(tmp$r) save and close. Your commands

Re: [R-sig-phylo] ape-package: unknown states in ace analyses?

2018-06-22 Thread Emmanuel Paradis
x, then set column x to one in the matrix of likelihoods: 1 0 0 0 # if the base observed is A 0 0 1 0 # if the base observed is G 1 0 1 0 # if the base observed is R ... 1 1 1 1 # if the base observed is N This can be applied to any character with more than two states. Best, Emmanuel Le 22/06/20

Re: [R-sig-phylo] ape-package: unknown states in ace analyses?

2018-06-22 Thread Emmanuel Paradis
Hi Théo, It is possible to modify the code of ace() to take uncertain character states into account. If you edit the code with fix(ace), after these four lines: if (method != "ML") stop("only ML estimation is possible for discrete characters.") if (any(phy$edge.length <= 0))

Re: [R-sig-phylo] Testing tree disagreement: SH-test disappeared in ape-package

2018-06-08 Thread Emmanuel Paradis
Hi Sebastian, All the likelihood-based phylogenetic inference functions have been removed from ape since version 2.4 (released in Oct 2009) because of the (incomparably better) implementation in phangorn: library(phangorn) ?SH.test Best, Emmanuel Le 08/06/2018 à 14:50, Sebastian Y. Müller

Re: [R-sig-phylo] "Not of class phylo" error when lapply is used

2018-04-09 Thread Emmanuel Paradis
Hi John, See my comments below. Le 09/04/2018 à 16:46, jschenk a écrit : Hi Folks, I have been banging my head against what appears to be an easy coding problem for a while now and haven’t been able to hack my way out of it. I am running a function to identify a posterior set of node ages

Re: [R-sig-phylo] Suggestion for update of as.igraph.phylo

2018-02-19 Thread Emmanuel Paradis
Dear Watal, Thank you. This is now in ape. I've just uploaded a new testing version (5.0-5) with the last changes and fixes on ape's site: http://ape-package.ird.fr/ape_installation.html#versions A Windows version is available. The list of changes are listed there:

Re: [R-sig-phylo] Maximum likelihood time-scaling

2018-02-08 Thread Emmanuel Paradis
Hi Santiago, This approach is implemented in phangorn, from ?optim.pml: If the option 'optRooted' is set to TRUE than the edge lengths of rooted tree are optimized. The tree has to be rooted and by now ultrametric! Optimising rooted trees is generally much slower. Cheers,

Re: [R-sig-phylo] Specifying a polytomy at the root with no outgroup

2018-01-20 Thread Emmanuel Paradis
Hi, To get a tree with a basal multichotomy as a rooted tree, you have to set its root edge: R> tr <- read.tree(text = "(A,B,(C,D));") R> is.rooted(tr) [1] FALSE R> tr$root.edge <- 0 R> is.rooted(tr) [1] TRUE This could be done directly in the Newick string: R> tr <- read.tree(text =

Re: [R-sig-phylo] color edges of internal nodes with a single child

2017-12-23 Thread Emmanuel Paradis
of the namespace it is better to source plot.phylo() at the same time. Best, Emmanuel Le 23/12/2017 à 22:48, Emmanuel Paradis a écrit : Hi Walter, That shouldn't be too hard to fix. This happens, apparenly, only if type="phylogram" -- which is the default. This seems to work

Re: [R-sig-phylo] color edges of internal nodes with a single child

2017-12-23 Thread Emmanuel Paradis
Hi Walter, That shouldn't be too hard to fix. This happens, apparenly, only if type="phylogram" -- which is the default. This seems to work correctly if type="c" (and if there are branch lengths). I'll update you when it's fixed. Best, Emmanuel Le 20/12/2017 à 22:17, Walter, Mathias a

Re: [R-sig-phylo] ape

2017-12-07 Thread Emmanuel Paradis
Hi, You can find all released versions of ape as source packages on CRAN: https://cran.r-project.org/src/contrib/Archive/ape/ Best, Emmanuel Le 07/12/2017 à 11:19, pascal de Clarens a écrit : Hello, I am using Iramutec working togethr with R it needs to use ape 3.5 annd having installed

Re: [R-sig-phylo] paste() hangs R

2017-11-02 Thread Emmanuel Paradis
Hi Andreas, This sounds more like an issue with RStudio which seems to freeze from time to time, unless you have a reproducible example under another environment. Best, Emmanuel Le 30/10/2017 à 15:38, Andreas Kolter a écrit : If I paste() a huge DNAbin alignment (by accident) (as in: 250MB

Re: [R-sig-phylo] Removing columns containing "N" in DNA alignment

2017-10-27 Thread Emmanuel Paradis
Hi Vojtěch, Here's something you could do. First, make a copy of del.colgapsonly: toto <- del.colgapsonly Then, edit this copy (e.g., with fix(toto)), find this line: foo <- function(x) sum(x == 4) and replace 4 by 240. Save and close. Now you can use toto() in the same way than

Re: [R-sig-phylo] Why does ace set a random number generator seed?

2017-10-20 Thread Emmanuel Paradis
Hi Dave, The seed is created every time you generate random data (see details in ?.Random.seed): R> exists(".Random.seed") [1] FALSE R> sample(1) [1] 1 R> exists(".Random.seed") [1] TRUE So in your code below the seed is created by calling rtree(). Indeed, with ape 4.1: R>

Re: [R-sig-phylo] installing a testing version of ape

2017-10-17 Thread Emmanuel Paradis
er today to see if it changes. All of the best, Elizabeth On Oct 17, 2017, at 2:47 PM, Emmanuel Paradis <emmanuel.para...@ird.fr> wrote: Hi Elizabeth, I have submitted ape 5.0 on CRAN on 5 October but I'm still waiting for feedback. I suspect there are problems with reverse dependencies

Re: [R-sig-phylo] installing a testing version of ape

2017-10-17 Thread Emmanuel Paradis
Hi Elizabeth, I have submitted ape 5.0 on CRAN on 5 October but I'm still waiting for feedback. I suspect there are problems with reverse dependencies. In the meantime, I cleared the testing repositories thinking that CRAN would take the usual 1-2 days to publish the new version. Sorry for

Re: [R-sig-phylo] Can I get coordinates from plot.phylo and not get blank page

2017-09-26 Thread Emmanuel Paradis
Hi Elizabeth, You can use directly the functions behind the calculations of the coordinates; they are documented together: ?node.depth. But this will not give the final coordinates since more calculations are needed depending on the widths of the labels, etc. Another possibility could be to

Re: [R-sig-phylo] Possible Bug in ape::read.tree

2017-09-08 Thread Emmanuel Paradis
Hi George, Nice comparison! It would be interesting to see if the difference between ape and rncl is always in the same direction. It seems that the trees in your test are all relatively small (timings are concentrated around 1 ms). Apparently, read.tree scales a bit better than

Re: [R-sig-phylo] phylogenetic signal with sample sizes but no standard errors

2017-08-04 Thread Emmanuel Paradis
There is also an implementation of this method in two functions in ape, see: ?pic.ortho ?varCompPhylip There are examples with simulated data in both help pages. The second function requires PHYLIP (similarly to Rphylip) . Best, Emmanuel Le 04/08/2017 à 14:36, Joe Felsenstein a écrit :

Re: [R-sig-phylo] Frequency histograms in APE

2017-08-03 Thread Emmanuel Paradis
Hi, This was asked some time ago: http://www.mail-archive.com/r-sig-phylo@r-project.org/msg04388.html HTH Best, Emmanuel Le 30/07/2017 à 10:58, LUCAS A. (599841) a écrit : Hi (This is my first query to a group like this, so my apologies if the subject is a little basic) I have a data

[R-sig-phylo] new version of ape

2017-08-03 Thread Emmanuel Paradis
Dear all, A new version of ape is in preparation with several significant changes. The most important ones are: - All types of phylogenetic trees and networks are now supported: * trees with singleton nodes are handled with the usual functions read.tree, plot.tree, ... * networks are

Re: [R-sig-phylo] Error in eigen(val, only.values = TRUE) : infinite or missing values in 'x' when estimating lambda in pgls

2017-07-03 Thread Emmanuel Paradis
Hi Lydia, This kind of problem happens sometimes though it's not clear why. One possibility is that the Pagel model is not appropriate for your data. One thing you can do is to estimate lambda by repeatedly fitting models with fixed = TRUE for different values of lambda between 0 and 1, and

Re: [R-sig-phylo] need finite 'xlim' values error with plot.phylo

2017-06-14 Thread Emmanuel Paradis
Hi Santiago, For the tree 'rtr' below, the default size of the graphical device is indeed too small: you can maximize the window size and this should work (or you can set manually x.lim). After plotting the tree this way, you can reduce the size of the window and have no problem. It's fixed

Re: [R-sig-phylo] A possible alternate MRCA function to APE's getMRCA

2017-06-10 Thread Emmanuel Paradis
B Joseph W. Brown Post-doctoral Researcher, Smith Laboratory University of Michigan Department of Ecology & Evolutionary Biology Room 2071, Kraus Natural Sciences Building Ann Arbor MI 48109-1079 josep...@umich.edu <mailto:josep...@umich.edu

Re: [R-sig-phylo] A possible alternate MRCA function to APE's getMRCA

2017-06-10 Thread Emmanuel Paradis
Joseph, Klaus, This is great. I slightly edited the code and renamed the argument 'tips' to 'tip' (as in the original definition). I run on a bunch of random trees and the results are exactly identical with the current version of getMRCA. I'm changing the code in ape now. Cheers, Emmanuel

Re: [R-sig-phylo] Average Aminoacid Identity tree with bootstrap support. Is it possible?

2017-04-07 Thread Emmanuel Paradis
Hi Salvador, You first need to define the variables that would be resampled during the bootstrap procedure. In the case of DNA sequences, this would be the columns (= sites) of the alignment, since they each contribute to the distance calculation (or to the likelihod function if you use ML).

Re: [R-sig-phylo] Rooting a tree with a basal polytomy

2017-02-07 Thread Emmanuel Paradis
Hi, If you have a single tree (object of class "phylo") phy$root.edge <- 0 If there are several trees in your NEXUS file (then phy is of class "multiPhylo"): for (i in seq_along(phy)) phy[[i]]$root.edge <- 0 Best, Emmanuel Le 07/02/2017 à 13:17, Yan Wong a écrit : Sorry if this is a

Re: [R-sig-phylo] HKY GTR distances

2017-02-03 Thread Emmanuel Paradis
Dear Andreas, There is no distance formula for HKY or GTR model. For GTR, Rodrı́guez et al. developed a procedure to calculate a distance (also in Yang's 2006 book). An example is given below with the woodmouse: matlog <- function(x) { tmp <- eigen(X) V <- tmp$vectors U <-

Re: [R-sig-phylo] ape - corMartins

2017-01-24 Thread Emmanuel Paradis
Hi Sérgio, It seems your results make good sense. alpha=0 is too far from the "optimum" value (i.e., the value that maximises the log-lik), so the optimisation fails to maximise the log-likelihood with respect to this parameter. It has been written in the literature that it is difficult to

Re: [R-sig-phylo] Enigmatic error with drop.tip

2017-01-23 Thread Emmanuel Paradis
Hi Klaus, Thanks for tracking this. It's fixed. Best, Emmanuel Le 20/01/2017 à 18:41, Klaus Schliep a écrit : Hi Juan, it seems that you trim too many taxa. I can replicate the error message if I trim for example 19 out of a 20 tips of a tree. drop.tip(tree, sample(20, 19)) Error in

Re: [R-sig-phylo] multi2di fails on multiPhylo objects

2017-01-16 Thread Emmanuel Paradis
Hi, Klaus: thanks for the fix. There is a development version on ape-package.ird.fr: http://ape-package.ird.fr/ape_installation.html#versions This version is 4.0-0.2. The source as well as a Windows version are avaialble. The list of changes is there: http://ape-package.ird.fr/NEWS Best,

Re: [R-sig-phylo] Extract all possible clades from a tree

2017-01-06 Thread Emmanuel Paradis
stop("node number must be greater than the number of tips") } if (node == n + 1L) return(phy) keep <- prop.part(phy)[[node - n]] drop.tip(phy, (1:n)[-keep], root.edge = root.edge, rooted = TRUE) } ##########

Re: [R-sig-phylo] Extract all possible clades from a tree

2017-01-06 Thread Emmanuel Paradis
Hi, Klaus is right: extract.clade() fails if the tree has been rooted with resolve.root = TRUE before. I'm going to rewrite the function calling drop.tip (which will be safer). In the meantime, Klaus's function should work for Kamila. Best, Emmanuel Le 06/01/2017 à 05:17, Klaus Schliep a

Re: [R-sig-phylo] Tree plotting (and maybe others) are borked when a node label is '0'

2017-01-04 Thread Emmanuel Paradis
Hi, This is a known feature of read.nexus(), see ape's FAQ: http://ape-package.ird.fr/ape_faq.html#Bayestrees This explains how to fix the problem. Best, Emmanuel Le 04/01/2017 à 14:46, Yan Wong a écrit : If I create a test.nex file as follows: #NEXUS BEGIN TREES; TRANSLATE 0 0, 1 1, 2 2,

Re: [R-sig-phylo] read.FASTA accept connection

2017-01-04 Thread Emmanuel Paradis
t;^ +", "", names(res)) # to permit phylosim class(res) <- "DNAbin" res } Le 04/01/2017 à 00:37, Rj Ewing a écrit : Emmanuel, Thanks, I've attached a patch containing the changes. I'm not very familiar with R, so maybe there is a better way to do it. Let me know i

Re: [R-sig-phylo] read.FASTA accept connection

2017-01-03 Thread Emmanuel Paradis
Hi, You can send your contribution directly to me. See this post for a recent discussion on how to contribute to ape: http://www.mail-archive.com/r-sig-phylo@r-project.org/msg04580.htmlra Sure your contribution will be useful. I've just found out that read.FASTA crashes R if the FASTA file

Re: [R-sig-phylo] Force read.nexus() to return a multiPhylo object, even if there is only one tree

2016-12-28 Thread Emmanuel Paradis
ttp://blog.phytools.org On 12/27/2016 5:11 PM, Yan Wong wrote: On 27 Dec 2016, at 22:08, Emmanuel Paradis <emmanuel.para...@ird.fr> wrote: Hi Yan, Yes, you are right: this modification can be done. In the meantime, you can fix the code with: fix(read.nexus) Find this line (#117): i

Re: [R-sig-phylo] Force read.nexus() to return a multiPhylo object, even if there is only one tree

2016-12-27 Thread Emmanuel Paradis
Hi Yan, Yes, you are right: this modification can be done. In the meantime, you can fix the code with: fix(read.nexus) Find this line (#117): if (Ntree == 1) { and change it to: if (FALSE) { save and close. Tell me if you still have problem. Best, Emmanuel Le 27/12/2016 à

  1   2   3   4   >