-
Notifications
You must be signed in to change notification settings - Fork 7
/
.Rhistory
369 lines (369 loc) · 16 KB
/
.Rhistory
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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
install.packages("tidyverse")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("SeqArray")
BiocManager::install("SeqArray")
BiocManager::install("SNPRelate")
vcftools --vcf RAD_data/OL_subset.vcf --missing-indv --out RAD_data/OL_subset
setwd("/Users/Jason/github/marineomics.github.io")
rmarkdown::render_site()
rmarkdown::render_site()
install.packages(DESeq2)
install.packages('DESeq2')
invisible(lapply(c( "tidyverse", "ape", "vegan", "GGally",
, "rgl", "adegenet", "MASS",
"data.table", "plyr", "lmtest", "reshape2", "Rmisc", "lmerTest","statmod"),
function(p){
if(! p %in% rownames(installed.packages())) {
#install.packages(p)
}
library(p, character.only=TRUE)
}))
if(! p %in% rownames(installed.packages())) {
install.packages(p)
}
invisible(lapply(c( "tidyverse", "ape", "vegan", "GGally",
, "rgl", "adegenet", "MASS",
"data.table", "plyr", "lmtest", "reshape2", "Rmisc", "lmerTest","statmod"),
function(p){
if(! p %in% rownames(installed.packages())) {
install.packages(p)
}
library(p, character.only=TRUE)
}))
invisible(lapply(c( "tidyverse", "ape", "vegan", "GGally",
"rgl", "adegenet", "MASS",
"data.table", "plyr", "lmtest", "reshape2", "Rmisc", "lmerTest","statmod"),
function(p){
if(! p %in% rownames(installed.packages())) {
install.packages(p)
}
library(p, character.only=TRUE)
}))
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(c("DESeq2","edgeR","arrayQualityMetrics"))
rmarkdown::render_site()
install.packages('Hmisc')
rmarkdown::render_site()
install.packages('Hmisc')
install.packages('Hmisc')
invisible(lapply(c( "tidyverse", "ape", "vegan", "GGally",
"rgl", "adegenet", "MASS",
"data.table", "plyr", "lmtest", "reshape2", "Rmisc", "lmerTest","statmod"),
function(p){
if(! p %in% rownames(installed.packages())) {
install.packages(p)
}
library(p, character.only=TRUE)
}))
install.packages('XQuartz')
devtools::install_github("natverse/nat")
if (!require("devtools")) install.packages("devtools")
# then install nat
devtools::install_github("natverse/nat")
rmarkdown::render_site()
invisible(lapply(c( "tidyverse", "ape", "vegan", "GGally",
"rgl", "adegenet", "MASS",
"data.table", "plyr", "lmtest", "reshape2", "Rmisc", "lmerTest","statmod"),
function(p){
if(! p %in% rownames(installed.packages())) {
install.packages(p)
}
library(p, character.only=TRUE)
}))
library(knitr)
knitr::opts_chunk$set(echo = TRUE)
library(knitcitations)
library(kableExtra)
opts_chunk$set(fig.width = 10,
fig.height = 5,
cache = FALSE)
cite_options(citation_format = "pandoc", max.names = 3, style = "html",
hyperlink = "to.doc")
knitr::include_graphics("submissions_instructions/Rivera_etal_fig.png")
getwd()
?normalizePath
?render_website
??render_website
??render
rmarkdown::render_site()
getwd()
vcftools --vcf RAD_data/OL_subset.vcf --missing-indv --out RAD_data/OL_subset
#using previously loaded gdsin object
print("Per variant: ")
summary(m1 <- SeqArray::seqMissing(gdsin, per.variant=TRUE))
library(SeqArray) # efficient storage and filtering of genomic data
library(tidyverse) # plotting data formatting and manipulation
library(SNPRelate) # PCA and other popgen analyses
# This code reads in a comma-delimited STRATA/meta-data file, randomises samples, and returns a file with wells and plates and duplicates which may be used to assist with plating libraries
# ** TODO** will need to consider where to duplicate samples - need to consider STARTA, DOC, ect..?
# maybe have user write in a list of samples to replicate
wells = 96 # how many wells can you use on your plate?
data.in = read.table("./data/example.metadata.csv", sep = ",", header = T) # each sample should be in its own ROW
filename = "OL_subset" #replace with your file name
filename.gds = paste0("RAD_data/", paste0(filename, ".gds"))
filename.vcf = paste0("RAD_data/", paste0(filename, ".vcf"))
# 1 . Convert VCF to GDS
SeqArray::seqVCF2GDS(vcf.fn = filename.vcf, out.fn = filename.gds, storage.option="ZIP_RA")
gdsin = SeqArray::seqOpen(filename.gds)
print(paste0("The number of SAMPLES in data: ", length(c(SeqArray::seqGetData(gdsin, "sample.id")))))
print(paste0("The number of SNPs in data: ", length(c(SeqArray::seqGetData(gdsin, "variant.id")))))
metafile = "RAD_data/OL.popmap"
sample.ids = seqGetData(gdsin, "sample.id")
sample.strata = read.table(metafile, header = T, sep = "\t") %>%
dplyr::select(ID, STRATA, PLATE)
#using previously loaded gdsin object
print("Per variant: ")
summary(m1 <- SeqArray::seqMissing(gdsin, per.variant=TRUE))
print("Per sample: ")
summary(m2 <- SeqArray::seqMissing(gdsin, per.variant=FALSE))
samples <- SeqArray::seqGetData(gdsin, "sample.id")
cbind(samples,m2)[order(-m2),]
#plot histogram
hist(m2,breaks=50)
View(gdsin)
gdsin[["root"]]
install.packages("shiny")
install.packages("learnr")
Cvgff <- read.csv("DRAFT_Funct_Enrich/annotGCF_002022765.2_C_virginica-3.0_genomic.gff")
Cvgff <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_genomic.gff", )
library(data.table)
Cvgff <- fread("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_genomic.gff", comment.char = "#")
library(data.table)
Cvgff <- fread("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_genomic.gff")
View(Cvgff)
library(data.table)
Cvgff <- fread("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_genomic.gff", comment.char=#)
library(data.table)
Cvgff <- fread("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_genomic.gff", comment.char="#")
library(data.table)
Cvgff <- fread("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_genomic.gff", comment.char=##)
library(data.table)
Cvgff <- fread("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_genomic.gff")
library(data.table)
Cvgff <- fread("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_genomic.gff", fill=TRUE,comment.char=#)
library(data.table)
Cvgff <- fread("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_genomic.gff", fill=TRUE)
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("rtracklayer")
# Load the library
library(rtracklayer)
# Define the file path to your GFF file
file_path <- "DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_genomic.gff"
# Import the GFF file
gff_data <- import(file_path)
# Convert GRanges object to a DataFrame for easier manipulation
gff_data_frame <- as.data.frame(gff_data)
View(gff_data_frame)
gff_data_frame %>%
select(type, gene)
library(tidyverse)
gff_data_frame %>%
select(type, gene)
gff_data_frame %>%
filter(type = gene)
gff_data_frame %>%
filter(type == gene)
gff_data_frame %>%
filter(type == "gene")
cds <- gff_data_frame %>%
filter(type == "CDS")
View(cds)
View(cds)
cds <- gff_data_frame %>%
filter(gbkey == "CDS" && source == "Gnomon")
cds <- gff_data_frame %>%
filter(gbkey == "CDS" | source == "Gnomon")
cds <- gff_data_frame %>%
filter(gbkey == "CDS", source == "Gnomon")
cds <- gff_data_frame %>%
filter(gbkey == "CDS", source == "Gnomon")
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab")
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = '\t', row.names=NULL)
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = '\t', row.names=NULL)
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = '\t', row.names=NULL)
View(cds)
View(cdsftab)
View(cdsftab)
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = '\t', header = FALSE, row.names=NULL)
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = ' ', header = FALSE, row.names=NULL)
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = '\t', header = FALSE, row.names=NULL)
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = '] [', header = FALSE, row.names=NULL)
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = "] [", header = FALSE, row.names=NULL)
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = '\t', header = FALSE, row.names=NULL)
df <- cdsftab %>%
mutate(text = str_remove_all(text, "\\[|\\]")) %>%
separate(text, into = c("gene", "db_xref", "protein", "protein_id"), sep = "\\] \\[", remove = FALSE) %>%
mutate(across(gene:protein_id, ~str_split(., "=", simplify = TRUE)[,2]))
df <- cdsftab %>%
mutate(data = str_replace_all(data, "\\[|\\]", "")) %>%
separate(data, into = c("gene", "db_xref", "protein", "protein_id"), sep = " ", remove = FALSE) %>%
mutate(across(gene:protein_id, ~str_split(., "=", simplify = TRUE)[,2]))
blast <- read.csv("DRAFT_Funct_Enrich/annot/Cvir_transcds-uniprot_blastp.tab")
View(blast)
blast <- read.csv("DRAFT_Funct_Enrich/annot/Cvir_transcds-uniprot_blastp.tab", sep )
blast <- read.csv("DRAFT_Funct_Enrich/annot/Cvir_transcds-uniprot_blastp.tab", sep = '\t')
bedtools getfasta [OPTIONS] -fi <input FASTA> -bed <BED/GFF/VCF>ex
View(blast)
View(blast)
blast <- read.csv("DRAFT_Funct_Enrich/annot/Cvir_transcds-uniprot_blastp.tab", sep = '\t')
blast <- read.csv("DRAFT_Funct_Enrich/annot/Cvir_transcds-uniprot_blastp.tab", sep = '\t', header = FALSE)
blast <- read.csv("DRAFT_Funct_Enrich/annot/Cvir_transcds-uniprot_blastp.tab", sep = '\t', header = FALSE)
View(blast)
left_join(blast, cdsftab, by = V1)
left_join(blast, cdsftab, by = V1)
left_join(blast, cdsftab, by = "V1")
df < - left_join(blast, cdsftab, by = "V1")
df < - left_join(blast, cdsftab, by = "V1")
df <- left_join(blast, cdsftab, by = "V1")
View(df)
View(df)
df <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(text, "(?<=\\[gene=)\\w+"))
df <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract("(?<=\\[gene=)\\w+"))
df <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+"))
df <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.y)
df <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.y)
df <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x)
df <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x) %>%
mutate(SPID = str_extract(V2.x, "(?<=\\|)[^\\|]*(?=\\|)"))
df <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x) %>%
mutate(SPID = str_extract(V2.x, "(?<=\\|)[^\\|]*(?=\\|)")) %>%
distinct(gene, SPID, .keep_all = TRUE)
df <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x) %>%
mutate(SPID = str_extract(V2.x, "(?<=\\|)[^\\|]*(?=\\|)")) %>%
distinct(gene, SPID, .keep_all = TRUE)
gene-spid <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x) %>%
mutate(SPID = str_extract(V2.x, "(?<=\\|)[^\\|]*(?=\\|)")) %>%
distinct(gene, SPID, .keep_all = TRUE)
left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x) %>%
mutate(SPID = str_extract(V2.x, "(?<=\\|)[^\\|]*(?=\\|)")) %>%
distinct(gene, SPID, .keep_all = TRUE) %>%
select(SPID) %>%
write.table(file = "DRAFT_Funct_Enrich/annot/SPID.txt", sep = "\t", row.names = FALSE
)
library(tidyverse)
g.spid <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x) %>%
mutate(SPID = str_extract(V2.x, "(?<=\\|)[^\\|]*(?=\\|)")) %>%
distinct(gene, SPID, .keep_all = TRUE)
reticulate::repl_python()
left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x) %>%
mutate(SPID = str_extract(V2.x, "(?<=\\|)[^\\|]*(?=\\|)")) %>%
distinct(gene, SPID, .keep_all = TRUE) %>%
select(SPID) %>%
write.table(file = "DRAFT_Funct_Enrich/annot/SPID.txt", sep = "\t", row.names = FALSE
)
reticulate::repl_python()
reticulate::repl_python()
reticulate::repl_python()
left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x) %>%
mutate(SPID = str_extract(V2.x, "(?<=\\|)[^\\|]*(?=\\|)")) %>%
distinct(gene, SPID, .keep_all = TRUE) %>%
select(SPID) %>%
write.table(file = "DRAFT_Funct_Enrich/annot/SPID.txt", sep = "\t", row.names = FALSE, quote = FALSE
)
reticulate::repl_python()
reticulate::repl_python()
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = '\t', header = FALSE, row.names=NULL)
blast <- read.csv("DRAFT_Funct_Enrich/annot/Cvir_transcds-uniprot_blastp.tab", sep = '\t', header = FALSE)
cdsftab <- read.csv("DRAFT_Funct_Enrich/annot/GCF_002022765.2_C_virginica-3.0_translated_cds.tab", sep = '\t', header = FALSE, row.names=NULL)
g.spid <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x) %>%
mutate(SPID = str_extract(V2.x, "(?<=\\|)[^\\|]*(?=\\|)")) %>%
distinct(gene, SPID, .keep_all = TRUE)
library(tidyverse)
g.spid <- left_join(blast, cdsftab, by = "V1") %>%
mutate(gene = str_extract(V2.y, "(?<=\\[gene=)\\w+")) %>%
select(gene, V11, V2.x) %>%
mutate(SPID = str_extract(V2.x, "(?<=\\|)[^\\|]*(?=\\|)")) %>%
distinct(gene, SPID, .keep_all = TRUE)
View(g.spid)
reticulate::repl_python()
reticulate::repl_python()
reticulate::repl_python()
reticulate::py_last_error()
View(g.spid)
reticulate::repl_python()
library(tidyverse)
library(reticulate)
knitr::opts_chunk$set(engine.path = '/usr/bin/python3')
reticulate::repl_python()
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
reticulate::repl_python()
reticulate::repl_python()
reticulate::repl_python()
knitr::opts_chunk$set(engine.path = '/usr/bin/python3')
reticulate::repl_python()
knitr::opts_chunk$set(engine.path = '/usr/bin/python3')
reticulate::repl_python()
reticulate::repl_python()
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
python DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py #DRAFT_Funct_Enrich/annot/SPID.txt
getwd
getwd()
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
python DRAFT_Funct_Enrich/annot/uniprot-retrieval.py
reticulate::repl_python()
reticulate::repl_python()
getwd()
getwd()
library(tidyverse)
library(reticulate)
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
`DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt`
knitr::opts_chunk$set(engine.path = '/usr/bin/python3')
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
reticulate::repl_python()
reticulate::py_last_error()
reticulate::repl_python()
knitr::opts_chunk$set(engine.path = '/usr/bin/python3')
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
python DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
library(tidyverse)
library(reticulate)
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
reticulate::source_python('/home/shared/8TB_HDD_01/sr320/github/marineomics.github.io/DRAFT_Funct_Enrich/annot/uniprot-retrieval.py')
reticulate::repl_python()
import gzip
import gzip
import gzip
reticulate::repl_python()
DRAFT_Funct_Enrich/annot/uniprot-retrieval.py DRAFT_Funct_Enrich/annot/SPID.txt
reticulate::repl_python()
reticulate::repl_python()
install.packages("reticulate")
?include_graphics
R.Version()