Skip to content

Commit

Permalink
Updated contents at 20240314-002819
Browse files Browse the repository at this point in the history
  • Loading branch information
gh_action committed Mar 13, 2024
1 parent 40b5c9a commit b7d625b
Show file tree
Hide file tree
Showing 303 changed files with 1,068,106 additions and 19 deletions.
Binary file added 2403-canvas/data/GO_ORA_results.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion 2403-canvas/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ <h1>Analysis of RNA-Seq Data</h1>
<hr />
<div class="landing-update">
<p class="small" style="color:#bdbdbd;">
Last updated on <svg aria-hidden="true" role="img" viewBox="0 0 448 512" style="height:1em;width:0.88em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#bdbdbd;overflow:visible;position:relative;"><path d="M152 24c0-13.3-10.7-24-24-24s-24 10.7-24 24V64H64C28.7 64 0 92.7 0 128v16 48V448c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V192 144 128c0-35.3-28.7-64-64-64H344V24c0-13.3-10.7-24-24-24s-24 10.7-24 24V64H152V24zM48 192h80v56H48V192zm0 104h80v64H48V296zm128 0h96v64H176V296zm144 0h80v64H320V296zm80-48H320V192h80v56zm0 160v40c0 8.8-7.2 16-16 16H320V408h80zm-128 0v56H176V408h96zm-144 0v56H64c-8.8 0-16-7.2-16-16V408h80zM272 248H176V192h96v56z"/></svg> 13-Mar-2024 at <svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#bdbdbd;overflow:visible;position:relative;"><path d="M464 256A208 208 0 1 1 48 256a208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM232 120V256c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2V120c0-13.3-10.7-24-24-24s-24 10.7-24 24z"/></svg> 10:32:09 PM .
Last updated on <svg aria-hidden="true" role="img" viewBox="0 0 448 512" style="height:1em;width:0.88em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#bdbdbd;overflow:visible;position:relative;"><path d="M152 24c0-13.3-10.7-24-24-24s-24 10.7-24 24V64H64C28.7 64 0 92.7 0 128v16 48V448c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V192 144 128c0-35.3-28.7-64-64-64H344V24c0-13.3-10.7-24-24-24s-24 10.7-24 24V64H152V24zM48 192h80v56H48V192zm0 104h80v64H48V296zm128 0h96v64H176V296zm144 0h80v64H320V296zm80-48H320V192h80v56zm0 160v40c0 8.8-7.2 16-16 16H320V408h80zm-128 0v56H176V408h96zm-144 0v56H64c-8.8 0-16-7.2-16-16V408h80zM272 248H176V192h96v56z"/></svg> 13-Mar-2024 at <svg aria-hidden="true" role="img" viewBox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#bdbdbd;overflow:visible;position:relative;"><path d="M464 256A208 208 0 1 1 48 256a208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM232 120V256c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2V120c0-13.3-10.7-24-24-24s-24 10.7-24 24z"/></svg> 11:25:45 PM .
</p>
</div>
</div>
Expand Down
Binary file modified 2403-canvas/lab_dge_files/figure-html/unnamed-chunk-27-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 2403-canvas/lab_dge_files/figure-html/unnamed-chunk-27-2.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 2403-canvas/lab_eda_files/figure-html/unnamed-chunk-18-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 2403-canvas/lab_functional.html
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ <h2><span class="header-section-number">2.2</span> GSEA</h2>
# Load hallmark pathways
hallmark_pathways &lt;- gmtPathways(&quot;data/MSigDB_files/h.all.v6.2.symbols.gmt.txt&quot;)</code></pre>
</div>
<p>Once our list of genes are sorted (from highest to lowest expression in day 7), we can proceed with the enrichment itself. Here, we will be using the <code>fgsea()</code> function. This will result in a table containing information for several pathways. We can then sort and filter those pathways to visualize only the top ones. You can select/filter them by either <code>p-value</code> or normalized enrichemnet score (<code>NES</code>).</p>
<p>Once our list of genes are sorted (from highest to lowest expression in day 7), we can proceed with the enrichment itself. Here, we will be using the <code>fgsea()</code> function. This will result in a table containing information for several pathways. We can then sort and filter those pathways to visualize only the top ones. You can select/filter them by either <code>p-value</code> or normalized enrichment score (<code>NES</code>).</p>
<div class="chunk-title-parent">
<div class="chunk-title small">
R
Expand All @@ -509,7 +509,7 @@ <h2><span class="header-section-number">2.2</span> GSEA</h2>
<ul>
<li>Which is the most significantly up-regulated pathway at day 7?</li>
<li>What do the length of the black bars mean?</li>
<li>Is there any pathway that is significantly down-regulated at 0? Which columns tells you what is Up of downregulated?</li>
<li>Is there any pathway that is significantly down-regulated at 0?</li>
<li>Which is the most enriched pathway at day 0?</li>
<li>What happens if we use <code>-res$log2FoldChange</code> as gene rank ? What changes and why?</li>
</ul>
Expand All @@ -534,12 +534,12 @@ <h2><span class="header-section-number">2.2</span> GSEA</h2>
<p><i class="fas fa-comments"></i> <strong>Exploratory Questions</strong></p>
<ul>
<li>What do the black lines in the X-axis mean?</li>
<li>By looking at the green line distribution, and the comparison made (day00 - day07), at which time point is this pathways enriched.</li>
<li>By looking at the green line distribution, and the comparison made (day00 - day07), at which time point is this pathways enriched?</li>
</ul>
<p><i class="fas fa-comments"></i> <strong>Exploratory Questions (optional)</strong></p>
<ul>
<li>What if instead of the hallmark gene set, you use the GO? Try that.</li>
<li>How different are the results from EnrichR and GSEA using GO annotation? Remember to use the same comparison (i.e. day07 vs day00).</li>
<li>How different are the results from EnrichR and GSEA using GO annotation? Remember to use the same comparison (i.e. day00 vs day07).</li>
</ul>
</div>
<div id="online-enrichment-tools" class="section level2" number="2.3">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions 2403-canvas/lab_r.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,20 +405,20 @@ <h1><span class="header-section-number">6</span> Functions</h1>

# sort
sort(x)</code></pre>
<pre><code>## [1] 131 37 47 38 9 102 193 34 69 32
<pre><code>## [1] 19 76 63 38 73 152 175 134 186 172
## [1] 10
## [1] 692
## [1] 69.2
## [1] 42.5
## [1] 9
## [1] 4.875197 3.610918 3.850148 3.637586 2.197225 4.624973 5.262690 3.526361
## [9] 4.234107 3.465736
## [1] 7.808671e+56 1.171914e+16 2.581313e+20 3.185593e+16 8.103084e+03
## [6] 1.986265e+44 6.589235e+83 5.834617e+14 9.253782e+29 7.896296e+13
## [1] 11.445523 6.082763 6.855655 6.164414 3.000000 10.099505 13.892444
## [8] 5.830952 8.306624 5.656854
## [1] 131 37 47 38 9 102 193 34 69 32
## [1] 9 32 34 37 38 47 69 102 131 193</code></pre>
## [1] 1088
## [1] 108.8
## [1] 105
## [1] 19
## [1] 2.944439 4.330733 4.143135 3.637586 4.290459 5.023881 5.164786 4.897840
## [9] 5.225747 5.147494
## [1] 1.784823e+08 1.014800e+33 2.293783e+27 3.185593e+16 5.052394e+31
## [6] 1.029820e+66 1.003539e+76 1.568414e+58 6.008605e+80 4.996327e+74
## [1] 4.358899 8.717798 7.937254 6.164414 8.544004 12.328828 13.228757
## [8] 11.575837 13.638182 13.114877
## [1] 19 76 63 38 73 152 175 134 186 172
## [1] 19 38 63 73 76 134 152 172 175 186</code></pre>
<p>Some useful string functions.</p>
<pre class="r"><code>a &lt;- &quot;sunny&quot;
b &lt;- &quot;day&quot;
Expand Down
Binary file modified 2403-canvas/lab_r_files/figure-html/unnamed-chunk-24-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 2403-canvas/lab_r_files/figure-html/unnamed-chunk-25-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 2403-canvas/lab_r_files/figure-html/unnamed-chunk-26-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 2403-canvas/lab_r_files/figure-html/unnamed-chunk-28-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 2403-canvas/lab_r_files/figure-html/unnamed-chunk-29-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 2403-canvas/lab_r_files/figure-html/unnamed-chunk-30-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 2403-canvas/lab_r_files/figure-html/unnamed-chunk-31-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 2403-canvas/slide_clustering.pdf
Binary file not shown.
Binary file modified 2403-canvas/slide_dge.pdf
Binary file not shown.
4 changes: 3 additions & 1 deletion 2403-canvas/slide_functional.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@
- Molecular Function (MF); _Phosphorylation, DNA binding_.
- Cellular Component (CC); _Nucleus, Cytoplasm_.
- Genes can belong to multiple GO *terms*
&lt;img src="data/GO_SHOX.png" width="60%" style="display: block; margin: auto;" /&gt;


&lt;img src="data/GO_ORA_results.png" width="100%" style="display: block; margin: auto;" /&gt;

---
name: pathway1
Expand Down
Binary file modified 2403-canvas/slide_functional.pdf
Binary file not shown.
Binary file modified 2403-canvas/slide_preprocessing.pdf
Binary file not shown.
Binary file added 2403/Bad_RNASeq_Examples/Bias_GC_Content.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2403/Bad_RNASeq_Examples/biased_composition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions 2403/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# DOCKER FILE FOR WORKSHOP-RNASEQ
# 2023 Roy Francis

FROM rocker/verse:4.2.3
LABEL Description="Docker image for NBIS workshop-rnaseq"
LABEL Maintainer="roy.francis@nbis.se"
LABEL org.opencontainers.image.source="https://github.com/NBISweden/workshop-rnaseq"

RUN apt-get update -y \
&& apt-get install --no-install-recommends -y \
libxml2-dev \
libssl-dev \
libcurl4-openssl-dev \
libudunits2-dev \
libopenblas-base \
libgdal-dev \
&& wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& apt-get install -y ./google-chrome-stable_current_amd64.deb \
&& rm -rf google-chrome-stable_current_amd64.deb \
&& rm -rf /var/lib/apt/lists/* \
&& Rscript -e 'install.packages(c("bookdown","knitr","remotes","fontawesome","formattable","kableExtra","leaflet","pagedown","lubridate","markdown","xaringan","yaml"),repos = "https://packagemanager.posit.co/cran/__linux__/jammy/latest");' \
&& mkdir /rmd

RUN Rscript -e 'install.packages(c("BiocManager","dplyr","enrichR","ggplot2","gridExtra","pheatmap","pvclust","rafalib","stringr","tidyr","locfit"),repos = "https://packagemanager.posit.co/cran/__linux__/jammy/latest");'
RUN Rscript -e 'BiocManager::install(c("DESeq2","edgeR","fgsea","biomaRt","GEOquery"));'
WORKDIR /rmd
CMD Rscript -e "rmarkdown::render_site()"

# build container
# docker build -t ghcr.io/nbisweden/workshop-rnaseq:1.0.0 .
# docker tag ghcr.io/nbisweden/workshop-rnaseq:1.0.0 ghcr.io/nbisweden/workshop-rnaseq:latest

# push to ghcr
# docker login ghcr.io
# docker push ghcr.io/nbisweden/workshop-rnaseq:1.0.0
# docker push ghcr.io/nbisweden/workshop-rnaseq:latest

# run container
# render all files
# docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/rmd ghcr.io/nbisweden/workshop-rnaseq:latest
# render one file
# docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/rmd ghcr.io/nbisweden/workshop-rnaseq:latest Rscript -e 'rmarkdown::render("index.Rmd")'
Binary file added 2403/assets/cover.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 added 2403/assets/end.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 added 2403/assets/favicon.ico
Binary file not shown.
Binary file added 2403/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions 2403/assets/footer-lab.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: "&nbsp;"
---

<footer class="footer">
<div class="container footer-container">
<div class="row">

<hr>

<div class="col-sm-8" style="text-align:left;vertical-align:middle;">
<p class="small" style="color:#bdbdbd;">
[NBIS](https://nbis.se/)[SciLifeLab](https://www.scilifelab.se/)
</p>
</div>

<div class="col-sm-4" style="text-align:right;vertical-align:middle;">
<p style="color:#bdbdbd;">
<span>
<span class="footericon" style="padding-right:4px; padding-left:4px">
<a href="https://nbis.se/">`r fontawesome::fa("globe-americas",fill="#bdbdbd")`</a>
</span>
<span class="footericon" style="padding-right:4px; padding-left:4px">
<a href="https://twitter.com/NBISwe">`r fontawesome::fa("twitter",fill="#bdbdbd")`</a>
</span>
<span class="footericon" style="padding-left:4px">
<a href="https://www.linkedin.com/company/nbisweden/">`r fontawesome::fa("linkedin",fill="#bdbdbd")`</a>
</span>
</span>
</p>
</div>

</div>
</div>
</footer>
38 changes: 38 additions & 0 deletions 2403/assets/footer-lab.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

<footer class="footer">
<div class="container footer-container">
<div class="row">

<div class="footer-left col-sm-6">
<p class="small">
<b>2024</b><a href="https://nbis.se/">NBIS</a><a href="https://www.scilifelab.se/">SciLifeLab</a>
</p>
</div>

<div class="footer-right col-sm-6">
<p>
<span>
<span class="footericon" style="padding-right:4px; padding-left:4px">
<a href="https://nbis.se/">
<svg style="height:0.8em;top:.04em;position:relative;fill:#bdbdbd;" viewBox="0 0 496 512"><path d="M248 8C111.03 8 0 119.03 0 256s111.03 248 248 248 248-111.03 248-248S384.97 8 248 8zm82.29 357.6c-3.9 3.88-7.99 7.95-11.31 11.28-2.99 3-5.1 6.7-6.17 10.71-1.51 5.66-2.73 11.38-4.77 16.87l-17.39 46.85c-13.76 3-28 4.69-42.65 4.69v-27.38c1.69-12.62-7.64-36.26-22.63-51.25-6-6-9.37-14.14-9.37-22.63v-32.01c0-11.64-6.27-22.34-16.46-27.97-14.37-7.95-34.81-19.06-48.81-26.11-11.48-5.78-22.1-13.14-31.65-21.75l-.8-.72a114.792 114.792 0 0 1-18.06-20.74c-9.38-13.77-24.66-36.42-34.59-51.14 20.47-45.5 57.36-82.04 103.2-101.89l24.01 12.01C203.48 89.74 216 82.01 216 70.11v-11.3c7.99-1.29 16.12-2.11 24.39-2.42l28.3 28.3c6.25 6.25 6.25 16.38 0 22.63L264 112l-10.34 10.34c-3.12 3.12-3.12 8.19 0 11.31l4.69 4.69c3.12 3.12 3.12 8.19 0 11.31l-8 8a8.008 8.008 0 0 1-5.66 2.34h-8.99c-2.08 0-4.08.81-5.58 2.27l-9.92 9.65a8.008 8.008 0 0 0-1.58 9.31l15.59 31.19c2.66 5.32-1.21 11.58-7.15 11.58h-5.64c-1.93 0-3.79-.7-5.24-1.96l-9.28-8.06a16.017 16.017 0 0 0-15.55-3.1l-31.17 10.39a11.95 11.95 0 0 0-8.17 11.34c0 4.53 2.56 8.66 6.61 10.69l11.08 5.54c9.41 4.71 19.79 7.16 30.31 7.16s22.59 27.29 32 32h66.75c8.49 0 16.62 3.37 22.63 9.37l13.69 13.69a30.503 30.503 0 0 1 8.93 21.57 46.536 46.536 0 0 1-13.72 32.98zM417 274.25c-5.79-1.45-10.84-5-14.15-9.97l-17.98-26.97a23.97 23.97 0 0 1 0-26.62l19.59-29.38c2.32-3.47 5.5-6.29 9.24-8.15l12.98-6.49C440.2 193.59 448 223.87 448 256c0 8.67-.74 17.16-1.82 25.54L417 274.25z"></path>
</svg>
</a>
</span>
<span class="footericon" style="padding-right:4px; padding-left:4px">
<a href="https://twitter.com/NBISwe"><svg style="height:0.8em;top:.04em;position:relative;fill:#bdbdbd;" viewBox="0 0 512 512"><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path>
</svg>
</a>
</span>
<span class="footericon" style="padding-left:4px">
<a href="https://www.linkedin.com/company/nbisweden/">
<svg style="height:0.8em;top:.04em;position:relative;fill:#bdbdbd;" viewBox="0 0 448 512"><path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"></path>
</svg>
</a>
</span>
</span>
</p>
</div>

</div>
</div>
</footer>
6 changes: 6 additions & 0 deletions 2403/assets/footer-slide.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.end-text[
<p class="smaller">
<span class="small" style="line-height: 1.2;">Graphics from </span><img src="./assets/freepik.jpg" style="max-height:20px; vertical-align:middle;"><br>
`r paste0("Created: ",format(Sys.time(),format='%d-%b-%Y'))` • <a href="https://www.scilifelab.se/">SciLifeLab</a> • <a href="https://nbis.se/">NBIS</a>
</p>
]
Binary file added 2403/assets/freepik.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 114 additions & 0 deletions 2403/assets/header-lab.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<!-- rmd lab header -->

```{r,include=FALSE,cache=FALSE}
# load libraries
library(knitr) # runs pandoc
library(bookdown) # for markdown
library(fontawesome) # icons
# fontawesome dependency
fa <- rmarkdown::html_dependency_font_awesome()
fa$attachment <- "fonts/fontawesome-webfont.ttf"
htmltools::tagList(fa)
# turn off terminal colors
options(crayon.enabled = FALSE)
# knitr options
knitr::opts_knit$set(progress=TRUE,verbose=TRUE)
knitr::opts_chunk$set(dev="png",fig.retina=2,results="hold",fig.show="hold",fig.align="left",
echo=TRUE,warning=FALSE,message=FALSE,accordion=NULL,
chunk.title=NULL)
color_primary <- "#95b540"
color_text <- "#424949"
```

```{r,include=FALSE,cache=FALSE}
# custom hooks
## collapsible panel
knitr::knit_hooks$set(accordion=function(before,options,envir) {
if(before) {
id <- paste0("acc",format(Sys.time(),"%Y%m%d%H%S"),sample(c(0:9),1),sample(c(0:9),1),sample(c(0:9),1),sample(c(0:9),1))
if(is.null(options$btn.type)) {btn.type <- "normal"}else{btn.type <- options$btn.type}
paste0('<p>',
'<button class="btn btn-sm btn-primary btn-collapse btn-collapse-',btn.type,' collapsed" type="button" data-toggle="collapse" data-target="#',id,'" aria-expanded="false" aria-controls="',id,'">',
'</button>',
'</p>',
'<div class="collapse" id="',id,'">',
'<div class="card card-body">')
}else{
paste0("</div>","</div>")
}
})
## blur panel
knitr::knit_hooks$set(blur=function(before,options,envir) {
if(before) {
if(is.null(options$blur.title)) {blur.title <- ""}else{blur.title <- options$blur.title}
paste0('<div class="blur-outer">',
'<div class="blur-title">',blur.title,'</div>',
'<div class="blur-content">')
}else{
paste0("</div>","</div>")
}
})
## chunk.title for code
knitr::knit_hooks$set(chunk.title=function(before,options,envir) {
out_class <- NULL
if(is.null(options$class.output)) {
if(options$echo) out_class <- options$engine
if((!options$echo) & (options$results != "hide")) out_class <- "Output"
}else{
out_class <- options$class.output
}
if(before) {
paste0('<div class="chunk-title-parent"><div class="chunk-title small">',out_class,'</div>')
}else{
paste0('</div>')
}
})
# knit engine output
eng_output <- function(options) {
out <- ''
engine_output(options, options$code, out)
}
knitr::knit_engines$set(output=eng_output)
# custom fontawesome fa function
fa1 <- function (name=NULL,style="height:0.8em;top:0.04em;position:relative;fill:#424949;",extra_style=NULL)
{
full_name <- NULL
if (name %in% fontawesome:::fa_tbl$full_name) {
svg <- fontawesome:::fa_tbl[which(fontawesome:::fa_tbl$full_name == name), ][1, 4]
}
else if (name %in% fontawesome:::fa_tbl$name) {
svg <- fontawesome:::fa_tbl[which(fontawesome:::fa_tbl$name == name), ][1, 4]
}
else {
return("")
}
if(!is.null(extra_style)) style <- paste0(style,extra_style)
style <- paste0("style=\"", style, "\"")
if (!grepl(style, pattern = "style=\"\"")) {
svg <- gsub(pattern = "^<svg", replacement = paste0("<svg ",
style), x = svg)
}
svg <- htmltools::HTML(svg)
class(svg) <- c("fontawesome", class(svg))
return(paste0("<span>",svg,"</span>"))
}
fa2 <- function(name=NULL,style="height:0.8em;top:0.04em;position:relative;fill:white;margin-left:0.45em;margin-bottom: 0.1em;") {
return(fa1(name,style))
}
```

<br>
27 changes: 27 additions & 0 deletions 2403/assets/header-slide.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<link href="https://fonts.googleapis.com/css?family=Roboto|Source+Sans+Pro:300,400,600|Ubuntu+Mono&amp;subset=latin-ext" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">

```{r,include=FALSE,eval=knitr::opts_knit$get("rmarkdown.pandoc.to")=="html"}
# Enables Font Awesome in HTML based bookdown outputs.
fa <- rmarkdown::html_dependency_font_awesome()
fa$attachment <- "fonts/fontawesome-webfont.ttf"
htmltools::tagList(fa)
```

```{r,echo=FALSE,message=FALSE,warning=FALSE,results='hide'}
# run setup code
# load libraries
library(knitr) # runs pandoc
library(bookdown) # for markdown
color_primary <- "#95b540"
color_text <- "#424949"
# turn off terminal colors
options(crayon.enabled = FALSE)
# knitr options
knitr::opts_knit$set(progress=TRUE,verbose=TRUE)
knitr::opts_chunk$set(dev="png",fig.retina=2,results="hold",fig.show="hold",fig.align="left",echo=TRUE,warning=FALSE,message=FALSE)
```
Loading

0 comments on commit b7d625b

Please sign in to comment.