-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.Rhistory
executable file
·217 lines (217 loc) · 7.51 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
#' @param start
#' @param end
#' @param accession
#' @param muttype
#' @param ...
#'
#' @return
#' @export
#'
#' @examples
extractsnp <- function(chr = "A10", start = 14990000, end = 15010000, accession = NULL, muttype = NULL, maf = 0.05, ...) {
if (is.null(chr)) {
return(NULL)
} else {
chr.size <- chrinfo$size[chrinfo$chr == chr]
start <- max(0, start)
end <- min(end, chr.size)
start <- as.numeric(start)
end <- as.numeric(end)
input.reg <- IRanges(start, end)
snp.chr <- snp.list[snp.list$chr == chr, ]
snp.reg <- IRanges(start = snp.chr$start, end = snp.chr$end)
snp.file <- snp.chr$file[unique(queryHits(findOverlaps(snp.reg, input.reg)))]
snp.file.list <- lapply(snp.file, function(x) {
load(x)
return(snp.data.inter.Matrix)
})
snp.file.list <- unlist(snp.file.list, recursive = FALSE)
snp.data <- do.call(rbind, snp.file.list)
rownames(snp.data) <- str_sub(rownames(snp.data), start = 5)
get_snp <- snp.data[as.numeric(rownames(snp.data)) >= start & as.numeric(rownames(snp.data)) <= end, , drop = F]
# snp.pos <- as.numeric(rownames(get_snp))
rownames(get_snp) <- str_c(chr, rownames(get_snp), sep = "_")
if (!is.null(accession)) {
accession <- sapply(accession, function(x) {
if (x %in% c("Winter", "Semi-winter", "Spring", "Core")) {
var <- readLines(paste0("./data/Other_data/", x, ".var.txt"))
return(var)
} else {
return(x)
# message("Warnning!!! Please enter the right accession ...")
}
})
}
accession <- unique(unlist(accession))
if (!is.null(accession) && length(accession >= 2)) {
get_snp <- get_snp[, colnames(get_snp) %in% accession, drop = F]
}
eff.RData <- paste0("./data/SNP_data/", chr, ".snpeff.RData")
load(eff.RData)
if (!is.null(muttype) && length(muttype) >= 1 && length(muttype) != 12) {
snpeff.info <- snpeff[snpeff$eff %in% muttype, , drop = F]
get_snp <- get_snp[rownames(get_snp) %in% snpeff.info$id, , drop = F]
}
}
get_snp <- t(get_snp)
get_snp <- NAM::snpQC(gen = get_snp, MAF = maf, remove = T, impute = F)
get_snp <- t(get_snp)
snp.pos <- as.numeric(str_sub(rownames(get_snp), start = 5))
snp.allele <- snpeff[snpeff$id %in% rownames(get_snp), , drop = F]
allele <- as.matrix(get_snp)
snp.allele <- cbind(snp.allele, allele)
return(list(get_snp, snp.pos, snp.allele))
}
load("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/SNP_data/A10-13832787-17397690.snp.RData")
test <- extractsnp()
options(warn = -1)
library(shiny)
library(shinydisconnect)
library(ggplot2)
library(stringr)
library(dplyr)
library(tidyr)
library(forcats)
library(patchwork)
library(glue)
library(ggpubr)
library(writexl)
library(snpStats)
library(IRanges)
library(LDheatmap)
library(ape)
library(pegas)
library(gridExtra)
library(grid)
library(ggtree)
library(shinycssloaders)
library(shinysky)
library(shinydashboard)
library(shinyWidgets)
library(gggenes)
library(DT)
library(shinythemes)
library(NAM)
library(adegenet)
library(rmarkdown)
library(rvg)
library(officer)
source("script/mod_ldheatmap.R")
source("script/mod_snpdistribution.R")
source("script/mod_phylogenetics.R")
source("script/mod_diversity.R")
source("script/mod_extraction.R")
source("script/mod_documentation.R")
getwd()
setwd("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb")
source("script/mod_ldheatmap.R")
source("script/mod_snpdistribution.R")
source("script/mod_phylogenetics.R")
source("script/mod_diversity.R")
source("script/mod_extraction.R")
source("script/mod_documentation.R")
source("script/mod_about.R")
source("script/extractsnp.R")
source("script/extractallele.R")
source("script/ldheatmap.R")
source("script/genestru.viz.R")
source("script/chooser.R")
source("script/readNewData.R")
source("script/snp_distribution.R")
source("script/diversity.R")
source("script/box_format.R")
source("script/homepage.R")
source("script/geographic_map.R")
footerTagList <- list(
tags$footer(id = "myFooter",
shiny::includeHTML("www/md/footer.html")
)
)
gffinfo <- readRDS("./data/Other_data/gffinfo.rds")
load("./data/Other_data/geneinfo.RData")
load("./data/Other_data/Ref.gene.anno.RData")
chromosome <- c(
"A01", "A02", "A03", "A04", "A05", "A06", "A07", "A08", "A09", "A10",
"C01", "C02", "C03", "C04", "C05", "C06", "C07", "C08", "C09", "Ann", "Cnn"
)
chrinfo <- read.table("./data/Other_data/chrInfo.txt", header = T, as.is = T)
snp.list <- read.table("./data/Other_data/snp.RData.lst", header = T, as.is = T)
allele.list <- read.table("./data/Other_data/allele.RData.lst", header = T, as.is = T)
all.var <- read.table("data/Other_data/all.var.txt", header = F, as.is = T)
all.var.info <- as.character(all.var$V1)
all.var.info <- c("Winter", "Semi-winter", "Spring", "Core", all.var.info)
eff_type <- c(
"Downstream", "Intergenic", "Non_synonymous_coding", "Synonymous_coding",
"Intragenic", "Upstream", "Intron", "Splice_site_region", "Stop_lost",
"Stop_gained", "Synonymous_stop", "Start_lost"
)
database_type <- c("NR", "Swiss-prot", "KEGG", "eggNOG", "GO")
available_data_formats <- c("txt", "xlsx", "csv", "tsv")
available_fig_formats <- c("png", "pptx","pdf", "jpeg", "tiff", "bmp", "svg")
all.tree.info <- read.table("./data/Other_data/all.var.tree.info.txt", head = T, as.is = T, sep = "\t", row.names = 1)
sample_geographic_info <- readRDS("./data/Other_data/sample_map_info.rds")
test <- extractsnp()
View(test)
a <- test[[1]]
View(a)
a <- as.matrix(a)
b <- as.matrix(test[[2]])
b <- as.matrix(test[[3]])
View(b)
dim(b)
View(snp.data.inter.Matrix)
a <- as.matrix(snp.data.inter.Matrix)
dim(a)
rm(list=ls())
gc()
q()
getwd()
shiny::runApp()
load("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/SNP_data/A01-1-4084370.snp.RData")
t <- as.matrix(snp.data.inter.Matrix)
View(t)
load("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/Allele_data/A01-1-4084370.allele.RData")
load("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/Allele_data/A01-1-4084370.allele.RData")
t <- as.matrix(snp.data.inter.Matrix)
View(t)
load("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/SNP_data/A01-1-4084370.snp.RData")
t <- as.matrix(snp.data.inter.Matrix)
load("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/SNP_data/A01.snpeff.RData")
head(snpeff)
load("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/SNP_data/C04-1-4870210.snp.RData")
snp <- as.matrix(snp.data.inter.Matrix)
load("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/Allele_data/A01-4084371-9201974.allele.RData")
allele <- as.matrix(snp.data.inter.Matrix)
head(snp)
View(allele)
View(snp)
gffinfo <- readRDS("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/Other_data/gffinfo.rds")
View(gffinfo)
load("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/Other_data/Ref.gene.anno.RData")
View(darmor_gene_anno)
load("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/data/SNP_data/A01-1-4084370.snp.RData")
head(snp.data.inter.Matrix)
rm(list=ls())
gc()
q()
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/script/homepage.R")
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/global.R")
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/script/homepage.R")
runApp()
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/script/homepage.R")
runApp()
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/script/homepage.R")
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/script/homepage.R")
BiocManager::install(version = 3.08)
BiocManager::install(version = 3.18)
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/script/homepage.R")
shiny::runApp()
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/script/homepage.R")
runApp()
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/script/homepage.R")
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/script/homepage.R")
runApp()
source("F:/OneDrive - zju.edu.cn/share_in_os/bnasnpdb/script/homepage.R")
rm(list=ls())
rm(list=ls())
q()