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
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
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
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 =
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,
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:
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))
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
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.
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))
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
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
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
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
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
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
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,
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
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
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
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
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
, 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/
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
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):
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
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
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)
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
(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
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
>
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
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
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
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
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
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
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 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
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
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.
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
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
>
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
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
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
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
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
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
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
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
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 <-
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 = "*")
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
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
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
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
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
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("-"))
(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>
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
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
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
> 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
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
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
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
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.
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
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
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 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()?
>> >&
301 - 372 of 372 matches
Mail list logo