How do I shift the edge length of multiple trees in R?
0
0
Entering edit mode
12 months ago
Namenlos • 0

I have a file with the posterior sample of trees produced by RevBayes, the beginning of which looks as follows:

Iteration   Posterior   Likelihood  Prior   timetree
0   -1802.126   -1387.298   -414.8278   ((((Arcadian[&index=24]:0.990245,East_Ionic[&index=23]:0.690245)[&index=25]:0.447748,(((Mycenaean[&index=22]:0.310027,((West_Argolic[&index=21]:0.063518,Lesbian[&index=20]:0.263518)[&index=26]:0.106910,East_Argolic[&index=19]:0.370428)[&index=27]:0.939599)[&index=28]:0.024201,(((Corinthian[&index=18]:0.504267,West_Thessalian_Thessaliotis[&index=17]:0.504267)[&index=29]:0.261774,(Cretan[&index=16]:0.551464,Cypriot[&index=15]:0.651464)[&index=30]:0.114576)[&index=31]:0.109957,((Attic[&index=14]:0.626171,Boeotian[&index=13]:0.626171)[&index=32]:0.133810,((Laconian[&index=12]:0.243437,Megarian[&index=11]:0.343437)[&index=33]:0.265065,Central_Ionic[&index=10]:0.408503)[&index=34]:0.251478)[&index=35]:0.116017)[&index=36]:0.258232)[&index=37]:0.094907,(Theran[&index=9]:1.098901,Elean[&index=8]:1.198901)[&index=38]:0.130235)[&index=39]:0.008857)[&index=40]:0.026457,((Rhodian[&index=7]:0.258910,Pamphylian[&index=6]:0.458910)[&index=41]:1.098605,((Phocian[&index=5]:0.775238,East_Thessalian_Pelasgiotis[&index=4]:0.875238)[&index=42]:0.088669,West_Ionic[&index=3]:0.863907)[&index=43]:0.293609)[&index=44]:0.006934)[&index=45]:0.014444,(Coan[&index=2]:1.478782,Locrian[&index=1]:1.178782)[&index=46]:0.000112)[&index=47]:0.000000;

The file contains thousands of rows like this. For each timetree, I want to shift the age of each branch by 2.1. How do I do this in R? Or is there another way that I can accomplish this?

phylogenetics edge-length R • 489 views
ADD COMMENT
0
Entering edit mode

I presume, this is possible, but I am not familiar with the format.

First, check the documentation of the package, if it provides a function for this. Otherwise, you can very likely access the values within the data structure itself.

Can you run str(), class() on a tree and post the results? Possibly - if you have a small tree that you can share, use dput() and post it or save it into a file using saveRDS().

ADD REPLY

Login before adding your answer.

Traffic: 2955 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6