cohorts icon indicating copy to clipboard operation
cohorts copied to clipboard

Pretty field labels for functions

Open jburos opened this issue 8 years ago • 5 comments

Taking (now closed) PR #116 & turning it into a feature request for discussion.

Goal

Rather than printing missense_snv_col in plots, print Missense SNV Count / MB or Missense SNV Count, depending on the params.

however

(here quoting from the PR)

This got a little complicated for the following reasons:

Once I rename a column, something like cohort.plot_boolean(on=[missense_snv_count, split_3_mos], plot_col="missense_snv_count", boolean_col="split_3_mos") won't work because "split_3_mos" is renamed.

It's non-trivial to figure out whether a function is normalizing per MB. I can hackishly inspect the arguments (fn_argnames = fn.code.co_varnames; if "normalized_per_mb" in fn_argnames), which works for e.g. snv_count, but that doesn't work for expressed_neoantigen_count, for which normalized_per_mb isn't actually an argument. I'll probably need to run the function and set state if we're normalizing.

Going to table this for now.

jburos avatar Aug 15 '16 19:08 jburos

I think this resolved (or at least a slightly different discussion) with the new API. Now every plotting function should take a dictionary similar to { 'Nice Name' : compute_func }

arahuja avatar Sep 30 '16 15:09 arahuja

Should we allow the "pretty name" versions of fields to be set at the cohort level?

jburos avatar Sep 30 '16 16:09 jburos

Should we allow the "pretty name" versions of fields to be set at the cohort level?

I think for functions that we provide that could make sense, since we know all of those functions, i.e. snv_count, missense_snv_coun, but would hard in general, since there is not a complete collection of possible functions.

arahuja avatar Sep 30 '16 16:09 arahuja

Yeah that makes sense. I was thinking of allowing a user to pass in a dictionary of pretty names on cohort creation which, if defined for a function, could be the default display name.

jburos avatar Sep 30 '16 16:09 jburos

At first glance I like that idea @jburos 👍

tavinathanson avatar Oct 10 '16 16:10 tavinathanson