grunwaldlab / grunwaldlab/metacoder

Make standard stacked barcharts

Open
#105 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
148
Forks
30
PR merge metrics
No merged PRs in 30d

Description

This would take a taxmap as input and return a ggplot2 graph. The dataset would typically be the result of soemthing like calc_taxon_abund

stacked_barchart(obj, dataset, cols = NULL, groups = NULL, ranks = NULL)

dataset, cols and groups would work like those options in functions like calc_taxon_abund. The same parsers for those options should be reused.

ranks would take two types of input:

  • character: The names of ranks (e.g. ranks = "genus")
  • numeric: The "depth" of the rank from the root (e.g. rank = 4)

If multiple values for ranks is given, then one stacked barchart for each rank will be produced and combined into the same graph using ggplot2 facets or cowplot. If ranks is NULL, then the finest rank should be picked such that >90% of the bar is split into fewer than 10 colors with an "other" group (grey) added for the extra 10%. If the taxmap has rank info (e.g. taxon_ranks(obj)) then a named rank will be picked. Otherwise, a "depth" of the rank from the root will be picked. This function should not be allowed to print more than 10 colorsl.

phyloseq already has a barchart function:

https://joey711.github.io/phyloseq/plot_bar-examples.html

So this would mainly be a convenience for using taxmap objects instead of phyloseq objects.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are named. Start by tracing the option parsers used by calc_taxon_abund and the rank information exposed by taxon_ranks, then compare phyloseq's plot_bar examples. Done means a taxmap-based stacked bar-chart function supports the specified dataset, grouping, column, and rank inputs while limiting displayed colors as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.