-
Notifications
You must be signed in to change notification settings - Fork 77
/
scrnatools
executable file
·149 lines (119 loc) · 3.12 KB
/
scrnatools
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
#!/usr/bin/env Rscript
################################################################################
# #
# scRNA-tools app #
# command line application for interacting with the scRNA-tools database #
# #
################################################################################
#### RENV ####
options("renv.verbose" = FALSE)
renv::restore()
#### DOCOPT ####
"
scRNA-tools command line application
Usage:
scrnatools add
scrnatools update [<name>]
scrnatools search [<name>]
scrnatools check [--all] [--links]
scrnatools build
scrnatools archive [<name>]
scrnatools restore [<arc>]
scrnatools stats [--plot]
scrnatools categories
scrnatools add_category
scrnatools -h | --help
scrnatools --version
Options:
name Name of a tool in the database
arc Name of an archive in the database
-a, --all Whether to check all repositories (not just new ones)
-l, --links Whether to check for preprint-publication links
-p, --plot Whether to show plots
-h --help Show this help message.
--version Show version.
" -> DOCOPT
#### PACKAGES ####
suppressPackageStartupMessages({
library(docopt)
})
#### SOURCE ####
source("app/logo.R")
source("app/ui.R")
source("app/sctool-class.R")
source("app/regex.R")
source("app/load.R")
source("app/add.R")
source("app/update.R")
source("app/check.R")
source("app/search.R")
source("app/build.R")
source("app/analysis.R")
source("app/pkgs-cache.R")
source("app/references.R")
source("app/archive.R")
source("app/categories.R")
source("app/save.R")
source("app/git.R")
source("app/github.R")
source("app/stats.R")
source("app/utils.R")
#### MAIN CODE ####
opts <- docopt(DOCOPT, version = "0.6.1")
logo <- get_logo()
cat(logo, "\n")
modifying <- any(c(
opts$add,
opts$update,
opts$check,
opts$build,
opts$archive,
opts$restore,
opts$add_category
))
if (modifying) {
check_status()
}
dir <- "database"
data_dir <- "docs/data"
plot_dir <- "docs/plots"
database <- load_database(dir)
if (any(c(opts$add, opts$update, opts$check))) {
pkgs_cache <- load_pkgs_cache(dir)
}
if (opts$add) {
database <- add_tool(database, pkgs_cache)
}
if (opts$update) {
database <- update_tool(database, pkgs_cache, opts$name)
}
if (opts$check) {
database <- check(database, pkgs_cache, dir, opts$all, opts$links)
}
if (opts$search) {
search(database, opts$name)
}
if (opts$build) {
database <- build(database, data_dir, plot_dir)
}
if (opts$archive) {
database <- archive_tool(database, dir, opts$name)
}
if (opts$restore) {
database <- restore_archive(database, dir, opts$arc)
}
if (opts$stats) {
show_stats(database, opts$plot)
}
if (opts$categories) {
show_categories(database)
}
if (opts$add_category) {
database <- add_category(database)
}
if (modifying) {
save_database(database, dir)
if (!opts$build) {
commit_database(dir)
}
}