Skip to content

Commit

Permalink
update detailed example
Browse files Browse the repository at this point in the history
  • Loading branch information
grst committed Sep 9, 2019
1 parent 9f0f471 commit 7b4128b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
47 changes: 43 additions & 4 deletions vignettes/detailed_example.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ library(dplyr)
library(ggplot2)
library(tidyr)
library(immunedeconv)
library(tibble)
```

*Immunedeconv* ships with an example dataset with samples from four patients with metastatic melanoma published in @EPIC2017.
Expand Down Expand Up @@ -60,9 +61,11 @@ res_quantiseq %>%

We observe that

* the scores of the first two samples sum to 1, while the last two don't. #TODO other cells
* the first two samples contain a large quantity of B cells and CD4+ T cells.
* the first two samples (LAU355, LAU1314) appear to contain a large amount of CD4+ T cells and B cells
* the last two samples (LAU1255, LAU125) appear to contain a large amount of "uncharacterized cells"
* the last sample (LAU125) appears to contain no CD8+ T cells, often associated with bad prognosis.

Estimating the amount of "uncharacterized cells" is a novel feature introduced by quanTIseq and EPIC [@EPIC2017, @quantiseq2017]. This estimate often corresponds to the fraction of tumor cells in the sample.


Let's now apply MCP-counter to the same dataset.
Expand All @@ -85,7 +88,43 @@ res_mcp_counter %>%
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
```

With the scores being in arbitrary units, the results are not useful for judging if a cell type is present in the sample, or not. However, the score correctly reflects the presence of NK cells and CD8+ T cells in the corresponding samples.
With the scores being in arbitrary units, the results are not useful for judging if a cell type is present in the sample, or not. However, we can compare the relative values between samples and relate them to the results we obtained earlier using quanTIseq.

* Consistent with quanTIseq, MCP-counter predicts B cells to be more abundant in LAU355 and LAU1314 than in the other two samples.
* Also consistent with quanTIseq, the last LAU125 appears to contain significantly less CD8+ T cells than the other samples.
* the estimates for Neutrophils and Monocytes are inconsistent with quanTIseq.

## TODO add comparison with FACS data.

## Comparison with FACS data
Let's now compare the results with 'gold standard' FACS data obtained for the four samples. This is, of course, not a representative benchmark, but it gives a notion about what magnitude of predictive accuracy we can expect.
```{r}
# construct a single dataframe containing all data
#
# re-map the cell-types to common names.
# only include the cell-types that are measured using FACS
cell_types = c("B cell", "T cell CD4+", "T cell CD8+", "NK cell")
tmp_quantiseq = res_quantiseq %>% map_result_to_celltypes(cell_types, "quantiseq") %>%
rownames_to_column("cell_type") %>%
gather("sample", "estimate", -cell_type) %>%
mutate(method="quanTIseq")
tmp_mcp_counter = res_mcp_counter %>% map_result_to_celltypes(cell_types, "mcp_counter") %>%
rownames_to_column("cell_type") %>%
gather("sample", "estimate", -cell_type) %>%
mutate(method="MCP-counter")
result = bind_rows(tmp_quantiseq, tmp_mcp_counter) %>%
inner_join(dataset_racle$ref)
```

Plot the true vs. estimated values:
```{r, fig.width=6, fig.height=7}
result %>%
ggplot(aes(x=true_fraction, y=estimate)) +
geom_point(aes(shape=cell_type, color=cell_type)) +
facet_wrap(cell_type~method, scales="free_y", ncol = 2) +
scale_color_brewer(palette = "Dark2") +
theme_bw()
```

(MCP counter does not provide estimates for CD4+ T cells.)
1 change: 1 addition & 0 deletions vignettes/immunedeconv.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ The algorithm is explained in detail in the methods section of @sturm2019.
In general, cell-type scores allow for the comparison (1) between samples, (2) between cell-types or (3) both.
Between-sample comparisons allow to make statements such as *"In patient A, there are more CD8+ T cells than in patient B"*.
Between-cell-type comparisons allow to make statements such as *"In a certain patient, there are more B cells than T cells"*.
For more information, see our Benchmark paper (@sturm2019).

### Methods that allow between-sample comparisons

Expand Down

0 comments on commit 7b4128b

Please sign in to comment.