treesumstats 0.2__tar.gz → 0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {treesumstats-0.2 → treesumstats-0.4}/PKG-INFO +39 -22
  2. {treesumstats-0.2 → treesumstats-0.4}/README.md +38 -21
  3. {treesumstats-0.2 → treesumstats-0.4}/setup.py +1 -1
  4. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/help.py +2 -1
  5. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/subtree_sumstats.py +117 -38
  6. {treesumstats-0.2 → treesumstats-0.4}/treesumstats.egg-info/PKG-INFO +39 -22
  7. {treesumstats-0.2 → treesumstats-0.4}/LICENSE +0 -0
  8. {treesumstats-0.2 → treesumstats-0.4}/setup.cfg +0 -0
  9. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/__init__.py +0 -0
  10. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/balance_sumstats.py +0 -0
  11. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/basic_sumstats.py +0 -0
  12. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/branch_sumstats.py +0 -0
  13. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/calculator.py +0 -0
  14. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/event_time_sumstats.py +0 -0
  15. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/ltt_sumstats.py +0 -0
  16. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/resolution_sumstats.py +0 -0
  17. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/sumstats.py +0 -0
  18. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/transmission_chain_sumstats.py +0 -0
  19. {treesumstats-0.2 → treesumstats-0.4}/treesumstats/tree_manager.py +0 -0
  20. {treesumstats-0.2 → treesumstats-0.4}/treesumstats.egg-info/SOURCES.txt +0 -0
  21. {treesumstats-0.2 → treesumstats-0.4}/treesumstats.egg-info/dependency_links.txt +0 -0
  22. {treesumstats-0.2 → treesumstats-0.4}/treesumstats.egg-info/entry_points.txt +0 -0
  23. {treesumstats-0.2 → treesumstats-0.4}/treesumstats.egg-info/requires.txt +0 -0
  24. {treesumstats-0.2 → treesumstats-0.4}/treesumstats.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: treesumstats
3
- Version: 0.2
3
+ Version: 0.4
4
4
  Summary: Encoding phylogenetic trees with summary statistics.
5
5
  Home-page: https://github.com/evolbioinfo/treesumstats
6
6
  Author: Anna Zhukova
@@ -250,11 +250,11 @@ The top part includes times <= T/3, the middle one > T/3 and <= 2T/3, the bottom
250
250
  Implemented in [_treesumstats.subtree_sumstats.SubtreeFeatureCalculator_](treesumstats/subtree_sumstats.py).
251
251
 
252
252
  In some of the following statistics reshuffled subtrees are mentioned.
253
- To construct a _reshuffled subtree_ of a certain kind (cherry, triplet, etc.) from a real one we keep one of its (randomly chosen) tips,
254
- while for each other tip from the real subtree we replace it with a tip, for which:
255
- (i) the time at the beginning of its branch is as close as possible to the time at the beginning of the real tip's branch,
256
- (ii) while all the tips in the reshuffled subtree are different and
257
- (iii) there are no two tips in the reshuffled subtree that used to belong to the same real subtree of this kind
253
+ To construct a _reshuffled subtree_ of a certain kind (cherry, triplet, etc.) from a real one we keep one of its (randomly chosen) locally (with respect to the subtree) external node,
254
+ while for each other locally external node from the real subtree we replace it with a node of globally (with respect to the forest) the same type (external or internal), for which:
255
+ (i) the time at the beginning of its branch is as close as possible to the time at the beginning of the real node's branch,
256
+ (ii) while all the locally external nodes in the reshuffled subtree are different and
257
+ (iii) there are no two locally external nodes in the reshuffled subtree that used to belong to the same real subtree of this kind
258
258
  (unless there were not enough tips, e.g., 8 tips in total and only 2 ladderized quartets in the forest).
259
259
 
260
260
  We consider the following 2-tip, 3-tip and 4-tip subtrees to calculate the summary statistics:
@@ -267,39 +267,56 @@ We consider the following 2-tip, 3-tip and 4-tip subtrees to calculate the summa
267
267
  * 4L: fully resolved ladderized quartet
268
268
  * 4B: fully resolved balanced quartet (with two cherries as children)
269
269
 
270
- In the following statistics (spanning several list positions) X must be replaced by one of the following values: 2, 3U, 3L, 4U, 4U3U1, 4U211, 4L or 4B.
270
+ We also consider fully internal-node subtrees:
271
+ * I: fully unresolved subtree (or size 2 or more) whose locally external nodes are globally internal sibling nodes.
271
272
 
272
- 1-8. **frac_tips_in_X:** fraction of forest tips that are found in subtrees of type X.
273
+ In the following statistics (spanning several list positions) XT must be replaced by one of the following values: 2, 3U, 3L, 4U, 4U3U1, 4U211, 4L or 4B, while X must be replaced by either I or one of the XT values.
274
+
275
+ 1-8. **frac_tips_in_XT:** fraction of forest tips that are found in subtrees of type XT.
273
276
  9. **frac_tips_in_O:** fraction of forest tips that are not part of any subtree of size 2, 3 or 4.
274
277
 
275
- 10-17. **n_tips_in_X:** number of forest tips that are found in subtrees of type X.
278
+ 10-17. **n_tips_in_XT:** number of forest tips that are found in subtrees of type XT.
276
279
  18. **n_tips_in_O:** number of forest tips that are not part of any subtree of size 2, 3 or 4.
280
+ 19. **frac_inodes_with_sibling_inodes:** fraction of forest non-root internal nodes that have internal siblings.
281
+ 20. **frac_inodes_without_sibling_inodes:** fraction of forest non-root internal nodes that do not have internal siblings.
282
+ 19. **n_inodes_with_sibling_inodes:** number of forest non-root internal nodes that have internal siblings.
283
+ 20. **n_inodes_without_sibling_inodes:** number of forest non-root internal nodes that do not have internal siblings.
284
+
285
+ 21-29. **time_diff_in_X_real_mean:** mean among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
286
+
287
+ 30-38. **time_diff_in_X_real_min:** minimum among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
288
+
289
+ 39-47. **time_diff_in_X_real_max:** maximum among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
290
+
291
+ 48-56. **time_diff_in_X_real_var:** variance among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
292
+
293
+ 57-65. **time_diff_in_X_real_median:** median among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
277
294
 
278
- 19-26. **time_diff_in_X_real_mean:** mean among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
295
+ 66-74. **time_diff_in_X_random_mean:** mean among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
279
296
 
280
- 27-34. **time_diff_in_X_real_min:** minimum among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
297
+ 75-83. **time_diff_in_X_random_min:** minimum among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
281
298
 
282
- 35-42. **time_diff_in_X_real_max:** maximum among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
299
+ 84-93. **time_diff_in_X_random_max:** maximum among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
283
300
 
284
- 43-50. **time_diff_in_X_real_var:** variance among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
301
+ 94-103. **time_diff_in_X_random_var:** variance among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
285
302
 
286
- 51-58. **time_diff_in_X_real_median:** median among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
303
+ 104-112. **time_diff_in_X_random_median:** median among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
287
304
 
288
- 19-26. **time_diff_in_X_random_mean:** mean among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
305
+ 113-184. **time_diff_in_X_real_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
289
306
 
290
- 27-34. **time_diff_in_X_random_min:** minimum among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
307
+ 184-255. **time_diff_in_X_random_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
291
308
 
292
- 35-42. **time_diff_in_X_random_max:** maximum among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
309
+ 256-264. **time_diff_in_X_random_vs_real_n_less:** number of subtrees of type X whose average locally external node sampling time differences is smaller in real subtrees than in the corresponding reshuffled ones.
293
310
 
294
- 43-50. **time_diff_in_X_random_var:** variance among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
311
+ 265-273. **time_diff_in_X_random_vs_real_n_more:** number of subtrees of type X whose average locally external node sampling time differences is larger in real subtrees than in the corresponding reshuffled ones.
295
312
 
296
- 51-58. **time_diff_in_X_random_median:** median among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
313
+ 274-282. **time_diff_in_X_random_vs_real_frac_less:** fraction of subtrees of type X whose average locally external node sampling time differences is smaller in real subtrees than in the corresponding reshuffled ones.
297
314
 
298
- 59-122. **time_diff_in_X_real_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
315
+ 283-291. **time_diff_in_X_random_vs_real_frac_more:** fraction of subtrees of type X whose average locally external node sampling time differences is larger in real subtrees than in the corresponding reshuffled ones.
299
316
 
300
- 123-186. **time_diff_in_X_random_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
317
+ 292-301. **time_diff_in_X_random_vs_real_pval_less:** p-value of the sign test checking that for subtrees of type X, their average locally external node sampling time differences are indistinguishable in real subtrees and in the corresponding reshuffled ones (the alternative hypothesis is that some real ones are smaller).
301
318
 
302
- 187-194. **time_diff_in_X_random_vs_real_n_less:** p-value of the sign test checking that for subtrees of type X, their average tip sampling time differences are indistinguishable in real subtrees and in the corresponding reshuffled ones (the alternative hypothesis is that some real ones are smaller).
319
+ 302-310. **time_diff_in_X_random_vs_real_pval_more:** p-value of the sign test checking that for subtrees of type X, their average locally external node sampling time differences are indistinguishable in real subtrees and in the corresponding reshuffled ones (the alternative hypothesis is that some real ones are larger).
303
320
 
304
321
 
305
322
  ## Input data
@@ -228,11 +228,11 @@ The top part includes times <= T/3, the middle one > T/3 and <= 2T/3, the bottom
228
228
  Implemented in [_treesumstats.subtree_sumstats.SubtreeFeatureCalculator_](treesumstats/subtree_sumstats.py).
229
229
 
230
230
  In some of the following statistics reshuffled subtrees are mentioned.
231
- To construct a _reshuffled subtree_ of a certain kind (cherry, triplet, etc.) from a real one we keep one of its (randomly chosen) tips,
232
- while for each other tip from the real subtree we replace it with a tip, for which:
233
- (i) the time at the beginning of its branch is as close as possible to the time at the beginning of the real tip's branch,
234
- (ii) while all the tips in the reshuffled subtree are different and
235
- (iii) there are no two tips in the reshuffled subtree that used to belong to the same real subtree of this kind
231
+ To construct a _reshuffled subtree_ of a certain kind (cherry, triplet, etc.) from a real one we keep one of its (randomly chosen) locally (with respect to the subtree) external node,
232
+ while for each other locally external node from the real subtree we replace it with a node of globally (with respect to the forest) the same type (external or internal), for which:
233
+ (i) the time at the beginning of its branch is as close as possible to the time at the beginning of the real node's branch,
234
+ (ii) while all the locally external nodes in the reshuffled subtree are different and
235
+ (iii) there are no two locally external nodes in the reshuffled subtree that used to belong to the same real subtree of this kind
236
236
  (unless there were not enough tips, e.g., 8 tips in total and only 2 ladderized quartets in the forest).
237
237
 
238
238
  We consider the following 2-tip, 3-tip and 4-tip subtrees to calculate the summary statistics:
@@ -245,39 +245,56 @@ We consider the following 2-tip, 3-tip and 4-tip subtrees to calculate the summa
245
245
  * 4L: fully resolved ladderized quartet
246
246
  * 4B: fully resolved balanced quartet (with two cherries as children)
247
247
 
248
- In the following statistics (spanning several list positions) X must be replaced by one of the following values: 2, 3U, 3L, 4U, 4U3U1, 4U211, 4L or 4B.
248
+ We also consider fully internal-node subtrees:
249
+ * I: fully unresolved subtree (or size 2 or more) whose locally external nodes are globally internal sibling nodes.
249
250
 
250
- 1-8. **frac_tips_in_X:** fraction of forest tips that are found in subtrees of type X.
251
+ In the following statistics (spanning several list positions) XT must be replaced by one of the following values: 2, 3U, 3L, 4U, 4U3U1, 4U211, 4L or 4B, while X must be replaced by either I or one of the XT values.
252
+
253
+ 1-8. **frac_tips_in_XT:** fraction of forest tips that are found in subtrees of type XT.
251
254
  9. **frac_tips_in_O:** fraction of forest tips that are not part of any subtree of size 2, 3 or 4.
252
255
 
253
- 10-17. **n_tips_in_X:** number of forest tips that are found in subtrees of type X.
256
+ 10-17. **n_tips_in_XT:** number of forest tips that are found in subtrees of type XT.
254
257
  18. **n_tips_in_O:** number of forest tips that are not part of any subtree of size 2, 3 or 4.
258
+ 19. **frac_inodes_with_sibling_inodes:** fraction of forest non-root internal nodes that have internal siblings.
259
+ 20. **frac_inodes_without_sibling_inodes:** fraction of forest non-root internal nodes that do not have internal siblings.
260
+ 19. **n_inodes_with_sibling_inodes:** number of forest non-root internal nodes that have internal siblings.
261
+ 20. **n_inodes_without_sibling_inodes:** number of forest non-root internal nodes that do not have internal siblings.
262
+
263
+ 21-29. **time_diff_in_X_real_mean:** mean among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
264
+
265
+ 30-38. **time_diff_in_X_real_min:** minimum among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
266
+
267
+ 39-47. **time_diff_in_X_real_max:** maximum among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
268
+
269
+ 48-56. **time_diff_in_X_real_var:** variance among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
270
+
271
+ 57-65. **time_diff_in_X_real_median:** median among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
255
272
 
256
- 19-26. **time_diff_in_X_real_mean:** mean among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
273
+ 66-74. **time_diff_in_X_random_mean:** mean among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
257
274
 
258
- 27-34. **time_diff_in_X_real_min:** minimum among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
275
+ 75-83. **time_diff_in_X_random_min:** minimum among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
259
276
 
260
- 35-42. **time_diff_in_X_real_max:** maximum among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
277
+ 84-93. **time_diff_in_X_random_max:** maximum among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
261
278
 
262
- 43-50. **time_diff_in_X_real_var:** variance among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
279
+ 94-103. **time_diff_in_X_random_var:** variance among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
263
280
 
264
- 51-58. **time_diff_in_X_real_median:** median among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
281
+ 104-112. **time_diff_in_X_random_median:** median among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
265
282
 
266
- 19-26. **time_diff_in_X_random_mean:** mean among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
283
+ 113-184. **time_diff_in_X_real_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
267
284
 
268
- 27-34. **time_diff_in_X_random_min:** minimum among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
285
+ 184-255. **time_diff_in_X_random_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
269
286
 
270
- 35-42. **time_diff_in_X_random_max:** maximum among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
287
+ 256-264. **time_diff_in_X_random_vs_real_n_less:** number of subtrees of type X whose average locally external node sampling time differences is smaller in real subtrees than in the corresponding reshuffled ones.
271
288
 
272
- 43-50. **time_diff_in_X_random_var:** variance among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
289
+ 265-273. **time_diff_in_X_random_vs_real_n_more:** number of subtrees of type X whose average locally external node sampling time differences is larger in real subtrees than in the corresponding reshuffled ones.
273
290
 
274
- 51-58. **time_diff_in_X_random_median:** median among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
291
+ 274-282. **time_diff_in_X_random_vs_real_frac_less:** fraction of subtrees of type X whose average locally external node sampling time differences is smaller in real subtrees than in the corresponding reshuffled ones.
275
292
 
276
- 59-122. **time_diff_in_X_real_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
293
+ 283-291. **time_diff_in_X_random_vs_real_frac_more:** fraction of subtrees of type X whose average locally external node sampling time differences is larger in real subtrees than in the corresponding reshuffled ones.
277
294
 
278
- 123-186. **time_diff_in_X_random_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
295
+ 292-301. **time_diff_in_X_random_vs_real_pval_less:** p-value of the sign test checking that for subtrees of type X, their average locally external node sampling time differences are indistinguishable in real subtrees and in the corresponding reshuffled ones (the alternative hypothesis is that some real ones are smaller).
279
296
 
280
- 187-194. **time_diff_in_X_random_vs_real_n_less:** p-value of the sign test checking that for subtrees of type X, their average tip sampling time differences are indistinguishable in real subtrees and in the corresponding reshuffled ones (the alternative hypothesis is that some real ones are smaller).
297
+ 302-310. **time_diff_in_X_random_vs_real_pval_more:** p-value of the sign test checking that for subtrees of type X, their average locally external node sampling time differences are indistinguishable in real subtrees and in the corresponding reshuffled ones (the alternative hypothesis is that some real ones are larger).
281
298
 
282
299
 
283
300
  ## Input data
@@ -18,7 +18,7 @@ setup(
18
18
  'Topic :: Software Development',
19
19
  'Topic :: Software Development :: Libraries :: Python Modules',
20
20
  ],
21
- version='0.2',
21
+ version='0.4',
22
22
  description='Encoding phylogenetic trees with summary statistics.',
23
23
  author='Anna Zhukova',
24
24
  author_email='anna.zhukova@pasteur.fr',
@@ -30,7 +30,8 @@ def main():
30
30
  params = parser.parse_args()
31
31
 
32
32
  for feature_name in FeatureManager.available_features():
33
- print(f'1. **{feature_name}:** {FeatureManager.help(feature_name)}')
33
+ # print(f'1. **{feature_name}:** {FeatureManager.help(feature_name)}')
34
+ print(feature_name)
34
35
 
35
36
 
36
37
  if '__main__' == __name__:
@@ -9,7 +9,9 @@ from treesumstats.tree_manager import annotate_forest_with_time, TIME
9
9
 
10
10
  OTHER_CONFIGURATION_LABEL = 'O'
11
11
 
12
- TOPOLOGY_LABELS = ['2', '3U', '3L', '4U', '4U3U1', '4U211', '4L', '4B', 'O']
12
+ TIP_TOPOLOGY_LABELS = ['2', '3U', '3L', '4U', '4U3U1', '4U211', '4L', '4B', 'O']
13
+ INODE_LABELS = ['I']
14
+ TOPOLOGY_LABELS = TIP_TOPOLOGY_LABELS + INODE_LABELS
13
15
 
14
16
  TIP = 1
15
17
 
@@ -32,7 +34,9 @@ CONFIG_ORDER = [TIP, CHERRY, TRIPLET_UNRESOLVED, TRIPLET_LADDER,
32
34
 
33
35
  TOPOLOGY_LABEL2KEY = {'2': CHERRY, '3U': TRIPLET_UNRESOLVED, '3L': TRIPLET_LADDER, '4U': QUARTET_UNRESOLVED,
34
36
  '4U3U1': QUARTET_TRIPLET_UNRESOLVED_TIP, '4U211': QUARTET_CHERRY_TIP_TIP,
35
- '4L': QUARTET_LADDER, '4B': QUARTET_BALANCED, 'O': 1}
37
+ '4L': QUARTET_LADDER, '4B': QUARTET_BALANCED, 'O': 2}
38
+
39
+ KEY2TOPOLOGY_LABEL = {v: k for (k, v) in TOPOLOGY_LABEL2KEY.items()}
36
40
 
37
41
  TOPOLOGY_LABEL2N = {'2': 2, '3U': 3, '3L': 3, '4U': 4,
38
42
  '4U3U1': 4, '4U211': 4,
@@ -43,7 +47,8 @@ TOPOLOGY_LABEL2NAME = {'2': 'cherries', '3U': 'unresolved triplets', '3L': 'reso
43
47
  '4U3U1': 'partially resolved quartets with an unresolved triplet and a tip as children',
44
48
  '4U211': 'partially resolved quartets with a cherry and two tips as three children',
45
49
  '4L': 'ladderized fully resolved quartets',
46
- '4B': 'balanced quartets (with two cherries as children)'}
50
+ '4B': 'balanced quartets (with two cherries as children)',
51
+ 'I': 'cherries or fully unresolved n-tip subtrees (n > 2) whose external nodes were internal in the global forest'}
47
52
 
48
53
 
49
54
  TIP_TIME_PERCENTILES = [1, 5, 10, 25, 75, 90, 95, 99]
@@ -71,6 +76,27 @@ def get_config2tips(forest):
71
76
  c.del_feature(feature)
72
77
  return topo2tips
73
78
 
79
+
80
+ def pick_siblings(forest, include_polytomies=True):
81
+ """
82
+ Picks internal sibling motifs in the given forest.
83
+
84
+ :param include_polytomies: bool, whether to include nodes with > 2 children into consideration.
85
+ :param forest: list(ete3.Tree), the forest of interest
86
+ :return: iterator of Motif motifs
87
+ """
88
+ result = []
89
+ for tree in forest:
90
+ for root in tree.traverse():
91
+ if root.is_leaf() or not include_polytomies and len(root.children) != 2:
92
+ continue
93
+ siblings = [_ for _ in root.children if not _.is_leaf()]
94
+ if len(siblings) < 2:
95
+ continue
96
+ result.append(siblings)
97
+ return result
98
+
99
+
74
100
  def get_reshuffled_configs(real_configs, all_tips_sorted):
75
101
  """
76
102
  Creates reshuffled configs. For each real config a reshuffled one is constructed by
@@ -135,19 +161,21 @@ def get_avg_time_diff(times):
135
161
  return 2 * diff_sum / n / (n - 1)
136
162
 
137
163
 
138
-
139
-
140
164
  class SubtreeFeatureCalculator(FeatureCalculator):
141
165
  """Computes tree topology-related summary statistics."""
142
166
 
143
167
  def __init__(self):
168
+ self._n_inodes = None
169
+ self._sibling_inodes = None
144
170
  self._topo2diffs = None
145
171
  self._topo2diffs_random = None
146
172
  self._all_tips = None
147
173
  self._forest = None
148
174
  self._topo2tips = None
149
175
  self._n_tips = None
150
- self._topo2tips_random = None
176
+ self._sibling_inodes_random = None
177
+ self._topo2inodes_random = None
178
+ self._all_inodes = None
151
179
 
152
180
  def help(self, feature_name, *args, **kwargs):
153
181
  if 'tips_in_' in feature_name:
@@ -157,49 +185,61 @@ class SubtreeFeatureCalculator(FeatureCalculator):
157
185
  return f'{measure} of forest tips that are not part of any subtree of size 2, 3 or 4.'
158
186
  return f'{measure} of forest tips that are found in {TOPOLOGY_LABEL2NAME[conf]}.'
159
187
 
188
+ if 'inodes_with_sibling_inodes' in feature_name:
189
+ measure = 'fraction' if feature_name.startswith('frac') else 'number'
190
+ return f'{measure} of forest non-root internal nodes that have internal node siblings.'
191
+ if 'inodes_without_sibling_inodes' in feature_name:
192
+ measure = 'fraction' if feature_name.startswith('frac') else 'number'
193
+ return f'{measure} of forest non-root internal nodes that do not have internal node siblings.'
194
+
160
195
  if feature_name.startswith('time_diff_in_'):
161
196
  conf = feature_name[feature_name.find('time_diff_in_') + len('time_diff_in_'):].split('_')[0]
162
197
  is_real='real' in feature_name
163
198
 
164
- reshuffling_expl = '(To construct a reshuffled subtree of a certain kind from a real one we keep one of its (randomly chosen) tips, ' \
165
- 'while for each other tip from the real subtree we replace it with a tip, for which:' \
166
- '(i) the time at the beginning of its branch is as close as possible to the time at the beginning of the real tip\'s branch, ' \
167
- '(ii) while all the tips in the reshuffled subtree are different ' \
168
- 'and (iii) there are no two tips in the reshuffled subtree that used to belong to the same real subtree of this kind ' \
169
- '(unless there were not enough tips, e.g., 8 tips in total and only 2 4-tip subtrees in the forest).'
199
+ reshuffling_expl = '(To construct a reshuffled subtree of a certain kind from a real one we keep one of its (randomly chosen) locally external (with respect to the subtree) nodes, ' \
200
+ 'while for each of its other locally external node we replace it with a node of the same global type (internal or external, with respect to the global forest), for which:' \
201
+ '(i) the time at the beginning of its branch is as close as possible to the time at the beginning of the real locally external node\'s branch, ' \
202
+ '(ii) while all the locally external nodes in the reshuffled subtree are different ' \
203
+ 'and (iii) there are no two locally external nodes in the reshuffled subtree that used to belong to the same real subtree of this kind ' \
204
+ '(unless there were not enough such nodes, e.g., 8 tips in total and only 2 4-tip subtrees in the forest).'
170
205
 
171
206
  flavour = feature_name.split('_')[-1]
172
207
  if flavour in BASIC_METRIC2FUN or 'perc' in flavour:
173
208
  res = f'{BASIC_METRIC2HELP[flavour]}' if flavour in BASIC_METRIC2FUN \
174
209
  else f'{re.findall(r'\d+', flavour)[0]}th percentile'
175
- res += f' of average of all tip pair sampling time differences in a {TOPOLOGY_LABEL2NAME[conf]} among all {'' if is_real else 'reshuffled'}' \
210
+ res += f' of average of all external node pair sampling time differences in a {TOPOLOGY_LABEL2NAME[conf]} among all {'' if is_real else 'reshuffled'}' \
176
211
  f'{TOPOLOGY_LABEL2NAME[conf]} in the forest.'
177
212
  if not is_real:
178
213
  res += reshuffling_expl
179
214
  return res
180
215
  else:
181
- if 'random_vs_real_n_less' in feature_name:
216
+ if 'random_vs_real_n_' in feature_name:
217
+ less_or_more = 'smaller' if 'less' == feature_name.split('_')[-1] else 'larger'
182
218
  return f'number of {TOPOLOGY_LABEL2NAME[conf]}, ' \
183
- 'for which their average tip sampling time difference is smaller in real subtrees than ' \
219
+ f'for which their average external node sampling time difference is {less_or_more} in real subtrees than ' \
184
220
  f'in the corresponding reshuffled ones. {reshuffling_expl}'
185
- elif 'random_vs_real_frac_less' in feature_name:
221
+ elif 'random_vs_real_frac_' in feature_name:
222
+ less_or_more = 'smaller' if 'less' == feature_name.split('_')[-1] else 'larger'
186
223
  return f'fraction of {TOPOLOGY_LABEL2NAME[conf]}, ' \
187
- 'for which their average tip sampling time difference is smaller in real subtrees than ' \
224
+ f'for which their average external node sampling time difference is {less_or_more} in real subtrees than ' \
188
225
  f'in the corresponding reshuffled ones. {reshuffling_expl}'
189
- elif 'random_vs_real_pval_less' in feature_name:
226
+ elif 'random_vs_real_pval_' in feature_name:
227
+ less_or_more = 'smaller' if 'less' == feature_name.split('_')[-1] else 'larger'
190
228
  return f'p-value of the sign test checking that for {TOPOLOGY_LABEL2NAME[conf]}, ' \
191
- 'their average tip sampling time differences are indistinguishable in real subtrees and ' \
229
+ 'their average external node sampling time differences are indistinguishable in real subtrees and ' \
192
230
  f'in the corresponding reshuffled ones ' \
193
- f'(the alternative hypothesis is that some real ones are smaller). {reshuffling_expl}'
231
+ f'(the alternative hypothesis is that some real ones are {less_or_more}). {reshuffling_expl}'
194
232
 
195
233
  return None
196
234
 
197
235
  def feature_names(self):
198
236
  return [f'frac_tips_in_{conf}' for conf in TOPOLOGY_LABELS] \
199
237
  + [f'n_tips_in_{conf}' for conf in TOPOLOGY_LABELS] \
238
+ + [f'frac_inodes_{wwo}_sibling_inodes' for wwo in ('with', 'without')] \
239
+ + [f'n_inodes_{wwo}_sibling_inodes' for wwo in ('with', 'without')] \
200
240
  + [f'time_diff_in_{conf}_{type}_{flavour}' for type in ('real', 'random') for flavour in BASIC_ARRAY_METRICS for conf in TOPOLOGY_LABELS if conf != OTHER_CONFIGURATION_LABEL] \
201
241
  + [f'time_diff_in_{conf}_{type}_perc{p}' for type in ('real', 'random') for p in TIP_TIME_PERCENTILES for conf in TOPOLOGY_LABELS if conf != OTHER_CONFIGURATION_LABEL] \
202
- + [f'time_diff_in_{conf}_random_vs_real_{metric}_less' for metric in ('n', 'frac', 'pval') for conf in TOPOLOGY_LABELS if conf != OTHER_CONFIGURATION_LABEL]
242
+ + [f'time_diff_in_{conf}_random_vs_real_{metric}_{how}' for metric in ('n', 'frac', 'pval') for conf in TOPOLOGY_LABELS if conf != OTHER_CONFIGURATION_LABEL for how in ('less', 'more')]
203
243
 
204
244
  def set_forest(self, forest, **kwargs):
205
245
  self._forest = forest
@@ -207,9 +247,13 @@ class SubtreeFeatureCalculator(FeatureCalculator):
207
247
  self._topo2tips = None
208
248
  self._n_tips = None
209
249
  self._all_tips = None
210
- self._topo2tips_random = None
250
+ self._all_inodes = None
251
+ self._sibling_inodes_random = None
211
252
  self._topo2diffs = None
212
253
  self._topo2diffs_random = None
254
+ self._sibling_inodes = None
255
+ self._topo2inodes_random = None
256
+ self._n_inodes = None
213
257
 
214
258
  @property
215
259
  def n_tips(self):
@@ -217,18 +261,36 @@ class SubtreeFeatureCalculator(FeatureCalculator):
217
261
  self._n_tips = sum(len(tree) for tree in self._forest)
218
262
  return self._n_tips
219
263
 
264
+ @property
265
+ def n_inodes(self):
266
+ if self._n_inodes is None:
267
+ self._n_inodes = sum(sum(1 for n in tree.traverse() if not n.is_leaf() and not n.is_root()) for tree in self._forest)
268
+ return self._n_inodes
269
+
220
270
  def conf2tips(self, config_type, is_real=True):
221
271
  if is_real:
222
272
  if self._topo2tips is None:
223
273
  self._topo2tips = get_config2tips(self._forest)
224
274
  return self._topo2tips[config_type]
225
275
 
226
- if self._topo2tips_random is None:
227
- self._topo2tips_random = dict()
228
- if config_type not in self._topo2tips_random:
229
- self._topo2tips_random[config_type] = get_reshuffled_configs(self.conf2tips(config_type, is_real=True),
230
- self.all_tips)
231
- return self._topo2tips_random[config_type]
276
+ if self._sibling_inodes_random is None:
277
+ self._sibling_inodes_random = dict()
278
+ if config_type not in self._sibling_inodes_random:
279
+ self._sibling_inodes_random[config_type] = get_reshuffled_configs(self.conf2tips(config_type, is_real=True),
280
+ self.all_tips)
281
+ return self._sibling_inodes_random[config_type]
282
+
283
+
284
+ def sibling_inodes(self, is_real=True):
285
+ if is_real:
286
+ if self._sibling_inodes is None:
287
+ self._sibling_inodes = pick_siblings(self._forest)
288
+ return self._sibling_inodes
289
+
290
+ if self._sibling_inodes_random is None:
291
+ self._sibling_inodes_random = []
292
+ self._sibling_inodes_random = get_reshuffled_configs(self.sibling_inodes(is_real=True), self.all_inodes)
293
+ return self._sibling_inodes_random
232
294
 
233
295
  def conf2time_diffs(self, config_type, is_real=True):
234
296
  if is_real:
@@ -254,15 +316,31 @@ class SubtreeFeatureCalculator(FeatureCalculator):
254
316
  self._all_tips = sorted([t for tree in self._forest for t in tree], key=lambda _: getattr(_, TIME) - _.dist)
255
317
  return self._all_tips
256
318
 
319
+ @property
320
+ def all_inodes(self):
321
+ if self._all_inodes is None:
322
+ self._all_inodes = sorted([n for tree in self._forest for n in tree.traverse() if not n.is_leaf() and not n.is_root()],
323
+ key=lambda _: getattr(_, TIME) - _.dist)
324
+ return self._all_inodes
325
+
257
326
  def calculate(self, feature_name, **kwargs):
258
327
  if 'tips_in_' in feature_name:
259
328
  conf = feature_name[feature_name.find('tips_in_') + len('tips_in_'):]
260
329
  denominator = self.n_tips if feature_name.startswith('frac') else 1
261
330
  return len(self.conf2tips(TOPOLOGY_LABEL2KEY[conf], is_real=True)) * TOPOLOGY_LABEL2N[conf] / denominator
262
331
 
332
+ if 'inodes_with_sibling_inodes' in feature_name:
333
+ denominator = self.n_inodes if feature_name.startswith('frac') else 1
334
+ return sum(len(_) for _ in self.sibling_inodes(is_real=True)) / denominator
335
+ if 'inodes_without_sibling_inodes' in feature_name:
336
+ denominator = self.n_inodes if feature_name.startswith('frac') else 1
337
+ return (self.n_inodes - sum(len(_) for _ in self.sibling_inodes(is_real=True))) / denominator
338
+
263
339
  if feature_name.startswith('time_diff_in_'):
264
340
  conf = feature_name[feature_name.find('time_diff_in_') + len('time_diff_in_'):].split('_')[0]
265
- time_diffs = self.conf2time_diffs(TOPOLOGY_LABEL2KEY[conf], is_real='real' in feature_name)
341
+ is_real = 'real' in feature_name
342
+ time_diffs = self.conf2time_diffs(TOPOLOGY_LABEL2KEY[conf], is_real=is_real) \
343
+ if conf in TIP_TOPOLOGY_LABELS else self.sibling_inodes(is_real=is_real)
266
344
 
267
345
 
268
346
  flavour = feature_name.split('_')[-1]
@@ -273,13 +351,14 @@ class SubtreeFeatureCalculator(FeatureCalculator):
273
351
  perc = int(re.findall(r'\d+', flavour)[0])
274
352
  return np.percentile(time_diffs, perc) if n else 0
275
353
  else:
276
- time_diffs_random = self.conf2time_diffs(TOPOLOGY_LABEL2KEY[conf], is_real=False)
277
- n_random_less_than_real = (time_diffs_random < time_diffs).sum()
278
- if 'random_vs_real_n_less' in feature_name:
279
- return n_random_less_than_real
280
- elif 'random_vs_real_frac_less' in feature_name:
281
- return n_random_less_than_real / n if n else 0
282
- elif 'random_vs_real_pval_less' in feature_name:
283
- return scipy.stats.binomtest(n_random_less_than_real, n=n, p=0.5,
284
- alternative='less').pvalue if n else 1
354
+ time_diffs_random = self.conf2time_diffs(TOPOLOGY_LABEL2KEY[conf], is_real=False) \
355
+ if conf in TIP_TOPOLOGY_LABELS else self.sibling_inodes(is_real=False)
356
+ is_less = 'less' == feature_name.split('_')[-1]
357
+ n_random_vs_real = ((time_diffs_random < time_diffs) if is_less else (time_diffs_random > time_diffs)).sum()
358
+ if 'random_vs_real_n_' in feature_name:
359
+ return n_random_vs_real
360
+ elif 'random_vs_real_frac_' in feature_name:
361
+ return n_random_vs_real / n if n else 0
362
+ elif 'random_vs_real_pval_' in feature_name:
363
+ return scipy.stats.binomtest(n_random_vs_real, n=n, p=0.5, alternative='less').pvalue if n else 1
285
364
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: treesumstats
3
- Version: 0.2
3
+ Version: 0.4
4
4
  Summary: Encoding phylogenetic trees with summary statistics.
5
5
  Home-page: https://github.com/evolbioinfo/treesumstats
6
6
  Author: Anna Zhukova
@@ -250,11 +250,11 @@ The top part includes times <= T/3, the middle one > T/3 and <= 2T/3, the bottom
250
250
  Implemented in [_treesumstats.subtree_sumstats.SubtreeFeatureCalculator_](treesumstats/subtree_sumstats.py).
251
251
 
252
252
  In some of the following statistics reshuffled subtrees are mentioned.
253
- To construct a _reshuffled subtree_ of a certain kind (cherry, triplet, etc.) from a real one we keep one of its (randomly chosen) tips,
254
- while for each other tip from the real subtree we replace it with a tip, for which:
255
- (i) the time at the beginning of its branch is as close as possible to the time at the beginning of the real tip's branch,
256
- (ii) while all the tips in the reshuffled subtree are different and
257
- (iii) there are no two tips in the reshuffled subtree that used to belong to the same real subtree of this kind
253
+ To construct a _reshuffled subtree_ of a certain kind (cherry, triplet, etc.) from a real one we keep one of its (randomly chosen) locally (with respect to the subtree) external node,
254
+ while for each other locally external node from the real subtree we replace it with a node of globally (with respect to the forest) the same type (external or internal), for which:
255
+ (i) the time at the beginning of its branch is as close as possible to the time at the beginning of the real node's branch,
256
+ (ii) while all the locally external nodes in the reshuffled subtree are different and
257
+ (iii) there are no two locally external nodes in the reshuffled subtree that used to belong to the same real subtree of this kind
258
258
  (unless there were not enough tips, e.g., 8 tips in total and only 2 ladderized quartets in the forest).
259
259
 
260
260
  We consider the following 2-tip, 3-tip and 4-tip subtrees to calculate the summary statistics:
@@ -267,39 +267,56 @@ We consider the following 2-tip, 3-tip and 4-tip subtrees to calculate the summa
267
267
  * 4L: fully resolved ladderized quartet
268
268
  * 4B: fully resolved balanced quartet (with two cherries as children)
269
269
 
270
- In the following statistics (spanning several list positions) X must be replaced by one of the following values: 2, 3U, 3L, 4U, 4U3U1, 4U211, 4L or 4B.
270
+ We also consider fully internal-node subtrees:
271
+ * I: fully unresolved subtree (or size 2 or more) whose locally external nodes are globally internal sibling nodes.
271
272
 
272
- 1-8. **frac_tips_in_X:** fraction of forest tips that are found in subtrees of type X.
273
+ In the following statistics (spanning several list positions) XT must be replaced by one of the following values: 2, 3U, 3L, 4U, 4U3U1, 4U211, 4L or 4B, while X must be replaced by either I or one of the XT values.
274
+
275
+ 1-8. **frac_tips_in_XT:** fraction of forest tips that are found in subtrees of type XT.
273
276
  9. **frac_tips_in_O:** fraction of forest tips that are not part of any subtree of size 2, 3 or 4.
274
277
 
275
- 10-17. **n_tips_in_X:** number of forest tips that are found in subtrees of type X.
278
+ 10-17. **n_tips_in_XT:** number of forest tips that are found in subtrees of type XT.
276
279
  18. **n_tips_in_O:** number of forest tips that are not part of any subtree of size 2, 3 or 4.
280
+ 19. **frac_inodes_with_sibling_inodes:** fraction of forest non-root internal nodes that have internal siblings.
281
+ 20. **frac_inodes_without_sibling_inodes:** fraction of forest non-root internal nodes that do not have internal siblings.
282
+ 19. **n_inodes_with_sibling_inodes:** number of forest non-root internal nodes that have internal siblings.
283
+ 20. **n_inodes_without_sibling_inodes:** number of forest non-root internal nodes that do not have internal siblings.
284
+
285
+ 21-29. **time_diff_in_X_real_mean:** mean among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
286
+
287
+ 30-38. **time_diff_in_X_real_min:** minimum among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
288
+
289
+ 39-47. **time_diff_in_X_real_max:** maximum among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
290
+
291
+ 48-56. **time_diff_in_X_real_var:** variance among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
292
+
293
+ 57-65. **time_diff_in_X_real_median:** median among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
277
294
 
278
- 19-26. **time_diff_in_X_real_mean:** mean among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
295
+ 66-74. **time_diff_in_X_random_mean:** mean among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
279
296
 
280
- 27-34. **time_diff_in_X_real_min:** minimum among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
297
+ 75-83. **time_diff_in_X_random_min:** minimum among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
281
298
 
282
- 35-42. **time_diff_in_X_real_max:** maximum among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
299
+ 84-93. **time_diff_in_X_random_max:** maximum among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
283
300
 
284
- 43-50. **time_diff_in_X_real_var:** variance among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
301
+ 94-103. **time_diff_in_X_random_var:** variance among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
285
302
 
286
- 51-58. **time_diff_in_X_real_median:** median among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
303
+ 104-112. **time_diff_in_X_random_median:** median among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
287
304
 
288
- 19-26. **time_diff_in_X_random_mean:** mean among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
305
+ 113-184. **time_diff_in_X_real_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
289
306
 
290
- 27-34. **time_diff_in_X_random_min:** minimum among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
307
+ 184-255. **time_diff_in_X_random_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all reshuffled subtrees of type X in the forest, of average of all locally external node pair sampling time differences in the subtree.
291
308
 
292
- 35-42. **time_diff_in_X_random_max:** maximum among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
309
+ 256-264. **time_diff_in_X_random_vs_real_n_less:** number of subtrees of type X whose average locally external node sampling time differences is smaller in real subtrees than in the corresponding reshuffled ones.
293
310
 
294
- 43-50. **time_diff_in_X_random_var:** variance among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
311
+ 265-273. **time_diff_in_X_random_vs_real_n_more:** number of subtrees of type X whose average locally external node sampling time differences is larger in real subtrees than in the corresponding reshuffled ones.
295
312
 
296
- 51-58. **time_diff_in_X_random_median:** median among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
313
+ 274-282. **time_diff_in_X_random_vs_real_frac_less:** fraction of subtrees of type X whose average locally external node sampling time differences is smaller in real subtrees than in the corresponding reshuffled ones.
297
314
 
298
- 59-122. **time_diff_in_X_real_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
315
+ 283-291. **time_diff_in_X_random_vs_real_frac_more:** fraction of subtrees of type X whose average locally external node sampling time differences is larger in real subtrees than in the corresponding reshuffled ones.
299
316
 
300
- 123-186. **time_diff_in_X_random_percN:** Nth percentile (where N can be 1, 5, 10, 25, 75, 90, 95 or 99) among all reshuffled subtrees of type X in the forest, of average of all tip pair sampling time differences in the subtree.
317
+ 292-301. **time_diff_in_X_random_vs_real_pval_less:** p-value of the sign test checking that for subtrees of type X, their average locally external node sampling time differences are indistinguishable in real subtrees and in the corresponding reshuffled ones (the alternative hypothesis is that some real ones are smaller).
301
318
 
302
- 187-194. **time_diff_in_X_random_vs_real_n_less:** p-value of the sign test checking that for subtrees of type X, their average tip sampling time differences are indistinguishable in real subtrees and in the corresponding reshuffled ones (the alternative hypothesis is that some real ones are smaller).
319
+ 302-310. **time_diff_in_X_random_vs_real_pval_more:** p-value of the sign test checking that for subtrees of type X, their average locally external node sampling time differences are indistinguishable in real subtrees and in the corresponding reshuffled ones (the alternative hypothesis is that some real ones are larger).
303
320
 
304
321
 
305
322
  ## Input data
File without changes
File without changes