Re: [R-sig-phylo] Dollo character using ace/make.simmap

2015-09-14 Thread Nicholas Crouch
Graeme,

You can simulate characters (and associated tree) in the package
diversitree. For a binary character, the parameters specified are the
speciation rates, extinction rates, and transition rates between the two
states. If you want to simulate unidirectional evolution, you can just
specify the respective transition rate to 0, e.g.:

# No transitions from state 1 to state 0
pars <- c(0.1,0.08, 0.03,0.03,0.01, 0)

phy <- tree.bisse(pars, max.taxa=50, x0=0)

Nick

On Mon, Sep 14, 2015 at 7:00 PM, Graeme Lloyd <graemetll...@gmail.com>
wrote:

> Hi Everyone,
>
> I was wondering if anyone knows if it is possible to set up a custom rate
> model to represent a binary discrete Dollo character with ace or
> make.simmap?
>
> Thanks,
>
>
> Graeme
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at
> http://www.mail-archive.com/r-sig-phylo@r-project.org/
>



-- 
Nicholas Crouch
Graduate Student, Igić Lab
Department of Biological Sciences
University of Illinois at Chicago

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] problem with write.nexus.data

2014-09-18 Thread Nicholas Crouch
This solved the problem exactly, thank you very much.

Nick

On Thu, Sep 18, 2014 at 12:22 AM, Liam J. Revell liam.rev...@umb.edu
wrote:

 Hi Nicholas.

 I think this is a bug. Try the following to circumvent:

 write.nexus.data(as.list(data), file=test.nex, interleaved=TRUE,
 charsperline=100)

 Since I don't have your dataset, I can't check it; but it fixed the
 problem in another dataset with which I was able to reproduce the error.

 All the best, Liam

 Liam J. Revell, Assistant Professor of Biology
 University of Massachusetts Boston
 web: http://faculty.umb.edu/liam.revell/
 email: liam.rev...@umb.edu
 blog: http://blog.phytools.org


 On 9/17/2014 10:46 PM, Nicholas Crouch wrote:

 Hi,

 I am having a problem with write.nexus.data, such that the file generated
 is nonsense.

 I have a very, very large data set, but have been working with a subset
 trying to solve this problem. My data is in .fasta format, and I am
 looking
 to convert it into nexus format.

 I load the data:

  library(ape)
 data - read.dna(concat.fasta, format=fasta, as.matrix=TRUE)


 This gives the following:

  data
 5 DNA sequences in binary format stored in a matrix


  All sequences of same length: 5023

  Labels: Species etc.

  Base composition: a c g t

 Also:

  class(data)
 DNAbin


 This is exactly the same as the woodmouse example data provided in the
 package ape, which I have been following when trying to solve this issue
 (see ?write.nexus.data). When I export the data:

  write.nexus.data(data, file=test.nex, interleaved=TRUE,

 charsperline=100)

 a file is produced which begins:

 BEGIN DATA;
DIMENSIONS NTAX=135165 NCHAR=1;
FORMAT DATATYPE=DNA MISSING=? GAP=- INTERLEAVE=YES;
MATRIX
  1   040 etc.

 I haven't been able to find other posts on this, any help is greatly
 appreciated.

 Sincerely,

 Nick





-- 
Nicholas Crouch
Graduate Student, Igić Lab
Department of Biological Sciences
University of Illinois at Chicago

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

[R-sig-phylo] problem with write.nexus.data

2014-09-17 Thread Nicholas Crouch
Hi,

I am having a problem with write.nexus.data, such that the file generated
is nonsense.

I have a very, very large data set, but have been working with a subset
trying to solve this problem. My data is in .fasta format, and I am looking
to convert it into nexus format.

I load the data:

 library(ape)
 data - read.dna(concat.fasta, format=fasta, as.matrix=TRUE)

This gives the following:

 data
 5 DNA sequences in binary format stored in a matrix

All sequences of same length: 5023

Labels: Species etc.

Base composition: a c g t

Also:

 class(data)
 DNAbin

This is exactly the same as the woodmouse example data provided in the
package ape, which I have been following when trying to solve this issue
(see ?write.nexus.data). When I export the data:

 write.nexus.data(data, file=test.nex, interleaved=TRUE,
charsperline=100)

a file is produced which begins:

BEGIN DATA;
  DIMENSIONS NTAX=135165 NCHAR=1;
  FORMAT DATATYPE=DNA MISSING=? GAP=- INTERLEAVE=YES;
  MATRIX
1   040 etc.

I haven't been able to find other posts on this, any help is greatly
appreciated.

Sincerely,

Nick


-- 
Nicholas Crouch
Graduate Student, Igić Lab
Department of Biological Sciences
University of Illinois at Chicago

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] Drop terminal branches

2013-08-13 Thread Nicholas Crouch
Liam,

That works fantastically, thanks very much!

Nick


On Tue, Aug 13, 2013 at 10:39 AM, Liam J. Revell liam.rev...@umb.eduwrote:

 Hi Nick.

 drop.tip(...,trim.internal=**FALSE) almost does this, but it will not
 allow you to trim all the leaves in the tree.

 Why don't you try the attached function, which I'm calling drop.leaves. It
 does what you want, I think, and should be straightforward to figure out.
 The tip labels on the pruned tree are either the node labels (if they
 exist) or the node numbers in the original tree; or (if
 keep.tip.labels=TRUE) they are a comma separated list of the tips descended
 from that node in the input tree. Note that not all tips will be in these
 lists because some edges from internal nodes lead to only one tip.

 Feedback welcome.

 All the best, Liam

 Liam J. Revell, Assistant Professor of Biology
 University of Massachusetts Boston
 web: 
 http://faculty.umb.edu/liam.**revell/http://faculty.umb.edu/liam.revell/
 email: liam.rev...@umb.edu
 blog: http://blog.phytools.org


 On 8/13/2013 10:43 AM, Nicholas Crouch wrote:

 Hi All,

 For an analysis I am performing I am looking to drop all terminal branches
 from a phylogeny (class phylo). The idea is to end up with only branches
 that lead to nodes. Does anyone know how to drop these lengths to leave me
 everything else?

 Thanks,

 Nick

 [[alternative HTML version deleted]]

 __**_
 R-sig-phylo mailing list - R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/**listinfo/r-sig-phylohttps://stat.ethz.ch/mailman/listinfo/r-sig-phylo
 Searchable archive at http://www.mail-archive.com/r-**
 sig-ph...@r-project.org/http://www.mail-archive.com/r-sig-phylo@r-project.org/



[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


[R-sig-phylo] Find common ancestor of multiple taxa

2013-05-09 Thread Nicholas Crouch
Hi All,

The 'mrca' function in Ape provides a method for finding the common
ancestor of a pair of taxa. What I would like have not found is a function
where you can pass a (long) list of tips from a phylogeny and find the node
which represents the common ancestor to all these tips.

Does such a function exist? Or could the 'mrca' function be expanded to
loop over all the taxa within a list a somehow boil down to what is the
common ancestor that way?

Thanks,

Nick

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


Re: [R-sig-phylo] PGLS with class multiphylo

2013-04-30 Thread Nicholas Crouch
Sam,

In order to run on one tree try phy=trees[[1]], otherwise you will need
to run a loop of the function over all the trees.

e.g.

for(i in 1:length(trees)){

phy - trees[[i]]

then code as normal

Nick


On Tue, Apr 30, 2013 at 7:33 AM, Samantha DelSerra s.delse...@gmail.comwrote:

 Hello,

 I am trying to analyse 100 trees against morphological continuous data
 using a phylogenetic GLS. I'm using the comparative.data function in order
 to do this, but I keep getting an error saying that the class must be
 phylo. I understand that my data is multiphylo, but is there a way to
 convert this data into the phylo class? Below is my code and the error
 message.

  trees - read.nexus(testrees1.tree)
  bats - comparative.data(phy = trees, data = corr.data, names.col =
 Phyloname, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE)
 Error in comparative.data(phy = trees, data = corr.data, names.col =
 Phyloname,  :
   'trees' not of class 'phylo'

 Thanks very much!
 Sam

 [[alternative HTML version deleted]]

 ___
 R-sig-phylo mailing list - R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
 Searchable archive at
 http://www.mail-archive.com/r-sig-phylo@r-project.org/


[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


[R-sig-phylo] Information on {ape] function nodelabels

2013-03-25 Thread Nicholas Crouch
Hi,

Hoe does the function nodelabels match data to the phylogeny? Ancestral
reconstruction produces a vector with a sample output:

 st


  [,1] [,2][,3]   [,4][,5]
[1,] 0.0001381085 0.007642601 0.01638118 0.001591162 0.001268793
[2,] 0.9998618915 0.992357399 0.98361882 0.998408838 0.998731207


The numbers across the top do no correlate with the node numbers on
the phylogeny: compare


 nodelabels(pie=t(st))


with


 nodelabels()


Would it be possible to create a list vector of the nodes in a
phylogeny with the corresponding values from an ancestral
reconstruction?


An example could be something like:


 vector

Node 1

[1] 0.05

[2] 0.95

Node 2

[1] 0.3

[2] 0.7



Thanks

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/