Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Mapping high level histology color labels -- Part 1 #899

Merged
merged 27 commits into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e708bb1
Push the basic notebook so far
cansavvy Jan 12, 2021
d2e0fc7
Make color palette smaller and move set.seed()
cansavvy Jan 12, 2021
f571738
Polishing polishing polishing
cansavvy Jan 12, 2021
15a3651
One more formatting edit
cansavvy Jan 12, 2021
a02c616
Add to CI testing
cansavvy Jan 12, 2021
bc4935a
Merge branch 'master' into cansavvy/mapping-table
cansavvy Jan 12, 2021
5e00fe2
Fix formatting in CI test file whoops
cansavvy Jan 12, 2021
4580439
Merge remote-tracking branch 'cansavvy/cansavvy/mapping-table' into c…
cansavvy Jan 12, 2021
959b683
Incorporate part of jashapiro review
cansavvy Jan 13, 2021
a173f91
Push a few other changes from jashapiro review
cansavvy Jan 13, 2021
a3c165b
re-run notebook
cansavvy Jan 13, 2021
81b3004
Update documentation
cansavvy Jan 13, 2021
f339b42
Merge branch 'master' into cansavvy/mapping-table
cansavvy Jan 13, 2021
566a7c6
Add back the `Normal` labels
cansavvy Jan 13, 2021
3ceaaf3
Merge remote-tracking branch 'cansavvy/cansavvy/mapping-table' into c…
cansavvy Jan 13, 2021
4e4a7f0
Switch to jharenza recomendations (also do capitalization thing)
cansavvy Jan 13, 2021
465477e
Get rid of small_groups_cutoff remnant
cansavvy Jan 13, 2021
8896f0a
Merge branch 'master' into cansavvy/mapping-table
cansavvy Jan 14, 2021
709e623
Incorporate jharenza review -- make Other and Benign gray
cansavvy Jan 14, 2021
a0603b7
Merge remote-tracking branch 'cansavvy/cansavvy/mapping-table' into c…
cansavvy Jan 14, 2021
6ac8a8e
Some tidyverse rearranging because hex_codes weren't actually saving …
cansavvy Jan 14, 2021
35a0700
Okay had my hex_code list/names backwards now we're good
cansavvy Jan 14, 2021
a479b34
Don't do tolower on all those variables!
cansavvy Jan 15, 2021
9e79a70
Make Normal samples have hex code NA
cansavvy Jan 15, 2021
242c21e
Use black hex code for normal
cansavvy Jan 15, 2021
449cb0f
re-run notebook again
cansavvy Jan 15, 2021
ec68189
Fix typo and re-run
cansavvy Jan 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions figures/mapping-histology-labels.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Now we'll select histology variables we mentioned above and so capitalization di
```{r}
working_metadata <- metadata %>%
dplyr::select(Kids_First_Biospecimen_ID, sample_type, histology_variables) %>%
dplyr::mutate_at(histology_variables, tolower)
dplyr::mutate(broad_histology_lower = tolower(broad_histology))
```

# Take a look at how many biospecimens per `broad_histology` group
Expand All @@ -103,8 +103,8 @@ Because the `Normal` samples don't have histologies, we'll look at just the `Tum
```{r}
broad_summary <- working_metadata %>%
dplyr::filter(sample_type == "Tumor") %>%
dplyr::count(broad_histology) %>%
dplyr::arrange(n)
dplyr::count(broad_histology_lower) %>%
dplyr::arrange(n)
```

Let's print out the summary.
Expand Down Expand Up @@ -142,7 +142,7 @@ lgat <- c("other astrocytic tumor", "low-grade astrocytic tumor")
histology_table <- working_metadata %>%
dplyr::mutate(
# NAs are really Normals
display_group = tidyr::replace_na(broad_histology, "normal"),
display_group = tidyr::replace_na(broad_histology_lower, "normal"),
# Now do the group combining
display_group = forcats::fct_collapse(display_group,
"low-grade astrocytic tumor" = lgat,
Expand Down Expand Up @@ -205,8 +205,14 @@ names(subset_colors) <- display_group_df$display_group
We want `Other tumor` and the `Benign` group to both always be gray.

```{r}
subset_colors[names(subset_colors) == 'other tumor'] <- "#D3D3D3"
subset_colors[names(subset_colors) == 'benign'] <- "#808080"
subset_colors[names(subset_colors) == 'other tumor'] <- "#808080"
subset_colors[names(subset_colors) == 'benign'] <- "#D3D3D3"
```

Normal biospecimen's should not get plotted, so we will put their hex code as black.

```{r}
subset_colors[names(subset_colors) == 'normal'] <- "#000000"
```

Use `pie` function to preview what these look like.
Expand All @@ -220,7 +226,9 @@ pie(rep(1, n_colors),
Add the hex codes to the `histology_table`.

```{r}
histology_table <- histology_table %>%
histology_table <- histology_table %>%
# We don't need this anymore
dplyr::select(-broad_histology_lower) %>%
# Add the hex_codes
dplyr::mutate(hex_codes = dplyr::recode(display_group, !!!subset_colors)) %>%
# Restore capitalization so its pretty for labeling
Expand Down
105 changes: 62 additions & 43 deletions figures/mapping-histology-labels.nb.html

Large diffs are not rendered by default.

Loading