-
Notifications
You must be signed in to change notification settings - Fork 48
/
README.Rmd
132 lines (116 loc) · 3.63 KB
/
README.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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
```{r gh.url, echo=FALSE}
ghurl <- function(x) {
x <- unlist(x = strsplit(x = x, split = ','))
x <- trimws(x = x)
x <- grep(pattern = "https://github.com", x = x, value = TRUE)[1]
return(unname(obj = x))
}
```
```{r cran.cannoncial, echo=FALSE}
cran.cannoncial <- "https://cran.r-project.org/package="
```
```{r parse.description, echo=FALSE}
description <- read.dcf(file = "DESCRIPTION")
# Get package name
pkg <- as.vector(x = description[, "Package"])
# Get GitHub URL
github.url <- ghurl(x = description[, "URL"])
# Get depedencies
deps <- as.vector(x = description[, c("Depends", "Imports")])
deps <- unlist(x = strsplit(x = deps, split = "\n"))
deps <- vapply(
X = deps,
FUN = function(x) {
return(unlist(x = strsplit(x = x, split = "(", fixed = TRUE))[1])
},
FUN.VALUE = character(length = 1L),
USE.NAMES = FALSE
)
deps <- trimws(x = deps)
deps <- gsub(pattern = ",$", replacement = "", x = deps)
deps <- deps[deps != "R"]
```
```{r parse.version, echo=FALSE}
pkg.version <- package_version(x = description[1, 'Version'])
stage <- if (pkg.version >= package_version(x = "1.0.0")) {
"stable"
} else if (pkg.version >= package_version(x = "0.1.0")) {
"maturing"
} else {
"experimental"
}
color <- c("experimental" = "orange", "maturing" = "blue", "stable" = "brightgreen")[stage]
```
# `r pkg` v`r pkg.version`
<!-- badges: start -->
[![CRAN/METACRAN](https://img.shields.io/cran/v/`r pkg`)](`r paste0(cran.cannoncial, pkg)`)
[![Lifecycle](https://img.shields.io/badge/lifecycle-`r stage`-`r color`.svg)](`r github.url`)
<!-- badges: end -->
<!-- Interfaces for HDF5-based Single Cell File Formats -->
```{r description, echo=FALSE, results='asis'}
cat(gsub(pattern = '\n', replacement = ' ', x = description[, "Description"]))
```
## Installation
`r pkg` is not currently available on CRAN.
You can install it from [GitHub](`r github.url`) with:
``` r
if (!requireNamespace("remotes", quietly = TRUE)) {
install.packages("remotes")
}
remotes::install_github("mojaveazure/seurat-disk")
```
## Dependencies
`r pkg` depends on the following non-standard packages:
| Package | CRAN Webpage | Source | Website |
|:-------:|:------------:|:------:|:-------:|
```{r dependencies, echo=FALSE, results='asis'}
cran.pkgs <- tools::CRAN_package_db()
cran.pkgs <- subset(x = cran.pkgs, subset = Package %in% deps)
deps.md <- vector(mode = "character", length = length(x = deps))
url.na <- "| –"
names(x = deps.md) <- deps
for (dep in deps) {
if (!dep %in% cran.pkgs$Package) {
# deps.md[[dep]] <- paste(
# "|",
# dep,
# paste(replicate(n = 3, expr = url.na), collapse = " "),
# "|"
# )
next
}
pkg.info <- subset(x = cran.pkgs, subset = Package == dep)[1, , drop = FALSE]
pkg.cran <- paste0("| [CRAN](", cran.cannoncial, dep, ")")
pkg.github <- ghurl(x = pkg.info$URL)
pkg.other <- ifelse(
test = is.na(x = pkg.github),
yes = pkg.info$URL,
no = gsub(pattern = pkg.github, replacement = "", x = pkg.info$URL)
)
pkg.other <- if (nchar(x = pkg.other)) {
pkg.other <- trimws(x = unlist(x = strsplit(x = pkg.other, split = ","))[1])
paste0("| [Website](", pkg.other, ")")
} else {
url.na
}
pkg.github <- if (is.na(x = pkg.github)) {
url.na
} else {
paste0("| [GitHub](", pkg.github, ")")
}
deps.md[[dep]] <- paste(dep, pkg.cran, pkg.github, pkg.other, "|")
}
cat("|", paste(Filter(f = nchar, x = deps.md), collapse = "\n"))
```