You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lessons/wk7_lesson02_wald_test.md
+13-34Lines changed: 13 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,17 +118,13 @@ The results table that is returned to us is **a `DESeqResults` object**, which i
118
118
class(res_tableOE)
119
119
```
120
120
121
-
Now let's take a look at **what information is stored** in the results:
121
+
Now let's take a look at **what information is stored** in the results, using nested functions that convert `res_table0E` into a data frame that we can then View:
122
122
123
123
```r
124
124
# What is stored in results?
125
-
res_tableOE %>%
126
-
data.frame() %>%
127
-
View()
125
+
View(data.frame(res_tableOE))
128
126
```
129
127
130
-
> **Discussion:** The `%>%` acts as a pipe symbol in R. This functionality comes as part of the [`dplyr`](https://dplyr.tidyverse.org/) package, which was loaded as part of the `tidyverse` that we loaded at the beginning of our lessons. Knowing this, what exactly is the code above doing?
131
-
132
128
We have six columns of information reported for each gene (row). We can use the `mcols()` function to extract information on what the values stored in each column represent:
133
129
134
130
```r
@@ -167,13 +163,14 @@ The missing values represent genes that have undergone filtering as part of the
167
163
If within a row, all samples have zero counts there is no expression information and therefore these genes are not tested.
168
164
169
165
```r
170
-
# Filter genes by zero expression
171
-
res_tableOE[which(res_tableOE$baseMean==0),] %>%
172
-
data.frame() %>%
173
-
View()
166
+
# Filter genes by zero expression and view using the same type of nested command as above
> **The baseMean column for these genes will be zero, and the log2 fold change estimates, p-value and adjusted p-value will all be set to NA.*How would you adjust the command above to count the number of rows matching this condition*?**
173
+
> **The baseMean column for these genes will be zero, and the log2 fold change estimates, p-value and adjusted p-value will all be set to NA.**
177
174
178
175
**2. Genes with an extreme count outlier**
179
176
@@ -182,11 +179,9 @@ The `DESeq()` function calculates, for every gene and for every sample, a diagno
182
179
```r
183
180
# Filter genes that have an extreme outlier by looking for those rows that have a non-zero base mean but no values for p-value and adjusted p-value. Do we actually have any of these?
The problem is, these fold change estimates are not entirely accurate as they do not account for the large dispersion we observe with low read counts. To address this, the **log2 fold changes need to be adjusted**.
236
229
237
-
**This is where we stopped on Tuesday of Week 7!**
### More accurate LFC estimates: Picking up again from Tuesday
242
-
243
-
1.Get your HPC On Demand session going:
244
-
245
-
- Opening up RStudio using [HPC on Demand](https://hpcondemand.nih.gov/pun/sys/dashboard/), using default values except for Starting Directory and **INCREASE MEMORY TO 8G**: `/data/Bspc-training/YOUR_USERNAME/rnaseq`
246
-
247
-
- To check whether or not you are in the correct working directory, use `getwd()`. Something like `/vf/users/Bspc-training/changes/rnaseq` should come up.
248
-
249
-
- Using the Project menu in the top right corner, or the Files Pane window (clicking rnaseq -\> DEanalysis), to navigate to and open `DEanalysis.Rproj`
250
-
251
-
2. We are assuming that you have the `dds` object in your environment and your packages are loaded - run your `de_setup.R` script if needed!
252
-
253
-
3. Run the actual DESeq2 analysis if needed `dds <- DESeq(dds)`.
232
+
## More accurate LFC estimates
254
233
255
234
To generate more accurate log2 foldchange (LFC) estimates, DESeq2 allows for the **shrinkage of the LFC estimates toward zero** when the information for a gene is low, which could include:
0 commit comments