Skip to content

Commit

Permalink
Autobuild
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCarroll committed Dec 11, 2024
1 parent daf5d22 commit fbd3a40
Show file tree
Hide file tree
Showing 40 changed files with 4,856 additions and 837 deletions.
30 changes: 12 additions & 18 deletions docs/_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,42 +24,36 @@ navbar:
href: presentations/r_code/introToR_Session2.R
- text: Exercises
menu:
- text: vector
- text: Vectors
menu:
- text: Exercise
href: exercises/exercises/vector_exercise.html
href: exercises/exercises/Vectors_exercise.html
- text: Solution
href: exercises/answers/vector_answers.html
- text: matrices
href: exercises/answers/Vectors_answers.html
- text: Matrices
menu:
- text: Exercise
href: exercises/exercises/matrices_exercise.html
href: exercises/exercises/Matrices_exercise.html
- text: Solution
href: exercises/answers/matrices_answers.html
- text: factorsAndDataframes
href: exercises/answers/Matrices_answers.html
- text: FactorsAndDataframes
menu:
- text: Exercise
href: exercises/exercises/factorsAndDataframes_exercise.html
href: exercises/exercises/FactorsAndDataframes_exercise.html
- text: Solution
href: exercises/answers/factorsAndDataframes_answers.html
- text: Dataframes
menu:
- text: Exercise
href: exercises/exercises/Dataframes_exercise.html
- text: Solution
href: exercises/answers/Dataframes_answers.html
href: exercises/answers/FactorsAndDataframes_answers.html
- text: DataInputOutput
menu:
- text: Exercise
href: exercises/exercises/DataInputOutput_exercise.html
- text: Solution
href: exercises/answers/DataInputOutput_answers.html
- text: conditionsAndLoops
- text: ConditionsAndLoops
menu:
- text: Exercise
href: exercises/exercises/conditionsAndLoops_exercise.html
href: exercises/exercises/ConditionsAndLoops_exercise.html
- text: Solution
href: exercises/answers/conditionsAndLoops_answers.html
href: exercises/answers/ConditionsAndLoops_answers.html
- text: Functions
menu:
- text: Exercise
Expand Down
Binary file modified docs/data/writeThisMultipleXLSX.xlsx
Binary file not shown.
Binary file modified docs/data/writeThisXLSX.xlsx
Binary file not shown.
98 changes: 71 additions & 27 deletions docs/exercises/answers/DataInputOutput_answers.html

Large diffs are not rendered by default.

141 changes: 88 additions & 53 deletions docs/exercises/answers/Functions_answers.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

File renamed without changes.
211 changes: 156 additions & 55 deletions docs/exercises/answers/conditionsAndLoops_answers.html

Large diffs are not rendered by default.

173 changes: 140 additions & 33 deletions docs/exercises/answers/factorsAndDataframes_answers.html

Large diffs are not rendered by default.

169 changes: 155 additions & 14 deletions docs/exercises/exercises/DataInputOutput_exercise.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,106 @@



<style type="text/css">
code {
white-space: pre;
}
.sourceCode {
overflow: visible;
}
</style>
<style type="text/css" data-origin="pandoc">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ background-color: #f8f8f8; }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ef2929; }
code span.an { color: #8f5902; font-weight: bold; font-style: italic; }
code span.at { color: #204a87; }
code span.bn { color: #0000cf; }
code span.cf { color: #204a87; font-weight: bold; }
code span.ch { color: #4e9a06; }
code span.cn { color: #8f5902; }
code span.co { color: #8f5902; font-style: italic; }
code span.cv { color: #8f5902; font-weight: bold; font-style: italic; }
code span.do { color: #8f5902; font-weight: bold; font-style: italic; }
code span.dt { color: #204a87; }
code span.dv { color: #0000cf; }
code span.er { color: #a40000; font-weight: bold; }
code span.ex { }
code span.fl { color: #0000cf; }
code span.fu { color: #204a87; font-weight: bold; }
code span.im { }
code span.in { color: #8f5902; font-weight: bold; font-style: italic; }
code span.kw { color: #204a87; font-weight: bold; }
code span.op { color: #ce5c00; font-weight: bold; }
code span.ot { color: #8f5902; }
code span.pp { color: #8f5902; font-style: italic; }
code span.sc { color: #ce5c00; font-weight: bold; }
code span.ss { color: #4e9a06; }
code span.st { color: #4e9a06; }
code span.va { color: #000000; }
code span.vs { color: #4e9a06; }
code span.wa { color: #8f5902; font-weight: bold; font-style: italic; }
</style>
<script>
// apply pandoc div.sourceCode style to pre.sourceCode instead
(function() {
var sheets = document.styleSheets;
for (var i = 0; i < sheets.length; i++) {
if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
try { var rules = sheets[i].cssRules; } catch (e) { continue; }
var j = 0;
while (j < rules.length) {
var rule = rules[j];
// check if there is a div.sourceCode rule
if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
j++;
continue;
}
var style = rule.style.cssText;
// check if color or background-color is set
if (rule.style.color === '' && rule.style.backgroundColor === '') {
j++;
continue;
}
// replace div.sourceCode by a pre.sourceCode rule
sheets[i].deleteRule(j);
sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
}
}
})();
</script>



Expand Down Expand Up @@ -337,22 +437,68 @@ <h4 class="date"><a href="https://rockefelleruniversity.github.io/Intro_To_R_1Da
<p>

</p>
<p>These exercises are about the vector sections of <a href="https://rockefelleruniversity.github.io/Intro_To_R_1Day/">Introduction
<p>These exercises are about reading and writing data sections of <a href="https://rockefelleruniversity.github.io/Intro_To_R_1Day/">Introduction
to R</a>.</p>
<p><strong>Exercise 1</strong></p>
<p>Have a look at all files in notepad or excel before attempting to
read. All files can be found in the “data” directory.</p>
<ul>
<li><p>Read in the tab delimited file “GeneExpression.txt”.</p></li>
<li><p>Find the mean expression of all samples.</p></li>
<li>Check your current working directory. Set your working directory to
be in the downloaded course material. Specifically the <em>r_course</em>
subdirectory. [The exact path will depend on where you have save your
download]</li>
</ul>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">getwd</span>()</span></code></pre></div>
<pre><code>[1] &quot;/Users/mattpaul&quot;</code></pre>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="fu">setwd</span>(<span class="st">&quot;~/Downloads/Intro_To_R_1Day-master/r_course&quot;</span>)</span></code></pre></div>
<ul>
<li>Read in the tab delimited file “GeneExpression.txt”. Check the data
type.</li>
</ul>
<pre><code>## Sample_1.hi Sample_2.hi Sample_3.hi Sample_4.low Sample_5.low Sample_1.low
## 7.514996 6.774108 6.508127 6.262253 6.177761 6.017462</code></pre>
<pre><code>## Sample_1.hi Sample_2.hi Sample_3.hi Sample_4.low Sample_5.low Sample_1.low
## 7.514996 6.774108 6.508127 6.262253 6.177761 6.017462</code></pre>
<pre><code>## [1] &quot;data.frame&quot; &quot;list&quot; &quot;oldClass&quot; &quot;vector&quot;
## [5] &quot;list_OR_List&quot; &quot;vector_OR_factor&quot; &quot;vector_OR_Vector&quot;</code></pre>
<ul>
<li>Read in the tab delimited file “GeneExpressionWithMethods.txt”. This
file contains information on analysis steps used to produce file.</li>
<li><p>Coerce the data frame to a matrix</p></li>
<li><p>Find the mean expression of all genes.</p></li>
</ul>
<pre><code>## Gene_a Gene_b Gene_c Gene_d Gene_e Gene_f Gene_g Gene_h
## 4.660569 4.379796 4.259824 5.849420 5.850658 6.732781 10.405203 10.201357</code></pre>
<ul>
<li>Coerce the matrix back to a data frame. Add an additional column
with extra gene info
“Kidney”,“Adrenal”,“Liver”,“Adrenal”,“Kidney”,“Liver”,“Liver”,“Kidney”.
Also add the mean expression as a column.</li>
</ul>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" tabindex="-1"></a>geneExpression <span class="ot">&lt;-</span> <span class="fu">as.data.frame</span>(geneExpression)</span>
<span id="cb6-2"><a href="#cb6-2" tabindex="-1"></a>geneExpression<span class="sc">$</span>tissue_localisation <span class="ot">&lt;-</span> <span class="fu">factor</span>(<span class="fu">c</span>(<span class="st">&quot;Kidney&quot;</span>,<span class="st">&quot;Adrenal&quot;</span>,<span class="st">&quot;Liver&quot;</span>,<span class="st">&quot;Adrenal&quot;</span>,<span class="st">&quot;Kidney&quot;</span>,<span class="st">&quot;Liver&quot;</span>,<span class="st">&quot;Liver&quot;</span>,<span class="st">&quot;Kidney&quot;</span>))</span>
<span id="cb6-3"><a href="#cb6-3" tabindex="-1"></a>geneExpression<span class="sc">$</span>mean_expr <span class="ot">&lt;-</span> sampleMeans</span>
<span id="cb6-4"><a href="#cb6-4" tabindex="-1"></a>geneExpression</span></code></pre></div>
<pre><code>## Sample_1.hi Sample_2.hi Sample_3.hi Sample_4.low Sample_5.low
## Gene_a 5.742510 3.214303 4.116820 3.212353 5.742333
## Gene_b 6.444368 5.896076 2.592581 5.089549 3.624812
## Gene_c 3.083392 3.414723 3.706069 4.535536 5.104273
## Gene_d 4.726498 3.023746 3.033173 8.017895 8.098800
## Gene_e 9.909185 9.174323 9.957153 2.053501 3.276533
## Gene_f 10.680459 9.951243 8.985412 3.360963 3.566663
## Gene_g 10.516534 10.176163 9.778173 11.781520 9.005437
## Gene_h 9.017020 9.342291 9.895636 12.046704 11.003240
## Sample_1.low tissue_localisation mean_expr
## Gene_a 5.9350948 Kidney 4.660569
## Gene_b 2.6313925 Adrenal 4.379796
## Gene_c 5.7149521 Liver 4.259824
## Gene_d 8.1964109 Adrenal 5.849420
## Gene_e 0.7332521 Kidney 5.850658
## Gene_f 3.8519471 Liver 6.732781
## Gene_g 11.1733928 Liver 10.405203
## Gene_h 9.9032500 Kidney 10.201357</code></pre>
<ul>
<li><p>Read in tab delimited file “GeneExpression.txt”. Order genes by
decreasing expression in mean expression. Filter out genes with
expression below 5. Write out a new comma separated file with column
titles.</p></li>
<li><p>Read in the tab delimited file “GeneExpressionWithMethods.txt”.
This file contains information on analysis steps used to produce
file.</p></li>
</ul>
<pre><code>## Sample_1.hi Sample_2.hi Sample_3.hi Sample_4.low Sample_5.low
## Gene_a 5.742510 3.214303 4.116820 3.212353 5.742333
Expand Down Expand Up @@ -394,11 +540,6 @@ <h4 class="date"><a href="https://rockefelleruniversity.github.io/Intro_To_R_1Da
## Gene_f 3.8519471
## Gene_g 11.1733928
## Gene_h 9.9032500</code></pre>
<ul>
<li>Read in tab delimited file “GeneExpression.txt”. Order genes by
decreasing expression in Sample_1.hi. Write out a new comma separated
file with column titles.</li>
</ul>



Expand Down
25 changes: 23 additions & 2 deletions docs/exercises/exercises/Functions_exercise.html
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,19 @@ <h4 class="date"><a href="https://rockefelleruniversity.github.io/Intro_To_R_1Da
</p>
<p>These exercises are about the functions sections of <a href="https://rockefelleruniversity.github.io/Intro_To_R_1Day/">Introduction
to R</a>.</p>
<p><strong>Exercise 1</strong> - <strong>Functions</strong></p>
<p>– Create a function which takes one number and returns the square of
that number</p>
<pre><code>## [1] 9</code></pre>
<p>– Create a function which takes two numbers and returns the mean</p>
<pre><code>## [1] 2</code></pre>
<ul>
<li>Create a function which takes two vectors and returns the mean</li>
<li>Create a function which takes two vectors and returns the mean.
Include a message statement that gives the total length of both
vectors.</li>
</ul>
<pre><code>## [1] 2</code></pre>
<pre><code>## The total length of my vectors is 8</code></pre>
<pre><code>## [1] 4.25</code></pre>
<ul>
<li>Create a function which takes two numbers and returns the two
numbers as a vector and the mean, summary and multiple as a
Expand All @@ -367,6 +371,23 @@ <h4 class="date"><a href="https://rockefelleruniversity.github.io/Intro_To_R_1Da
factorial code if argument is a numeric.</p>
<pre><code>## [1] 7</code></pre>
<pre><code>## Please provide a numeric argument!</code></pre>
<p><strong>Exercise 2</strong> - <strong>Scripts</strong></p>
<p>Lets try to put as much together that we have learnt thus far. This
will be a multistep challenge. Break it down and use pseudocode to help.
Start by working the code interactively, then turn it into a script.</p>
<ol style="list-style-type: decimal">
<li>Read in the “data/GeneExpression.txt” dataset.</li>
<li>Use a apply to calculate the Z score for each gene (per row). The
zscore is (gene_expression - mean)/standard deviation. You should use a
function to do this calculation.</li>
<li>Find which gene has the highest absolute max Zscore. This is a very
rough proxy for the variability of that gene.</li>
<li>Print out the gene name with the highest value</li>
<li>Turn this into a script and run the script</li>
<li>Think about what modifications you would need to make in order to
accept a different data set as input.</li>
</ol>
<pre><code>## [1] &quot;Gene_h&quot;</code></pre>



Expand Down
Loading

0 comments on commit fbd3a40

Please sign in to comment.