I have a list of objects:
Data:
0 RS_GCF_001999625.1
1 RS_GCF_001658645.1
2 RS_GCF_900117665.1
3 RS_GCF_000652055.1
4 RS_GCF_003037025.1
5 RS_GCF_002138225.1
6 RS_GCF_001186785.1
7 RS_GCF_001671475.1
8 RS_GCF_000153745.1
9 RS_GCF_002814015.1
10 GB_GCA_900471825.1
...
And I also have a phylogenetic tree (a tree-like data structure) that is stored like this
((((((((((((((((((((((((((((((((((((((((((((((((((((GB_GCA_900317315.1:0.04615,GB_GCA_900316815.1:0.04778)100.0:0.02419,GB_GCA_900317595.1:0.06625)33.0:0.0103,((GB_GCA_900316435.1:0.00693,GB_GCA_900318905.1:0.01341)96.0:0.00933,GB_GCA_900315195.1:0.01321)100.0:0.03115)26.0:0.01004,GB_GCA_900317875.1:0.045)100.0:0.04319,((GB_GCA_900315085.1:0.0231,GB_GCA_900318495.1:0.03029)100.0:0.01288,GB_GCA_003520555.1:0.03868)100.0:0.03609)70.0:0.01129,(((RS_GCF_900100595.1:0.03254,GB_GCA_900320415.1:0.04749)100.0:0.02208,GB_GCA_900316555.1:0.04989)100.0:0.03981,GB_GCA_900319655.1:0.10366)88.0:0.01387)100.0:0.02225,GB_GCA_900315605.1:0.07632)100.0:0.02364,RS_GCF_900101355.1:0.07185)86.0:0.01434,(((RS_GCF_002834235.1:0.00897,RS_GCF_002834225.1:0.00767)100.0:0.05389,GB_GCA_002493005.1:0.06092)100.0:0.02495,(GB_GCA_002491825.1:0.02107,GB_GCA_003521625.1:0.00495)100.0:0.03844)45.0:0.01157)46.0:0.01147,GB_GCA_002493635.1:0.0779)95.0:0.02318,GB_GCA_003526955.1:0.09126)100.0:0.0663,((GB_GCA_900315785.1:0.03418,GB_GCA_900316385.1:0.04382)100.0:0.05347,GB_GCA_002350765.1:0.07654)100.0:0.08554)100.0:0.03171,GB_GCA_900314705.1:0.18199)88.0:0.02358,(((((((GB_GCA_002394725.1:0.01259,GB_GCA_003499325.1:0.01449)45.0:0.00402,GB_GCA_900314795.1:0.01139)92.0:0.00728,GB_GCA_900320995.1:0.01735)100.0:0.02748,GB_GCA_900313865.1:0.06193)98.0:0.01767,GB_GCA_900319615.1:0.05467)100.0:0.0367,(GB_GCA_900313895.1:0.05183,GB_GCA_900315815.1:0.04148)100.0:0.0325)100.0:0.07701,GB_GCA_002353935.1:0.14242)100.0:0.08383)'100.0:g__Ruminococcus_E':0.05063,RS_GCF_002160515.1:0.16245)100.0:0.03238,(((GB_GCA_900313125.1:0.05466,GB_GCA_900317025.1:0.04564)95.0:0.01875,GB_GCA_900317815.1:0.07418)100.0:0.07807,((GB_GCA_900315255.1:0.0423,GB_GCA_900315715.1:0.04172)100.0:0.05538,GB_GCA_900320535.1:0.10753)100.0:0.03534)'100.0:g__RUG592':0.14947)94.0:0.02308,((((GB_GCA_900316615.1:0.02438,GB_GCA_900316025.1:0.01638)100.0:0.09448,GB_GCA_000435335.1:0.07944)'100.0:g__CAG-964':0.09347,GB_GCA_002391625.1:0.11943)88.0:0.04386,GB_GCA_002493755.1:0.19241)98.0:0.03042)99.0:0.03425,...
This tree is huge and what I want is to reduce the tree. I want to maintain in this tree all the leaves I have on my list data and remove the rest.
I am not familiar with working with ete3, can anyone put me in the right direction?
It seems you need to prune your target tree. Check example 25 of the below case study https://www.programcreek.com/python/example/93895/ete3.Tree
Ziqi