Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look into cli for adding text trees #173

Closed
zachary-foster opened this issue May 17, 2018 · 5 comments
Closed

Look into cli for adding text trees #173

zachary-foster opened this issue May 17, 2018 · 5 comments

Comments

@zachary-foster
Copy link
Collaborator

@zachary-foster zachary-foster commented May 17, 2018

This looks cool:

https://github.com/r-lib/cli#trees

It would be nice to add to taxa for all hierarcies, taxonomy, and taxmap.
Could be called print_tree.

@zachary-foster
Copy link
Collaborator Author

@zachary-foster zachary-foster commented May 17, 2018

Easy and awesome!

Mammalia
├─Felidae
│ ├─Panthera
│ │ └─tigris
│ └─Felis
│   └─catus
├─Notoryctidae
│ └─Notoryctes
│   └─typhlops
└─Hominidae
  └─homo
    └─sapiens
zachary-foster added a commit that referenced this issue May 18, 2018
Resolves issue #173
@zachary-foster
Copy link
Collaborator Author

@zachary-foster zachary-foster commented May 18, 2018

done

@sckott
Copy link
Member

@sckott sckott commented May 18, 2018

nice, very cool

@sckott
Copy link
Member

@sckott sckott commented May 18, 2018

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?

@zachary-foster
Copy link
Collaborator Author

@zachary-foster zachary-foster commented May 18, 2018

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 filter_taxa to cut it down:

> 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
  └─Spirochaetes

We could add something like "max_levels" as an option that does this for them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.