CRI-iAtlas / shiny-iatlas

An interactive web portal for exploring immuno-oncology data. This repo now superseded by iatlas-app
https://www.cri-iatlas.org
Apache License 2.0
47 stars 12 forks source link

Fix Clinical Outcomes when ploting TCGA subtypes #132

Closed andrewelamb closed 5 years ago

andrewelamb commented 5 years ago

Certain TCGA subtypes such as 'AML' cause errors like:

'names' attribute [8] must be the same length as the vector [4]

When the Clinical Outcomes module attempts to create a kmplot. These seem to be smaller groups and may need to handled as an error.

Gibbsdavidl commented 5 years ago

ok, getting to this

Gibbsdavidl commented 5 years ago

OK, looks like one of the subtypes of AML (AML.1) doesn't have a member with status ==0 ... might be causing it... here's a table with counts of each status for each subtype. Can probably fix this early tomorrow.

> # A tibble: 8 x 3
>   variable  Num1  Num0
>   <fct>    <int> <int>
> 1 AML.         6     2
> 2 AML.1       12     0
> 3 AML.2       14     5
> 4 AML.3        5    13
> 5 AML.4       21    15
> 6 AML.5       20    13
> 7 AML.6       19     9
> 8 AML.7       14     6
> 
Gibbsdavidl commented 5 years ago

I have narrowed it down to the call to create_kmplot... in particular, error happens when risk.table = T.

There is no error by removing the group_colors. For some reason, with AML, there's 8 subtypes but 14 colors in the group_colors here. So, a quick fix is to remove it.

survminer::ggsurvplot( fit, data = df, conf.int = F, risk.table = T, title = "title", palette = group_colors )

Gibbsdavidl commented 5 years ago

The second error, in the heatmap, comes from the ci_mat matrix, which is all NaNs.

Several of the features (columns) in LAML, are all NAs ...

Gibbsdavidl commented 5 years ago

FIXED the color bug!

Problem was the survival fit appended the subtype names with the column name, "variable=", and then the plot function needed palette to be a named vector --- matching the subtype names --- like 'variable=LAML.1'

Gibbsdavidl commented 5 years ago

The second bug in the heatmap ... I think just comes from some TCGA studies that have missing info in the feature matrix.... can maybe just catch it and display a message.