usethis::create_project("bananas")
usethis::create_project("bananas")
From a9bc6778ceee0a4fa5f7cbf248614cc7b14309ba Mon Sep 17 00:00:00 2001 From: 3mmaRand <7593411+3mmaRand@users.noreply.github.com> Date: Fri, 29 Mar 2024 15:22:37 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=203mmaRand?= =?UTF-8?q?/BIO00088H-data@c53c87a997b0a60a24fde70782fcb76856384be2=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.html | 2 +- core/week-1/overview.html | 2 +- core/week-1/study_after_workshop.html | 2 +- core/week-1/study_before_workshop.html | 2 +- core/week-1/workshop.html | 2 +- core/week-11/overview.html | 2 +- core/week-11/study_after_workshop.html | 2 +- core/week-11/study_before_workshop.html | 2 +- core/week-11/workshop.html | 4 +- core/week-2/overview.html | 2 +- core/week-2/study_after_workshop.html | 2 +- core/week-2/study_before_workshop.html | 8 +-- core/week-2/workshop.html | 66 +++++++++--------- core/week-6/overview.html | 2 +- core/week-6/study_after_workshop.html | 2 +- core/week-6/study_before_workshop.html | 2 +- core/week-6/workshop.html | 2 +- images/images.html | 4 +- index.html | 2 +- omics/kelly/workshop.html | 45 ++++++------ omics/omics.html | 2 +- omics/semester-2/workshop.html | 2 +- omics/week-3/overview.html | 2 +- omics/week-3/study_after_workshop.html | 2 +- omics/week-3/study_before_workshop.html | 2 +- omics/week-3/workshop.html | 2 +- omics/week-4/overview.html | 2 +- omics/week-4/study_after_workshop.html | 2 +- omics/week-4/study_before_workshop.html | 2 +- omics/week-4/workshop.html | 2 +- omics/week-5/figures/prog-hspc-volcano.png | Bin 92418 -> 92659 bytes omics/week-5/overview.html | 2 +- omics/week-5/study_after_workshop.html | 2 +- omics/week-5/study_before_workshop.html | 2 +- omics/week-5/workshop.html | 10 +-- .../figure-html/unnamed-chunk-33-1.png | Bin 134115 -> 132708 bytes .../figure-html/unnamed-chunk-65-1.png | Bin 67741 -> 67924 bytes search.json | 6 +- structures/structures.html | 4 +- 39 files changed, 104 insertions(+), 99 deletions(-) diff --git a/core/core.html b/core/core.html index a09a894..a66936a 100644 --- a/core/core.html +++ b/core/core.html @@ -350,7 +350,7 @@
28 March, 2024
+29 March, 2024
🎬 The example RStudio project containing this code here: chaffinch. You can download the project as a zip file from there but there is some code that will do that automatically for you. Since this is an RStudio Project, do not run the code from inside a project. You may want to navigate to a particular directory or edit the destdir
:
usethis::use_course(url = "3mmaRand/chaffinch", destdir = ".")
usethis::use_course(url = "3mmaRand/chaffinch", destdir = ".")
You can agree to deleting the zip. You should find RStudio restarts and you have a new project called chaffinch-xxxxxx. The xxxxxx is a commit reference - you do not need to worry about that, it is just a way to tell you which version of the repo you downloaded. You can now run the code in the project.
🎬 Make an outline of your compendium. This could be a sketch on paper or slide or from the mindmap software you usually use. Or it could be a skeleton of folders and files on your computer.
🎬 Make a start on a quarto doc.
diff --git a/core/week-2/overview.html b/core/week-2/overview.html index 708a51e..6aa0309 100644 --- a/core/week-2/overview.html +++ b/core/week-2/overview.html @@ -337,7 +337,7 @@28 March, 2024
+29 March, 2024
by mM and by weight
🎬 Add a column which is the percent representation of each VFA for mM and g/l:
vfa_cummul <- vfa_cummul |>
+vfa_cummul <- vfa_cummul |>
group_by(sample_replicate, time_day) |>
mutate(percent_conc_g_l = conc_g_l / sum(conc_g_l) * 100,
percent_conc_mM = conc_mM / sum(conc_mM) * 100)
@@ -517,7 +522,7 @@ Workflow for VFA analysis
Graphs for info so far
🎬 Make summary data for graphing
-vfa_cummul_summary <- vfa_cummul |>
+
-vfa_delta_summary <- vfa_delta |>
+vfa_delta_summary <- vfa_delta |>
group_by(treatment, time_day, vfa) |>
summarise(mean_g_l = mean(conc_g_l),
se_g_l = sd(conc_g_l)/sqrt(length(conc_g_l)),
@@ -536,7 +541,7 @@ Workflow for VFA analysis
🎬 Graph the cumulative data, grams per litre:
-vfa_cummul_summary |>
+vfa_cummul_summary |>
ggplot(aes(x = time_day, colour = vfa)) +
geom_line(aes(y = mean_g_l),
linewidth = 1) +
@@ -560,7 +565,7 @@ Workflow for VFA analysis
🎬 Graph the change data, grams per litre:
-vfa_delta_summary |>
+vfa_delta_summary |>
ggplot(aes(x = time_day, colour = vfa)) +
geom_line(aes(y = mean_g_l),
linewidth = 1) +
@@ -584,7 +589,7 @@ Workflow for VFA analysis
🎬 Graph the mean percent representation of each VFA g/l. Note geom_col()
will plot proportion if we setposition = "fill"
-vfa_cummul_summary |>
+vfa_cummul_summary |>
ggplot(aes(x = time_day, y = mean_g_l, fill = vfa)) +
geom_col(position = "fill") +
scale_fill_viridis_d(name = NULL) +
@@ -605,7 +610,7 @@ Workflow for VFA analysis
However, PCA expects a matrix with samples in rows and VFA, the variables, in columns. We will need to select the columns we need and pivot wider. Then convert to a matrix.
🎬
-vfa_cummul_pca <- vfa_cummul |>
+vfa_cummul_pca <- vfa_cummul |>
select(sample_replicate,
treatment,
replicate,
@@ -616,7 +621,7 @@ Workflow for VFA analysis
values_from = conc_g_l)
-mat <- vfa_cummul_pca |>
+mat <- vfa_cummul_pca |>
ungroup() |>
select(-sample_replicate,
-treatment,
@@ -626,13 +631,13 @@ Workflow for VFA analysis
🎬 Perform PCA on the matrix:
-pca <- mat |>
+pca <- mat |>
prcomp(scale. = TRUE,
rank. = 4)
The scale.
argument tells prcomp()
to scale the data to have a mean of 0 and a standard deviation of 1. The rank.
argument tells prcomp()
to only calculate the first 4 principal components. This is useful for visualisation as we can only plot in 2 or 3 dimensions. We can see the results of the PCA by viewing the summary()
of the pca
object.
-summary(pca)
+summary(pca)
Importance of first k=4 (out of 8) components:
PC1 PC2 PC3 PC4
@@ -644,7 +649,7 @@ Workflow for VFA analysis
The Proportion of Variance tells us how much of the variance is explained by each component. We can see that the first component explains 0.7798 of the variance, the second 0.1018, and the third 0.07597. Together the first three components explain nearly 96% of the total variance in the data. Plotting PC1 against PC2 will capture about 78% of the variance which is likely much better than we would get plotting any two VFA against each other. To plot the PC1 against PC2 we will need to extract the PC1 and PC2 score from the pca object and add labels for the samples.
🎬 Create a dataframe of the PC1 and PC2 scores which are in pca$x
and add the sample information from vfa_cummul_pca:
-pca_labelled <- data.frame(pca$x,
+pca_labelled <- data.frame(pca$x,
sample_replicate = vfa_cummul_pca$sample_replicate,
treatment = vfa_cummul_pca$treatment,
replicate = vfa_cummul_pca$replicate,
@@ -1281,7 +1286,7 @@ Workflow for VFA analysis
🎬 Plot PC1 against PC2 and colour by time and shape by treatment:
-pca_labelled |>
+pca_labelled |>
ggplot(aes(x = PC1, y = PC2,
colour = factor(time_day),
shape = treatment)) +
@@ -1300,7 +1305,7 @@ Workflow for VFA analysis
🎬 Plot PC1 against PC2 and colour by time and facet treatment:
-pca_labelled |>
+pca_labelled |>
ggplot(aes(x = PC1, y = PC2, colour = factor(time_day))) +
geom_point(size = 3) +
scale_colour_viridis_d(end = 0.95, begin = 0.15,
@@ -1319,23 +1324,23 @@ Workflow for VFA analysis
We are going to create an interactive heatmap with the heatmaply
(Galili et al. 2017) package. heatmaply
takes a matrix as input so we can use mat
🎬 Set the rownames to the sample id whihcih is combination of sample_replicate
and time_day
:
-rownames(mat) <- interaction(vfa_cummul_pca$sample_replicate,
+rownames(mat) <- interaction(vfa_cummul_pca$sample_replicate,
vfa_cummul_pca$time_day)
You might want to view the matrix by clicking on it in the environment pane.
🎬 Load the heatmaply
package:
We need to tell the clustering algorithm how many clusters to create. We will set the number of clusters for the treatments to be 2 and the number of clusters for the vfa to be the same since it makes sense to see what clusters of genes correlate with the treatments.
🎬 Set the number of clusters for the treatments and vfa:
-n_treatment_clusters <- 2
+n_treatment_clusters <- 2
n_vfa_clusters <- 2
🎬 Create the heatmap:
-heatmaply(mat,
+heatmaply(mat,
scale = "column",
k_col = n_vfa_clusters,
k_row = n_treatment_clusters,
@@ -1344,8 +1349,8 @@ Workflow for VFA analysis
labRow = rownames(mat),
heatmap_layers = theme(axis.line = element_blank()))
-
-
+
+
The heatmap will open in the viewer pane (rather than the plot pane) because it is html. You can “Show in a new window” to see it in a larger format. You can also zoom in and out and pan around the heatmap and download it as a png. You might feel the colour bars is not adding much to the plot. You can remove it by setting hide_colorbar = TRUE,
in the heatmaply()
function.
diff --git a/omics/omics.html b/omics/omics.html
index 5547cdc..7adcce7 100644
--- a/omics/omics.html
+++ b/omics/omics.html
@@ -351,7 +351,7 @@ Omics Data Analysis for Group Project
diff --git a/omics/semester-2/workshop.html b/omics/semester-2/workshop.html
index 667050d..1f471da 100644
--- a/omics/semester-2/workshop.html
+++ b/omics/semester-2/workshop.html
@@ -226,7 +226,7 @@
Workshop
diff --git a/omics/week-3/overview.html b/omics/week-3/overview.html
index 99f2128..0404729 100644
--- a/omics/week-3/overview.html
+++ b/omics/week-3/overview.html
@@ -328,7 +328,7 @@
Overview
diff --git a/omics/week-3/study_after_workshop.html b/omics/week-3/study_after_workshop.html
index 50a7a38..0588f96 100644
--- a/omics/week-3/study_after_workshop.html
+++ b/omics/week-3/study_after_workshop.html
@@ -321,7 +321,7 @@
Independent Study to consolidate this week
diff --git a/omics/week-3/study_before_workshop.html b/omics/week-3/study_before_workshop.html
index e15cb16..9d87f53 100644
--- a/omics/week-3/study_before_workshop.html
+++ b/omics/week-3/study_before_workshop.html
@@ -388,7 +388,7 @@
Independent Study to prepare for workshop
- 28 March, 2024
+ 29 March, 2024
- 28 March, 2024
+ 29 March, 2024