Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA: Automated live (rendered) versions of the notebooks #527

Merged
merged 1 commit into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2,933 changes: 2,861 additions & 72 deletions RNA-seq/01-qc_trim_quant.nb.html

Large diffs are not rendered by default.

2,773 changes: 2,727 additions & 46 deletions RNA-seq/02-gastric_cancer_tximeta.nb.html

Large diffs are not rendered by default.

2,733 changes: 2,701 additions & 32 deletions RNA-seq/03-gastric_cancer_exploratory.nb.html

Large diffs are not rendered by default.

2,686 changes: 2,663 additions & 23 deletions RNA-seq/04-nb_cell_line_tximeta.nb.html

Large diffs are not rendered by default.

2,772 changes: 2,726 additions & 46 deletions RNA-seq/05-nb_cell_line_DESeq2.nb.html

Large diffs are not rendered by default.

2,820 changes: 2,769 additions & 51 deletions RNA-seq/06-openpbta_heatmap.nb.html

Large diffs are not rendered by default.

2,994 changes: 2,899 additions & 95 deletions intro-to-R-tidyverse/01-intro_to_base_R.nb.html

Large diffs are not rendered by default.

65 changes: 55 additions & 10 deletions intro-to-R-tidyverse/02-intro_to_ggplot2-live.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,41 @@ For now, we will choose the value of 5.5 (that is close to a Bonferroni correcti

```

We can change the x and y labels by using `ylab` and `xlab` functions and add a
title using `ggtitle`.
We can change the x and y labels using a few different strategies.
One approach is to use functions `xlab()` and `ylab()` individually to set, respectively, the x-axis label and the the y-axis label.

```{r ggplot-label}

```{r ggplot-label-1}
ggplot(
tumor_normal_df,
aes(
x = log_fold_change,
y = neg_log10_p,
color = avg_expression
)
) +
geom_point(alpha = 0.2) +
geom_hline(yintercept = 5.5, color = "darkgreen") +
theme_bw() +
# Add labels with separate functions:
xlab("log2 Fold Change Tumor/Normal") +
ylab("-log10 p value")
```


Alternatively, we can use the `ggplot2` function `labs()`, which takes individual arguments for each label we want want to set.
We can also include the argument `title` to add an overall plot title.

```{r ggplot-label-2, live = TRUE}

# Add x and y labels and overall plot title with arguments to labs():

```

Something great about the `labs()` function is you can also use it to specify labels for your *legends* derived from certain aesthetics.
In this plot, our legend is derived from a *color aesthetic*, so we can specify the keyword "color" to update the legend title.

```{r ggplot-label-aes}
ggplot(
tumor_normal_df,
aes(
Expand All @@ -243,18 +274,26 @@ ggplot(
geom_point(alpha = 0.2) +
geom_hline(yintercept = 5.5, color = "darkgreen") +
theme_bw() +
xlab("log2 Fold Change Tumor/Normal") + # Add an x label
ylab("-log10 p value") + # Add a y label
ggtitle("Astrocytoma Tumor vs Normal Cerebellum") # Add main title
# Add x and y labels and overall plot title with arguments to labs():
labs(
x = "log2 Fold Change Tumor/Normal",
y = "-log10 p value",
title = "Astrocytoma Tumor vs Normal Cerebellum",
# Use the color keyword to label the color legend
color = "Average expression"
)

```


Use this chunk to make the same kind of plot as the previous chunk but instead plot the male female contrast data, that is stored in `male_female_df`.

```{r mf-volcano, live = TRUE}
# Use this chunk to make the same kind of volcano plot, but with the male-female contrast data.

```


Turns out, we don't have to plot each contrast separately, instead, we can use the original data frame that contains all three contrasts' data, `stats_df`, and add a `facet_wrap` to make each contrast its own plot.

```{r ggplot-facets}
Expand All @@ -270,9 +309,12 @@ ggplot(
geom_hline(yintercept = 5.5, color = "darkgreen") +
theme_bw() +
facet_wrap(~contrast) +
xlab("log2 Fold Change") + # Now that this includes the other contrasts,
labs(
x = "log2 Fold Change", # Now that this includes the other contrasts,
# we'll make this label more general
ylab("-log10 p value") +
y = "-log10 p value",
color = "Average expression"
) +
coord_cartesian(xlim = c(-25, 25)) # zoom in on the x-axis
```

Expand All @@ -292,8 +334,11 @@ volcano_plot <- ggplot(
geom_hline(yintercept = 5.5, color = "darkgreen") +
theme_bw() +
facet_wrap(~contrast) +
xlab("log2 Fold Change") +
ylab("-log10 p value") +
labs(
x = "log2 Fold Change",
y = "-log10 p value",
color = "Average expression"
) +
coord_cartesian(xlim = c(-25, 25))
```

Expand Down
2,882 changes: 2,823 additions & 59 deletions intro-to-R-tidyverse/02-intro_to_ggplot2.nb.html

Large diffs are not rendered by default.

2,969 changes: 2,890 additions & 79 deletions intro-to-R-tidyverse/03-intro_to_tidyverse.nb.html

Large diffs are not rendered by default.

2,900 changes: 2,835 additions & 65 deletions scRNA-seq/01-scRNA_quant_qc.nb.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions scRNA-seq/02-filtering_scRNA-live.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ The remainder of the `ggplot` code should look familiar.
# Plot the density of the means using ggplot2
ggplot(mapping = aes(x = gene_means)) +
geom_density() +
xlab("Mean gene count")
labs(x = "Mean gene count")
```

That plot is not quite as informative as we might like, as a few genes with high expression are making the scale just a *bit* wide.
Expand Down Expand Up @@ -269,7 +269,7 @@ Let's plot this using the same style and type of graph as above.
```{r genes_expressed_plot}
ggplot(mapping = aes(x = num_genes_exp)) +
geom_density(fill = "lightblue") +
xlab("Number of genes expressed") +
labs(x = "Number of genes expressed") +
theme_classic()
```

Expand Down Expand Up @@ -445,7 +445,7 @@ gene_info <- data.frame(rowData(bladder_sce_filtered))
# Plot the detected percentage
ggplot(gene_info, aes(x = detected) )+
geom_density(fill = "lightblue") +
xlab("Percent of Cells Expressing Each Gene") +
labs(x = "Percent of Cells Expressing Each Gene") +
theme_classic()
```

Expand Down
2,948 changes: 2,864 additions & 84 deletions scRNA-seq/02-filtering_scRNA.nb.html

Large diffs are not rendered by default.

2,766 changes: 2,727 additions & 39 deletions scRNA-seq/03-normalizing_scRNA.nb.html

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions scRNA-seq/04-dimension_reduction_scRNA-live.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ We can add a function like that curve to a `ggplot` with a `stat_function` layer
ggplot(as.data.frame(gene_variance), aes(x = mean, y = total)) +
geom_point(alpha = 0.1) +
stat_function(fun = metadata(gene_variance)$trend, color = "blue") +
xlab("Mean log-expression") +
ylab("Variance") +
labs(
x = "Mean log-expression",
y = "Variance") +
theme_bw()
```

Expand Down
3,039 changes: 2,951 additions & 88 deletions scRNA-seq/04-dimension_reduction_scRNA.nb.html

Large diffs are not rendered by default.

2,965 changes: 2,896 additions & 69 deletions scRNA-seq/05-clustering_markers_scRNA.nb.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scRNA-seq/06-overrepresentation_analysis-live.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ Let's look at a bar plot of the significant results.
```{r cm_barplot}
barplot(cellmarker_ora_results) +
# This is a ggplot, so we can use the following to label the x-axis!
ggplot2::xlab("count")
ggplot2::labs(x = "count")
```

One thing that the [web version of CellMarker](http://bio-bigdata.hrbmu.edu.cn/CellMarker/) allows us to do is to get a better idea of _marker prevalence_.
Expand Down
2,939 changes: 2,860 additions & 79 deletions scRNA-seq/06-overrepresentation_analysis.nb.html

Large diffs are not rendered by default.

2,897 changes: 2,832 additions & 65 deletions scRNA-seq/07-gene_set_enrichment_analysis.nb.html

Large diffs are not rendered by default.