-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwork_assessment-processing_gtfs_part-0.5_non-Trinity.Rmd
317 lines (253 loc) · 9.51 KB
/
work_assessment-processing_gtfs_part-0.5_non-Trinity.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
---
title: "work_assessment-processing_gtfs_part-0.5_non-Trinity.Rmd"
author: "KA"
email: "[email protected]"
output:
html_notebook:
toc: yes
toc_float: true
---
<br />
## Get started
### Get situated
#### Code
<details>
<summary><i>Code: Get situated</i></summary>
```{r}
#!/usr/bin/env Rscript
library(GenomicRanges)
library(IRanges)
library(readxl)
library(rtracklayer)
library(tidyverse)
options(scipen = 999)
options(ggrepel.max.overlaps = Inf)
if(stringr::str_detect(getwd(), "kalavattam")) {
p_local <- "/Users/kalavattam/Dropbox/FHCC"
} else {
p_local <- "/Users/kalavatt/projects-etc"
}
p_wd <- "2022-2023_RRP6-NAB3/results/2023-0215"
setwd(paste(p_local, p_wd, sep = "/"))
getwd()
rm(p_local, p_wd)
```
</details>
<br />
<br />
## Assess the non-`Trinity`-GG `gtf`/`gff3` files
### Describe the provenance of the files
#### Text
<details>
<summary><i>Text: Describe the provenance of the files</i></summary>
In notebook `work_assessment-processing_gtfs_part-0.md`, copied the following files into the new directory `infiles_gtf-gff3/already` within `2022-2023_RRP6-NAB3/results/2023-0215`:
- `combined_SC_KL_20S.gff3`
- `combined_SC_KL.gff3`
- `combined.gtf`
- `Kluyveromyces_lactis_gca_000002515.ASM251v1.55.gff3`
- `Saccharomyces_cerevisiae.R64-1-1.108.gtf`
- `Saccharomyces_cerevisiae.R64-1-1.108.plus-chr-rename.gtf`
For details regarding `combined_SC_KL.gff3`, including its creation, see `results/2022-1025/notebook.md` and `results/2022-1201/work-Trinity-1.md` (contains code for the creation of the `gff3` file).
Regarding `combined_SC_KL_20S.gff3`, see the above two files as well as `work_gff3_include-20S.md` (which will likely be merged with the contents of this notebook `#TODO` `#MAYBE` `#LATER`).
`combined.gtf` was created by someone who was in Christine Cuccinota's graduate laboratory—I don't really know if the material in `combined.gtf` is accurate (i.e., not missing anything, not containing errors from editing, etc.), let alone if it has been edited since its creation (the time of which I also don't know). But Alison Greenlaw seems fine using it. Certainly, the structure does not follow the WashU/UCSC data guidelines for `gtf` and related files...
`Kluyveromyces_lactis_gca_000002515.ASM251v1.55.gff3`:
- genome build: `Genolevures Consortium ASM251v1`
- genome version: `ASM251v1`
- genome build accession: `GCA_000002515.1`
- gene build last updated: `2015-02`
- *No editing/other changes*
`Saccharomyces_cerevisiae.R64-1-1.108.gtf`:
- genome build: `R64-1-1`
- genome version: `R64-1-1`
- genome date: `2011-09`
- genome build accession: `GCA_000146045.2`
- gene build last updated: `2018-10`
- *No editing/other changes*
`Saccharomyces_cerevisiae.R64-1-1.108.plus-chr-rename.gtf`:
- *Same as above*
- Editing performed/detailed in `results/2022-1101/work-TPM-calculation.md`
`#TODO` *Write up details for the Trinity-GG `gff3` files*
</details>
<br />
### What are the non-`Trinity-GG` `gtf`s/`gff3`s to assess?
#### Code
<details>
<summary><i>Code: What are the non-`Trinity-GG` `gtf`s/`gff3`s to assess?</i></summary>
```{r}
#!/usr/bin/env Rscript
path_g <- "infiles_gtf-gff3/already"
list.files(path_g)
```
</details>
<br />
### Examine data structures for read-in gtfs/gff3s
#### Load `gtf`s/`gff3`s
##### Code
<details>
<summary><i>Code: Load `gtf`s/`gff3`s</i></summary>
```{r}
#!/usr/bin/env Rscript
g_sk2 <- rtracklayer::import(paste(path_g, list.files(path_g)[1], sep = "/"))
g_sk <- rtracklayer::import(paste(path_g, list.files(path_g)[2], sep = "/"))
g_comb <- rtracklayer::import(paste(path_g, list.files(path_g)[3], sep = "/"))
g_k <- rtracklayer::import(paste(path_g, list.files(path_g)[4], sep = "/"))
g_s <- rtracklayer::import(paste(path_g, list.files(path_g)[5], sep = "/"))
g_sre <- rtracklayer::import(paste(path_g, list.files(path_g)[6], sep = "/"))
```
</details>
<br />
#### Reviewing `GenomicRanges` accessor functions, etc.
Building on the material [here](https://bioconductor.org/packages/devel/bioc/vignettes/GenomicRanges/inst/doc/GenomicRangesIntroduction.html).
##### Code
<details>
<summary><i>Code: Reviewing `GenomicRanges` accessor functions, etc.</i></summary>
```{r}
#!/usr/bin/env Rscript
cat("# =====================================\n")
cat("# Review the GenomicRanges accessor functions by looking at Kluyveromyces_lactis_gca_000002515.ASM251v1.55.gff3")
cat("\n\n")
cat("# -------------------------------------\n")
cat("# seqnames()\n")
seqnames(g_k)
cat("\n\n")
cat("# -------------------------------------\n")
cat("# ranges()\n")
ranges(g_k)
cat("\n\n")
cat("# -------------------------------------\n")
cat("# strand()\n")
strand(g_k)
cat("\n\n")
cat("# -------------------------------------\n")
cat("# granges()\n")
granges(g_k)
cat("\n\n")
cat("# -------------------------------------\n")
cat("# mcols()\n")
mcols(g_k)
cat("\n\n")
cat("# -------------------------------------\n")
cat("# mcols() %>% colnames()\n")
# Get all "columns" in GRanges object
mcols(g_k) %>% colnames()
cat("\n\n")
cat("# -------------------------------------\n")
cat("# seqlengths()\n")
cat("# (Apparently, will need to add this info yourself...)\n")
seqlengths(g_k)
cat("\n\n")
# g_s
```
</details>
<br />
#### Review the structure of a `GRanges` object
##### Code
<details>
<summary><i>Code: Review the structure of a `GRanges` object</i></summary>
```{r}
#!/usr/bin/env Rscript
cat("# =====================================\n")
cat("# Review the structure of a GRanges object with Kluyveromyces_lactis_gca_000002515.ASM251v1.55.gff3")
cat("\n\n")
cat("# -------------------------------------\n")
cat("# g_k %>% as.data.frame() %>% length()\n")
g_k %>% as.data.frame() %>% length()
cat("\n\n")
cat("# -------------------------------------\n")
cat("# mcols(g_k) %>% length()\n")
mcols(g_k) %>% length()
cat("\n\n")
cat("# -------------------------------------\n")
cat("#QUESTION Why the discrepancy?\n\n")
cat("# -------------------------------------\n")
cat("# g_k %>% as.data.frame() %>% colnames()\n")
g_k %>% as.data.frame() %>% colnames()
cat("\n\n")
cat("# -------------------------------------\n")
cat("# mcols(g_k) %>% colnames()\n")
mcols(g_k) %>% colnames()
cat("\n\n")
cat("# -------------------------------------\n")
cat("#ANSWER mcols() is returning the metadata columns, not all\n")
```
</details>
<br />
#### Explore/test a `GRanges`-to-`data.frame`-to-`GRanges` conversion
Building on info [here](https://web.mit.edu/~r/current/arch/i386_linux26/lib/R/library/GenomicRanges/html/makeGRangesFromDataFrame.html).
##### Code
<details>
<summary><i>Code: Explore/test a `GRanges`-to-`data.frame`-to-`GRanges` conversion</i></summary>
```{r}
#!/usr/bin/env Rscript
cat("# -------------------------------------\n")
cat("#QUESTION If I convert, say, g_k to a data.frame, can I successfully\n")
cat(" convert it back to a GRanges object?\n\n")
d_k <- g_k %>% as.data.frame()
# "Reconstitute" the GRanges object ("rg")
rg_k <- GenomicRanges::makeGRangesFromDataFrame(
d_k, keep.extra.columns = TRUE
)
isTRUE(length(mcols(g_k)) == length(mcols(rg_k)))
# Eyeball the reconstituted files
rtracklayer::export(rg_k, "test.gtf")
rtracklayer::export(rg_k, "test.gff3")
# It works! Empty vector elements are now included in the metadata of
#+ test.gff3 vs. Kluyveromyces_lactis_gca_000002515.ASM251v1.55.gff3; besides
#+ that, they are the same. Now, can delete the above test files.
unlink(c("test.gtf", "test.gff3"))
# file.exists(c("test.gtf", "test.gff3"))
cat("\n# -------------------------------------\n")
cat("#ANSWER Yes")
cat("\n\n")
```
</details>
<br />
## Describe details/game plan for the experiment
### The contents of `infiles_gtf-gff3/Trinity-GG`
#### Code
<details>
<summary><i>Code: The contents of `infiles_gtf-gff3/Trinity-GG`</i></summary>
```{bash}
#!/bin/bash
cd infiles_gtf-gff3/Trinity-GG
.,s
```
</details>
<br />
#### Printed
<details>
<summary><i>Printed: The contents of `infiles_gtf-gff3/Trinity-GG`</i></summary>
```{txt}
./G_N:
total 43M
drwx------ 8 kalavatt 256 Feb 24 15:16 ./
drwx------ 4 kalavatt 128 Mar 27 11:08 ../
-rwx------ 1 kalavatt 6.8M Feb 24 15:07 trinity-gg_mkc-16_mir-0.05_mg-2_gf-0.05.gff3*
-rwx------ 1 kalavatt 8.2M Feb 24 15:10 trinity-gg_mkc-1_mir-0.05_mg-2_gf-0.05.gff3*
-rwx------ 1 kalavatt 7.6M Feb 24 15:09 trinity-gg_mkc-2_mir-0.05_mg-2_gf-0.05.gff3*
-rwx------ 1 kalavatt 6.5M Feb 24 15:07 trinity-gg_mkc-32_mir-0.05_mg-2_gf-0.05.gff3*
-rwx------ 1 kalavatt 7.0M Feb 24 15:09 trinity-gg_mkc-4_mir-0.05_mg-2_gf-0.05.gff3*
-rwx------ 1 kalavatt 6.8M Feb 24 15:08 trinity-gg_mkc-8_mir-0.05_mg-2_gf-0.05.gff3*
./Q_N:
total 52M
drwx------ 8 kalavatt 256 Feb 24 15:16 ./
drwx------ 4 kalavatt 128 Mar 27 11:08 ../
-rwx------ 1 kalavatt 8.3M Feb 24 14:44 trinity-gg_mkc-16_mir-0.05_mg-2_gf-0.05.gff3*
-rwx------ 1 kalavatt 11M Feb 24 14:47 trinity-gg_mkc-1_mir-0.05_mg-2_gf-0.05.gff3*
-rwx------ 1 kalavatt 9.5M Feb 24 14:46 trinity-gg_mkc-2_mir-0.05_mg-2_gf-0.05.gff3*
-rwx------ 1 kalavatt 6.9M Feb 24 14:44 trinity-gg_mkc-32_mir-0.05_mg-2_gf-0.05.gff3*
-rwx------ 1 kalavatt 8.7M Feb 24 14:46 trinity-gg_mkc-4_mir-0.05_mg-2_gf-0.05.gff3*
-rwx------ 1 kalavatt 8.3M Feb 24 14:45 trinity-gg_mkc-8_mir-0.05_mg-2_gf-0.05.gff3*
```
</details>
<br />
### Written descriptions
#### Background
##### Text
<details>
<summary><i>Text: Background</i></summary>
Details for how these files were made are in the following notebooks:
- The `fasta` files from running `Trinity` (genome-guided, or "GG," mode): `results/2023-0111/work_Trinity-GF-GG-optimization_submit-jobs.md`
- Aligning the `fasta` sequences to generate `gff3` files: `results/2023-0111/work_GMAP_rough-draft.md`
</details>
<br />