Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
pimentel committed Nov 3, 2015
2 parents 14c064e + ae6bfeb commit 6ea0462
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
34 changes: 22 additions & 12 deletions inst/doc/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="author" content="Harold Pimentel, Nicolas Bray, Pall Melsted and Lior Pachter" />

<meta name="date" content="2015-10-27" />
<meta name="date" content="2015-11-02" />

<title>Introduction to sleuth</title>

Expand Down Expand Up @@ -72,7 +72,7 @@
<div id="header">
<h1 class="title">Introduction to sleuth</h1>
<h4 class="author"><em>Harold Pimentel, Nicolas Bray, Pall Melsted and Lior Pachter</em></h4>
<h4 class="date"><em>2015-10-27</em></h4>
<h4 class="date"><em>2015-11-02</em></h4>
</div>


Expand Down Expand Up @@ -169,7 +169,7 @@ <h2>Example</h2>
## 4 ~/Downloads/cuffdiff2_data_kallisto_results/results/SRR493369/kallisto
## 5 ~/Downloads/cuffdiff2_data_kallisto_results/results/SRR493370/kallisto
## 6 ~/Downloads/cuffdiff2_data_kallisto_results/results/SRR493371/kallisto</code></pre>
<p>Now the “sleuth object” can be constructed. This requires three commands that (1) load the kallisto processed data into the object (2) estimate parameters for the <strong>sleuth</strong> response error measurement model and (3) perform differential analyis (testing). On a laptop the three steps should take about 2 minutes altogether.</p>
<p>Now the “sleuth object” can be constructed. This requires three commands that (1) load the kallisto processed data into the object (2) estimate parameters for the <strong>sleuth</strong> response error measurement model and (3) perform differential analysis (testing). On a laptop the three steps should take about 2 minutes altogether.</p>
<p>First type</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">so &lt;-<span class="st"> </span><span class="kw">sleuth_prep</span>(s2c, ~<span class="st"> </span>condition)</code></pre></div>
<pre><code>## reading in kallisto results
Expand All @@ -186,7 +186,7 @@ <h2>Example</h2>
## computing variance of betas</code></pre>
<p>and finally</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">so &lt;-<span class="st"> </span><span class="kw">sleuth_wt</span>(so, <span class="st">'conditionscramble'</span>)</code></pre></div>
<p>In general, one can see the possible tests that could be performed using the <code>which_beta</code> parameter in <code>sleuth_test</code> and examining the coefficients:</p>
<p>In general, one can see the possible tests that could be performed using the <code>which_beta</code> parameter in <code>sleuth_wt</code> and examining the coefficients:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">models</span>(so)</code></pre></div>
<pre><code>## [ full ]
## formula: ~condition
Expand All @@ -202,16 +202,26 @@ <h2>Example</h2>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">mart &lt;-<span class="st"> </span>biomaRt::<span class="kw">useMart</span>(<span class="dt">biomart =</span> <span class="st">&quot;ensembl&quot;</span>, <span class="dt">dataset =</span> <span class="st">&quot;hsapiens_gene_ensembl&quot;</span>)</code></pre></div>
<pre><code>## Creating a generic function for 'nchar' from package 'base' in package 'S4Vectors'</code></pre>
<p>and add them into the <strong>sleuth</strong> table with</p>
<pre><code>t2g &lt;- biomaRt::getBM(attributes = c(&quot;ensembl_transcript_id&quot;, &quot;ensembl_gene_id&quot;,
&quot;external_gene_name&quot;), mart = mart)
t2g &lt;- dplyr::rename(t2g, target_id = ensembl_transcript_id,
ens_gene = ensembl_gene_id, ext_gene = external_gene_name)
so &lt;- sleuth_prep(kal_dirs, s2c, ~ condition, target_mapping = t2g)
so &lt;- sleuth_fit(so)
so &lt;- sleuth_test(so, which_beta = 'conditionscramble')</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">t2g &lt;-<span class="st"> </span>biomaRt::<span class="kw">getBM</span>(<span class="dt">attributes =</span> <span class="kw">c</span>(<span class="st">&quot;ensembl_transcript_id&quot;</span>, <span class="st">&quot;ensembl_gene_id&quot;</span>,
<span class="st">&quot;external_gene_name&quot;</span>), <span class="dt">mart =</span> mart)
t2g &lt;-<span class="st"> </span>dplyr::<span class="kw">rename</span>(t2g, <span class="dt">target_id =</span> ensembl_transcript_id,
<span class="dt">ens_gene =</span> ensembl_gene_id, <span class="dt">ext_gene =</span> external_gene_name)
so &lt;-<span class="st"> </span><span class="kw">sleuth_prep</span>(s2c, ~<span class="st"> </span>condition, <span class="dt">target_mapping =</span> t2g)</code></pre></div>
<pre><code>## reading in kallisto results
## ......
## normalizing est_counts
## 50844 targets passed the filter
## normalizing tpm
## merging in metadata
## normalizing bootstrap samples
## summarizing bootstraps</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">so &lt;-<span class="st"> </span><span class="kw">sleuth_fit</span>(so)</code></pre></div>
<pre><code>## shrinkage estimation
## computing variance of betas</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">so &lt;-<span class="st"> </span><span class="kw">sleuth_wt</span>(so, <span class="dt">which_beta =</span> <span class="st">'conditionscramble'</span>)</code></pre></div>
<p>This addition of metadata to transcript IDs is very general, and can be used to add in other information.</p>
<p>The best way to view the results is to generate the Shiny webpage that allows for exploratory data analysis:</p>
<pre><code>sleuth_live(so)</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">sleuth_live</span>(so)</code></pre></div>
<p>To generate a table of results for analysis within R type</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">results_table &lt;-<span class="st"> </span><span class="kw">sleuth_results</span>(so, <span class="st">'conditionscramble'</span>)</code></pre></div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions vignettes/intro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ In this case, the kallisto output is correctly matched with the sample identifie
print(s2c)
```

Now the "sleuth object" can be constructed. This requires three commands that (1) load the kallisto processed data into the object (2) estimate parameters for the __sleuth__ response error measurement model and (3) perform differential analyis (testing). On a laptop the three steps should take about 2 minutes altogether.
Now the "sleuth object" can be constructed. This requires three commands that (1) load the kallisto processed data into the object (2) estimate parameters for the __sleuth__ response error measurement model and (3) perform differential analysis (testing). On a laptop the three steps should take about 2 minutes altogether.

First type

Expand All @@ -139,7 +139,7 @@ and finally
so <- sleuth_wt(so, 'conditionscramble')
```

In general, one can see the possible tests that could be performed using the `which_beta` parameter in `sleuth_test` and examining the coefficients:
In general, one can see the possible tests that could be performed using the `which_beta` parameter in `sleuth_wt` and examining the coefficients:

```{r eval=TRUE}
models(so)
Expand All @@ -164,21 +164,21 @@ mart <- biomaRt::useMart(biomart = "ensembl", dataset = "hsapiens_gene_ensembl")

and add them into the __sleuth__ table with

```
```{r, eval=TRUE}
t2g <- biomaRt::getBM(attributes = c("ensembl_transcript_id", "ensembl_gene_id",
"external_gene_name"), mart = mart)
t2g <- dplyr::rename(t2g, target_id = ensembl_transcript_id,
ens_gene = ensembl_gene_id, ext_gene = external_gene_name)
so <- sleuth_prep(kal_dirs, s2c, ~ condition, target_mapping = t2g)
so <- sleuth_prep(s2c, ~ condition, target_mapping = t2g)
so <- sleuth_fit(so)
so <- sleuth_test(so, which_beta = 'conditionscramble')
so <- sleuth_wt(so, which_beta = 'conditionscramble')
```

This addition of metadata to transcript IDs is very general, and can be used to add in other information.

The best way to view the results is to generate the Shiny webpage that allows for exploratory data analysis:

```
```{r, eval=FALSE}
sleuth_live(so)
```

Expand Down

0 comments on commit 6ea0462

Please sign in to comment.