Skip to content

Commit

Permalink
Change the instructions for the heatmap exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Dunning authored and Mark Dunning committed Dec 6, 2024
1 parent 5f7dc93 commit b1d0c4d
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 132 deletions.
28 changes: 12 additions & 16 deletions session3.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -185,28 +185,20 @@ pheatmap(assay(vsd)[top_genes,],

Given the nature of how the genes were selected for the heatmap, we shouldn't be surprised by the good separation that it demonstrates.

Instead, an un-biased approach can be used where we choose genes based on their variability across the whole dataset. The variability of a gene can be calculated using the convenient `rowSds` function applied to the variance-stabilised counts in the `vsd` object. However, some genes have very low expression and were not tested by `DESeq2`. We can exclude these from the visualisation

```{r}
res_with_var <- mutate(results_tgf, GeneVar = rowSds(assay(vsd))) %>%
filter(!is.na(padj))
```


# Exercise

<div class="exercise">

- Produce a heatmap of the top 100 most-variable genes (as measure by their standard deviation across the dataset)
+ First, re-arrange the table `res_with_var` from above by decreasing `GeneVar`
+ Identify the `ENSEMBL` IDs for the first 100 rows. The `slice` function from `dplyr` might be useful here
+ Use these 100 IDs in the heatmap instead of the most significant genes that we used previously
+ you will need to use code something like this, where `genes_to_plot` is the ENSEMBL IDs that you identify
- Produce a heatmap using the top 30 genes with the most extreme *log2 Fold-Change*
+ HINT: The `abs` function can be used to convert all negative values to positive.
- Label the heatmap with the gene `SYMBOL` of the genes
- Is this heatmap as effective as separating the samples into groups?

```{r eval=FALSE}
pheatmap(assay(vsd)[genes_to_plot,],
annotation_col = sampleInfo,
scale="row")
```

</div>
Expand Down Expand Up @@ -371,6 +363,10 @@ gseaplot(gse_GO,geneSetID = "GO:0002283")
```

Other visualisation methods using the clusterProfiler output can be found here:-

https://yulab-smu.top/biomedical-knowledge-mining-book/enrichplot.html


# Interactive Visualisation

Expand Down
Loading

0 comments on commit b1d0c4d

Please sign in to comment.