-
Notifications
You must be signed in to change notification settings - Fork 1
Description
We've already produced the following plot types using ggoncoplot:
But its not easy and a mere hacky extension of pathway functionality.
We should add a 'col_facet' argument that allows us to facet the main oncoplot based on a categorical column of data. This is basically how pathway information is added (internally) but we could generalise, making it easier to split by either mutation level categories (germline/somatic) OR gene-level categories (pathway) - since both are easy to annotate on data.
The real question is how to sort samples across the facets & how to sort the facets. As always, sample order is based on gene order, so we just need to decide gene order. This is nontrivial. Should gene order be based on counts across all facets, or just one of the facets? Should gene rankings be done within each group. Gene X is rank 1 in one facet, but Gene Y is rank 1 in the other - which takes priority? Well whichever facet is higher up - but which should that be? User-specified? Autoselected based on data?
Heres an algorithm I think would work for somatic vs germline & also pathway annotations - based on the above plot:
- Identify
genes_to_include: if topn=finite value then Rank genes ignoring facets. Gives an objective gene ranking and ability to choose the 'topN' genes. - Rank each facet level using a 2 step sort
a. count how many distinct 'topN' genes are mutated (e.g. how many rows in the oncoplot would this facet level require).
b. To deal with facets including the same number of genes - Break ties based on how many unique samples would have mutations in the facets. - Order facet levels based on (2).
- Rerank genes based on 1) facet order - all genes in the top facet should rank above those only in lower facets. 2) mutation freq in each facet.
- Order samples based on gene order as usual
What if user wants to change facet level order:
- Skip 1 & 2. Start by ordering facet levels based on user preference.
- Do (4) & (5) above.