Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upLook into cli for adding text trees #173
Comments
|
Easy and awesome!
|
|
done |
|
nice, very cool |
|
curious how this new tree printing works when trees are large? would we want some nodes with a lot of tips to be collapsed for a higher level summary? or maybe there's a way to do that already? |
|
I was thinking about that as well. I tried it with ~1500 taxa and it works within a few seconds, but it printed more text than the Rstudio console would display. one line per taxon. I figure people could use > library(metacoder)
> x = parse_tax_data(hmp_otus, class_cols = "lineage", class_sep = ";",
+ class_key = c(tax_rank = "info", tax_name = "taxon_name"),
+ class_regex = "^(.+)__(.+)$")
> print_tree(x)
Root
├─Proteobacteria
│ ├─Gammaproteobacteria
│ │ ├─Pasteurellales
│ │ │ └─Pasteurellaceae
│ │ │ ├─Haemophilus
│ │ │ └─Actinobacillus
│ │ ├─Pseudomonadales
│ │ │ ├─Moraxellaceae
│ │ │ │ ├─Moraxella
│ │ │ │ └─Acinetobacter
│ │ │ └─Pseudomonadaceae
│ │ │ └─Pseudomonas
│ │ └─Enterobacteriales
│ │ └─Enterobacteriaceae
│ │ ├─Escherichia
│ │ ├─Klebsiella
│ │ ├─Raoultella
│ │ └─Providencia
│ ├─Betaproteobacteria
│ │ ├─Neisseriales
│ │ │ └─Neisseriaceae
│ │ │ ├─Neisseria
│ │ │ ├─Eikenella
│ │ │ └─Kingella
│ │ └─Burkholderiales
│ │ ├─Burkholderiaceae
│ │ │ ├─Lautropia
│ │ │ ├─Ralstonia
│ │ │ └─Cupriavidus
│ │ ├─Comamonadaceae
│ │ │ └─Acidovorax
│ │ └─Alcaligenaceae
│ │ └─Sutterella
│ ├─Alphaproteobacteria
│ │ ├─Rhizobiales
│ │ │ ├─Methylobacteriaceae
│ │ │ │ └─Methylobacterium
│ │ │ ├─Bradyrhizobiaceae
│ │ │ │ └─Bradyrhizobium
│ │ │ └─Phyllobacteriaceae
│ │ │ └─Mesorhizobium
│ │ └─Sphingomonadales
│ │ └─Sphingomonadaceae
│ │ └─Sphingomonas
│ └─Epsilonproteobacteria
│ └─Campylobacterales
│ ├─Campylobacteraceae
│ │ └─Campylobacter
│ └─Helicobacteraceae
│ └─Helicobacter
├─Bacteroidetes
│ ├─Flavobacteria
│ │ └─Flavobacteriales
│ │ └─Flavobacteriaceae
│ │ ├─Capnocytophaga
│ │ └─Chryseobacterium
│ └─Bacteroidia
│ └─Bacteroidales
│ ├─Porphyromonadaceae
│ │ ├─Porphyromonas
│ │ ├─Odoribacter
│ │ ├─Parabacteroides
│ │ └─Tannerella
│ ├─Bacteroidaceae
│ │ └─Bacteroides
│ ├─Rikenellaceae
│ │ └─Alistipes
│ └─Prevotellaceae
│ └─Prevotella
├─Actinobacteria
│ └─Actinobacteria
│ ├─Actinomycetales
│ │ ├─Propionibacteriaceae
│ │ │ └─Propionibacterium
│ │ ├─Corynebacteriaceae
│ │ │ └─Corynebacterium
│ │ ├─Actinomycetaceae
│ │ │ └─Actinomyces
│ │ ├─Micrococcaceae
│ │ │ ├─Rothia
│ │ │ └─Micrococcus
│ │ ├─Mycobacteriaceae
│ │ │ └─Mycobacterium
│ │ ├─Brevibacteriaceae
│ │ │ └─Brevibacterium
│ │ ├─Nocardiaceae
│ │ │ └─Rhodococcus
│ │ ├─Geodermatophilaceae
│ │ │ └─Geodermatophilus
│ │ └─Intrasporangiaceae
│ └─Coriobacteriales
│ └─Coriobacteriaceae
│ ├─Atopobium
│ └─Collinsella
├─Firmicutes
│ ├─Bacilli
│ │ ├─Bacillales
│ │ │ ├─Staphylococcaceae
│ │ │ │ └─Staphylococcus
│ │ │ ├─Bacillaceae
│ │ │ │ └─Bacillus
│ │ │ └─Alicyclobacillaceae
│ │ │ └─Alicyclobacillus
│ │ ├─Lactobacillales
│ │ │ ├─Streptococcaceae
│ │ │ │ ├─Streptococcus
│ │ │ │ └─Lactococcus
│ │ │ ├─Carnobacteriaceae
│ │ │ │ └─Granulicatella
│ │ │ ├─Lactobacillaceae
│ │ │ │ └─Lactobacillus
│ │ │ └─Enterococcaceae
│ │ │ └─Enterococcus
│ │ └─Gemellales
│ │ └─Gemellaceae
│ │ └─Gemella
│ └─Clostridia
│ └─Clostridiales
│ ├─Veillonellaceae
│ │ ├─Selenomonas
│ │ ├─Veillonella
│ │ ├─Dialister
│ │ ├─Mitsuokella
│ │ ├─Megasphaera
│ │ └─Phascolarctobacterium
│ ├─Clostridiaceae
│ │ └─Clostridium
│ ├─Lachnospiraceae
│ │ ├─Moryella
│ │ ├─Oribacterium
│ │ ├─Shuttleworthia
│ │ ├─Clostridium
│ │ ├─Eubacterium
│ │ ├─Roseburia
│ │ ├─Catonella
│ │ ├─Ruminococcus
│ │ ├─Coprococcus
│ │ ├─Lachnospira
│ │ └─Blautia
│ ├─Ruminococcaceae
│ │ ├─Faecalibacterium
│ │ ├─Ruminococcus
│ │ ├─Oscillospira
│ │ ├─Subdoligranulum
│ │ └─Eubacterium
│ ├─Peptostreptococcaceae
│ │ └─Peptostreptococcus
│ └─Dehalobacteriaceae
│ └─Dehalobacterium
├─Fusobacteria
│ └─Fusobacteria
│ └─Fusobacteriales
│ └─Fusobacteriaceae
│ ├─Leptotrichia
│ └─Fusobacterium
├─Tenericutes
│ ├─Erysipelotrichi
│ │ └─Erysipelotrichales
│ │ ├─vadinHA31
│ │ │ └─RFN20
│ │ └─Erysipelotrichaceae
│ │ ├─Erysipelothrix
│ │ ├─Bulleidia
│ │ └─Clostridium
│ └─Mollicutes
│ └─Mycoplasmatales
│ └─Mycoplasmataceae
│ └─Mycoplasma
└─Spirochaetes
└─Spirochaetes
└─Spirochaetales
└─Spirochaetaceae
└─Treponema
>
> filter_taxa(x, n_supertaxa <= 2) %>%
+ print_tree()
Root
├─Proteobacteria
│ ├─Gammaproteobacteria
│ ├─Betaproteobacteria
│ ├─Alphaproteobacteria
│ └─Epsilonproteobacteria
├─Bacteroidetes
│ ├─Flavobacteria
│ └─Bacteroidia
├─Actinobacteria
│ └─Actinobacteria
├─Firmicutes
│ ├─Bacilli
│ └─Clostridia
├─Fusobacteria
│ └─Fusobacteria
├─Tenericutes
│ ├─Erysipelotrichi
│ └─Mollicutes
└─Spirochaetes
└─SpirochaetesWe could add something like "max_levels" as an option that does this for them? |
This looks cool:
https://github.com/r-lib/cli#trees
It would be nice to add to taxa for all
hierarcies,taxonomy, andtaxmap.Could be called
print_tree.