Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Jun 17, 2024
1 parent e51db97 commit 521ff09
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
42b88e33
cdf2f835
12 changes: 6 additions & 6 deletions 3_normalization_scaling.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<nav id="TOC" role="doc-toc" class="toc-active"><h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#normalization" id="toc-normalization" class="nav-link active" data-scroll-target="#normalization">Normalization</a></li>
<li><a href="#normalization-and-scaling-with-sctransform" id="toc-normalization-and-scaling-with-sctransform" class="nav-link active" data-scroll-target="#normalization-and-scaling-with-sctransform">Normalization and scaling with SCTransform</a></li>
</ul></nav>
</div>
<!-- main -->
Expand Down Expand Up @@ -214,7 +214,7 @@ <h1 class="title">Normalization and scaling</h1>
<div class="cell">
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va">seu</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/readRDS.html">readRDS</a></span><span class="op">(</span><span class="st">"output/seu_part2.rds"</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<section id="normalization" class="level2"><h2 class="anchored" data-anchor-id="normalization">Normalization</h2>
<section id="normalization-and-scaling-with-sctransform" class="level2"><h2 class="anchored" data-anchor-id="normalization-and-scaling-with-sctransform">Normalization and scaling with SCTransform</h2>
<p>Biological heterogeneity in spatial RNA-seq data is often confounded by technical factors including sequencing depth. The number of molecules detected in each spot can vary significantly between spots, even within the same celltype. Note that the variance in molecular counts/spot can be substantial for spatial datasets, particularly if there are differences in cell density across the tissue.</p>
<p>Therefore, we apply sctransform normalization (Hafemeister and Satija, Genome Biology 2019), which builds regularized negative binomial models of gene expression in order to account for technical artifacts while preserving biological variance. During the normalization, we also remove confounding sources of variation (here we take mitochondrial mapping percentage).</p>
<p>We need to apply <code>SCTransform</code> on each individual slice. Therefore, we split the object back into a list (with <code>SplitObject</code>). Next, we run into a small issue that both slice images are maintained in the split object, so we have keep only the image corresponding to the count table. Then, we apply <code>SCTransform</code> on the individual slices and merge the objects back together with <code>merge</code>:</p>
Expand Down Expand Up @@ -277,9 +277,9 @@ <h1 class="title">Normalization and scaling</h1>
<p>Now that we have done the transformation it is also possible to plot gene experssion information in a spatial context, e.g.&nbsp;<code>Calb2</code>:</p>
<div class="cell">
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu"><a href="https://satijalab.org/seurat/reference/SpatialPlot.html">SpatialPlot</a></span><span class="op">(</span><span class="va">seu_list</span><span class="op">$</span><span class="va">Anterior</span>,</span>
<span> features <span class="op">=</span> <span class="st">"Calb2"</span><span class="op">)</span> <span class="op">+</span> </span>
<span> features <span class="op">=</span> <span class="st">"Myl4"</span><span class="op">)</span> <span class="op">+</span> </span>
<span> <span class="fu"><a href="https://satijalab.org/seurat/reference/SpatialPlot.html">SpatialPlot</a></span><span class="op">(</span><span class="va">seu_list</span><span class="op">$</span><span class="va">Posterior</span>, </span>
<span> features <span class="op">=</span> <span class="st">"Calb2"</span><span class="op">)</span> <span class="op">+</span> </span>
<span> features <span class="op">=</span> <span class="st">"Myl4"</span><span class="op">)</span> <span class="op">+</span> </span>
<span> <span class="fu"><a href="https://patchwork.data-imaginist.com/reference/plot_layout.html">plot_layout</a></span><span class="op">(</span>guides <span class="op">=</span> <span class="st">"collect"</span><span class="op">)</span> <span class="op">&amp;</span> </span>
<span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op">(</span>legend.position <span class="op">=</span> <span class="st">"right"</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
Expand All @@ -299,7 +299,7 @@ <h1 class="title">Normalization and scaling</h1>
</div>
</div>
<div class="callout-body-container callout-body">
<p>Create the same plot, but now for the gene <code>Dusp5</code>. In which two parts of the brain is it primarily expressed?</p>
<p>Create the same plot, but now for the gene <code>Calb2</code>. In which two parts of the brain is it primarily expressed?</p>
<p>Hint: check out <a href="http://atlas.brain-map.org/atlas?atlas=2&amp;plate=100883804#atlas=2&amp;plate=100884129&amp;resolution=19.04&amp;x=7671.818403764205&amp;y=4000&amp;zoom=-4&amp;structure=549">Allen Brain Atlas</a> for the names of the different parts of the brain.</p>
</div>
</div>
Expand All @@ -316,7 +316,7 @@ <h1 class="title">Normalization and scaling</h1>
<div id="callout-4" class="callout-4-contents callout-collapse collapse">
<div class="callout-body-container callout-body">
<div class="cell">
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va">gene</span> <span class="op">&lt;-</span> <span class="st">"Dusp5"</span></span>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va">gene</span> <span class="op">&lt;-</span> <span class="st">"Calb2"</span></span>
<span><span class="fu"><a href="https://satijalab.org/seurat/reference/SpatialPlot.html">SpatialPlot</a></span><span class="op">(</span><span class="va">seu_list</span><span class="op">$</span><span class="va">Anterior</span>,</span>
<span> features <span class="op">=</span> <span class="va">gene</span><span class="op">)</span> <span class="op">+</span> </span>
<span> <span class="fu"><a href="https://satijalab.org/seurat/reference/SpatialPlot.html">SpatialPlot</a></span><span class="op">(</span><span class="va">seu_list</span><span class="op">$</span><span class="va">Posterior</span>, </span>
Expand Down
Binary file modified 3_normalization_scaling_files/figure-html/unnamed-chunk-5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 3_normalization_scaling_files/figure-html/unnamed-chunk-6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions search.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@
"text": "Loading the required packages:\nlibrary(Seurat)\nlibrary(ggplot2)\nlibrary(clustree)\nlibrary(patchwork)\nlibrary(dplyr)\nWe load the object that was output of the quality control part:\nseu &lt;- readRDS(\"output/seu_part2.rds\")"
},
{
"objectID": "3_normalization_scaling.html#normalization",
"href": "3_normalization_scaling.html#normalization",
"objectID": "3_normalization_scaling.html#normalization-and-scaling-with-sctransform",
"href": "3_normalization_scaling.html#normalization-and-scaling-with-sctransform",
"title": "Normalization and scaling",
"section": "Normalization",
"text": "Normalization\nBiological heterogeneity in spatial RNA-seq data is often confounded by technical factors including sequencing depth. The number of molecules detected in each spot can vary significantly between spots, even within the same celltype. Note that the variance in molecular counts/spot can be substantial for spatial datasets, particularly if there are differences in cell density across the tissue.\nTherefore, we apply sctransform normalization (Hafemeister and Satija, Genome Biology 2019), which builds regularized negative binomial models of gene expression in order to account for technical artifacts while preserving biological variance. During the normalization, we also remove confounding sources of variation (here we take mitochondrial mapping percentage).\nWe need to apply SCTransform on each individual slice. Therefore, we split the object back into a list (with SplitObject). Next, we run into a small issue that both slice images are maintained in the split object, so we have keep only the image corresponding to the count table. Then, we apply SCTransform on the individual slices and merge the objects back together with merge:\n\nseu_list &lt;- SplitObject(seu, split.by = \"orig.ident\")\n\n# preparing both objects for SCTransform\nfor(slice in names(seu_list)) {\n \n # images aren't split with SplitObject. Resetting the images. \n seu_list[[slice]]@images &lt;- setNames(\n list(seu_list[[slice]]@images[[slice]]),\n slice)\n \n # bugfix based on https://github.com/satijalab/seurat/issues/8216\n seu_list[[slice]][[\"RNA\"]] &lt;- seu_list[[slice]][[\"Spatial\"]]\n DefaultAssay(seu_list[[slice]]) &lt;- \"RNA\"\n \n}\n\nseu_list &lt;- lapply(X = seu_list, FUN = SCTransform, assay = \"RNA\",\n vars.to.regress = \"percent_mt\")\n\n\n\n\n\n\n\nExercise\n\n\n\nAfter running the code, to do the SCT transformation, which assays have been added to the seurat object? Note that you can get assay data with the function Assays.\n\n\n\n\n\n\n\n\nAnswer\n\n\n\n\n\nJust by typing the object name (seu) we see which layers are in there:\n\nAssays(seu_list[[1]])\n\n[1] \"Spatial\" \"RNA\" \"SCT\" \n\n\nShowing us that an assay called SCT has appeared.\n\n\n\nNow that we have done the transformation it is also possible to plot gene experssion information in a spatial context, e.g. Calb2:\n\nSpatialPlot(seu_list$Anterior,\n features = \"Calb2\") + \n SpatialPlot(seu_list$Posterior, \n features = \"Calb2\") + \n plot_layout(guides = \"collect\") & \n theme(legend.position = \"right\")\n\n\n\n\n\n\n\n\n\n\n\n\n\nExercise\n\n\n\nCreate the same plot, but now for the gene Dusp5. In which two parts of the brain is it primarily expressed?\nHint: check out Allen Brain Atlas for the names of the different parts of the brain.\n\n\n\n\n\n\n\n\nAnswer\n\n\n\n\n\n\ngene &lt;- \"Dusp5\"\nSpatialPlot(seu_list$Anterior,\n features = gene) + \n SpatialPlot(seu_list$Posterior, \n features = gene) + \n plot_layout(guides = \"collect\") & \n theme(legend.position = \"right\")\n\n\n\n\n\n\n\nIt’s mainly expressed in the olfactory bulb (left of the anterior slice) and cerebellum (right of the posterior slice).\n\n\n\nAfter quality control and transformation, we can save the output as an rds files:\n\nsaveRDS(seu_list,\n paste0(\"output/seu_part3.rds\"))"
"section": "Normalization and scaling with SCTransform",
"text": "Normalization and scaling with SCTransform\nBiological heterogeneity in spatial RNA-seq data is often confounded by technical factors including sequencing depth. The number of molecules detected in each spot can vary significantly between spots, even within the same celltype. Note that the variance in molecular counts/spot can be substantial for spatial datasets, particularly if there are differences in cell density across the tissue.\nTherefore, we apply sctransform normalization (Hafemeister and Satija, Genome Biology 2019), which builds regularized negative binomial models of gene expression in order to account for technical artifacts while preserving biological variance. During the normalization, we also remove confounding sources of variation (here we take mitochondrial mapping percentage).\nWe need to apply SCTransform on each individual slice. Therefore, we split the object back into a list (with SplitObject). Next, we run into a small issue that both slice images are maintained in the split object, so we have keep only the image corresponding to the count table. Then, we apply SCTransform on the individual slices and merge the objects back together with merge:\n\nseu_list &lt;- SplitObject(seu, split.by = \"orig.ident\")\n\n# preparing both objects for SCTransform\nfor(slice in names(seu_list)) {\n \n # images aren't split with SplitObject. Resetting the images. \n seu_list[[slice]]@images &lt;- setNames(\n list(seu_list[[slice]]@images[[slice]]),\n slice)\n \n # bugfix based on https://github.com/satijalab/seurat/issues/8216\n seu_list[[slice]][[\"RNA\"]] &lt;- seu_list[[slice]][[\"Spatial\"]]\n DefaultAssay(seu_list[[slice]]) &lt;- \"RNA\"\n \n}\n\nseu_list &lt;- lapply(X = seu_list, FUN = SCTransform, assay = \"RNA\",\n vars.to.regress = \"percent_mt\")\n\n\n\n\n\n\n\nExercise\n\n\n\nAfter running the code, to do the SCT transformation, which assays have been added to the seurat object? Note that you can get assay data with the function Assays.\n\n\n\n\n\n\n\n\nAnswer\n\n\n\n\n\nJust by typing the object name (seu) we see which layers are in there:\n\nAssays(seu_list[[1]])\n\n[1] \"Spatial\" \"RNA\" \"SCT\" \n\n\nShowing us that an assay called SCT has appeared.\n\n\n\nNow that we have done the transformation it is also possible to plot gene experssion information in a spatial context, e.g. Calb2:\n\nSpatialPlot(seu_list$Anterior,\n features = \"Myl4\") + \n SpatialPlot(seu_list$Posterior, \n features = \"Myl4\") + \n plot_layout(guides = \"collect\") & \n theme(legend.position = \"right\")\n\n\n\n\n\n\n\n\n\n\n\n\n\nExercise\n\n\n\nCreate the same plot, but now for the gene Calb2. In which two parts of the brain is it primarily expressed?\nHint: check out Allen Brain Atlas for the names of the different parts of the brain.\n\n\n\n\n\n\n\n\nAnswer\n\n\n\n\n\n\ngene &lt;- \"Calb2\"\nSpatialPlot(seu_list$Anterior,\n features = gene) + \n SpatialPlot(seu_list$Posterior, \n features = gene) + \n plot_layout(guides = \"collect\") & \n theme(legend.position = \"right\")\n\n\n\n\n\n\n\nIt’s mainly expressed in the olfactory bulb (left of the anterior slice) and cerebellum (right of the posterior slice).\n\n\n\nAfter quality control and transformation, we can save the output as an rds files:\n\nsaveRDS(seu_list,\n paste0(\"output/seu_part3.rds\"))"
},
{
"objectID": "5_marker_gene_identification.html",
Expand Down
16 changes: 8 additions & 8 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://sib-swiss.github.io/spatial-transcriptomics-training/precourse_preparations.html</loc>
<lastmod>2024-06-16T01:10:54.484Z</lastmod>
<lastmod>2024-06-17T07:24:51.758Z</lastmod>
</url>
<url>
<loc>https://sib-swiss.github.io/spatial-transcriptomics-training/course_schedule.html</loc>
<lastmod>2024-06-16T01:10:54.484Z</lastmod>
<lastmod>2024-06-17T07:24:51.758Z</lastmod>
</url>
<url>
<loc>https://sib-swiss.github.io/spatial-transcriptomics-training/4_integration_clustering.html</loc>
<lastmod>2024-06-16T01:10:54.464Z</lastmod>
<lastmod>2024-06-17T07:24:51.738Z</lastmod>
</url>
<url>
<loc>https://sib-swiss.github.io/spatial-transcriptomics-training/2_quality_control.html</loc>
<lastmod>2024-06-16T01:10:54.464Z</lastmod>
<lastmod>2024-06-17T07:24:51.738Z</lastmod>
</url>
<url>
<loc>https://sib-swiss.github.io/spatial-transcriptomics-training/1_setup.html</loc>
<lastmod>2024-06-16T01:10:54.464Z</lastmod>
<lastmod>2024-06-17T07:24:51.738Z</lastmod>
</url>
<url>
<loc>https://sib-swiss.github.io/spatial-transcriptomics-training/3_normalization_scaling.html</loc>
<lastmod>2024-06-16T01:10:54.464Z</lastmod>
<lastmod>2024-06-17T07:24:51.738Z</lastmod>
</url>
<url>
<loc>https://sib-swiss.github.io/spatial-transcriptomics-training/5_marker_gene_identification.html</loc>
<lastmod>2024-06-16T01:10:54.464Z</lastmod>
<lastmod>2024-06-17T07:24:51.738Z</lastmod>
</url>
<url>
<loc>https://sib-swiss.github.io/spatial-transcriptomics-training/index.html</loc>
<lastmod>2024-06-16T01:10:54.484Z</lastmod>
<lastmod>2024-06-17T07:24:51.758Z</lastmod>
</url>
</urlset>

0 comments on commit 521ff09

Please sign in to comment.