-
Notifications
You must be signed in to change notification settings - Fork 29
/
install.R
executable file
·135 lines (112 loc) · 5.1 KB
/
install.R
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
#!/usr/bin/env Rscript
# Author: Tim Sterne-Weiler, 2014
# Updates: Manuel Irimia, 2015-present
suppressPackageStartupMessages(require(optparse))
option_list <- list(
make_option(c("-p", "--prompt"), action="store_true", default=TRUE, type="logical", help="User prompt during installation [default %default]"),
make_option(c("-q", "--quiet"), action="store_false", dest="prompt", type="logical", help="Quiet installation, no prompt"),
make_option(c("-f", "--file"), action="store", default=".", type='character', help="From where to run install script")
)
opt <- parse_args(OptionParser(option_list=option_list))
scriptPath <- dirname( opt$file )
joinStr <- function(x,y) {
return(paste(c(as.character(x), as.character(y)), collapse=""))
}
writeLines(joinStr("Using ", R.Version()$version.string));
# Source Rlib.
source(paste(c(scriptPath,"/R/Rlib/include.R"), collapse=""))
downloadDb <- function(speUrl, speFile) {
system("mkdir -p VASTDB")
if(system(joinStr("wget ", speUrl)) > 0) {
stop(joinStr("Cannot download ", speUrl))
}
if(system(paste("tar xzvf ", speFile, " -C VASTDB")) > 0) {
stop(joinStr("Cannot tar xzvf ", speFile))
}
if(system(joinStr("rm ", speFile)) > 0) {
stop(joinStr("Cannot rm ", speFile))
}
}
### To be updated with every release:
vastdbFiles<-c(
"vastdb.hsa.23.06.20.tar.gz",
"vastdb.hs2.23.06.20.tar.gz",
"vastdb.mmu.23.06.20.tar.gz",
"vastdb.mm2.23.06.20.tar.gz",
"vastdb.rno.23.06.20.tar.gz",
"vastdb.bta.23.06.20.tar.gz",
"vastdb.gg3.23.06.20.tar.gz",
"vastdb.gg4.23.06.20.tar.gz",
"vastdb.xt1.23.06.20.tar.gz",
"vastdb.dre.23.06.20.tar.gz",
"vastdb.bl1.23.06.20.tar.gz",
"vastdb.spu.23.06.20.tar.gz",
"vastdb.dme.23.06.20.tar.gz",
"vastdb.sma.23.06.20.tar.gz",
"vastdb.cel.23.06.20.tar.gz",
"vastdb.sme.23.06.20.tar.gz",
"vastdb.nve.23.06.20.tar.gz",
"vastdb.ath.23.06.20.tar.gz");
if ( opt$prompt ) {
writeLines("Looking for VAST Database [VASTDB]")
auto <- "invalid"
if(!file.exists("VASTDB")) {
cat("Cannot find 'VASTDB'.. Do you want to download it? [y/n]: ")
auto <- readLines(file("stdin"),1)
close(file("stdin"))
}
if(file.exists("VASTDB")) {
cat("Found 'VASTDB'.. Do you want to download yet uninstalled datasets or update installed datasets? [y/n]: ")
auto <- readLines(file("stdin"),1)
close(file("stdin"))
}
if(as.character(auto) == 'y') {
cat("Please choose one or more (comma-separated) from:
1 - Homo sapiens (hg19, Hsa). Scaffold annotation: Ensembl v60.
2 - Homo sapiens (hg38, Hs2). Scaffold annotation: Ensembl v88.
3 - Mus musculus (mm9, Mmu). Scaffold annotation: Ensembl v62.
4 - Mus musculus (mm10, Mm2). Scaffold annotation: Ensembl v88.
5 - Rattus norvegicus (rn6, Rno). Scaffold annotation: Ensembl v93.
6 - Bos taurus (bosTau6, Bta). Scaffold annotation: Ensembl v76.
7 - Gallus gallus (galGal3, Gg3). Scaffold annotation: Ensembl v65.
8 - Gallus gallus (galGal4, Gg4). Scaffold annotation: Ensembl v83.
9 - Xenopus tropicalis (xenTro3, Xt1). JGI_4.2. Scaffold annotation: Ensembl v84.
10 - Danio rerio (danRer10, Dre). Zv10. Scaffold annotation: Ensembl v80.
11 - Branchiostoma lanceolatum (braLan2, Bl1). Bl71nemr. Scaffold annotation: Ensembl Metazoa v46.
12 - Strongylocentrotus purpuratus (strPur4, Spu). Spur3.1. Scaffold annotation: SpBase.
13 - Drosophila melanogaster (dm6, Dme). Scaffold annotation: Ensembl Metazoa v26.
14 - Strigamia maritima (strMar1, Sma). Smar1. Scaffold annotation: Ensembl Metazoa v26.
15 - Caenorhabditis elegans (ce11, Cel). Scaffold annotation: Ensembl v87.
16 - Schmidtea mediterranea (schMed31, Sme). v31. Scaffold annotation: Dresden transcriptome & transdecoder.
17 - Nematostella vectensis (nemVec1, Nve). ASM20922v1/GCA_000209225.1. Scaffold annotation: Ensembl Metazoa v36.
18 - Arabidopsis thaliana (araTha10, Ath). TAIR10. Scaffold annotation: Ensembl Plants v31.
")
db <- readLines(file("stdin"),1)
db <- as.character(db)
close(file("stdin"))
dbs<-as.numeric(strsplit(db,"\\s*,\\s*",perl=TRUE)[[1]])
for (db in dbs){
if (db<1 || db>length(vastdbFiles)) {stop("Input ",db," is out of range.")}
Url <- paste("https://vastdb.crg.eu/libs/", vastdbFiles[db], sep = "")
downloadDb(Url, vastdbFiles[db])
}
}
}
# custom install from include.R
loadPackages(c("MASS", "getopt", "optparse", "RColorBrewer", "reshape2", "ggplot2", "grid", "parallel", "devtools"), local.lib=paste(c(scriptPath,"/R/Rlib"), collapse=""))
# install github packages
if (!require('psiplot', character.only=T)) {
install_github('kcha/psiplot', lib=paste(c(scriptPath,"/R/Rlib"), collapse=""))
writeLines(sprintf("psiplot has been installed locally in R/Rlib!"), stderr())
}
if(Sys.chmod(paste(c(scriptPath, "/vast-tools"), collapse=""), mode = "755")) {
writeLines("Setting vast-tools permissions... success!", stderr());
}
if(system("which bowtie") > 0) {
stop("Cannot find 'bowtie' in path!!! Please install this properly (e.x. /usr/bin/ ) or supply -bowtieProg flag to vast-tools!");
} else {
writeLines("Found bowtie... Everything looks --OK");
}
q(status=0)