Repository navigation
Expand file tree
/
Copy pathdevelopment_status.Rmd
More file actions
215 lines (187 loc) · 5.94 KB
/
Copy pathdevelopment_status.Rmd
File metadata and controls
215 lines (187 loc) · 5.94 KB
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
---
title: Development status
package: anndataR
output: BiocStyle::html_document
vignette: >
%\VignetteIndexEntry{Development status}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
# Introduction
This vignette provides an overview of the current development status of the `r Biocpkg("anndataR")` package.
It provides details on the current implementation of different features as well as listing known issues.
```{r impl-table, include=FALSE}
library(tibble)
library(knitr)
library(rprojroot)
library(stringr)
library(purrr)
library(dplyr)
library(tidyr)
proj_root <- find_root(has_file("DESCRIPTION"))
source <- list.files(proj_root, pattern = "*.R$", recursive = TRUE)
# look for trackstatus comments
status_lines <- map_df(source, function(path) {
lines <- readLines(paste0(proj_root, "/", path))
line_numbers <- grep("# trackstatus:", lines, fixed = TRUE)
map_df(line_numbers, function(line_number) {
tryCatch(
{
line_stripped <- gsub(" *# trackstatus: *", "", lines[[line_number]])
line_split <- str_split_1(line_stripped, ", *")
vals_split <- str_split(line_split, " *= *")
names <- vapply(vals_split, function(x) x[[1]], character(1))
values <- lapply(vals_split, function(x) x[[2]])
df <- data.frame(setNames(values, names), check.names = FALSE)
df$source_file <- path
df$line_number <- line_number
df
},
error = function(e) {
message("Error in ", path, " at line ", line_number, ": ", e$message)
NULL
}
)
})
})
# split feature id into prefix and slot columns
strip_prefix <- c(
"get_" = "Getter",
"test_get_" = "Getter test",
"set_" = "Setter",
"test_set_" = "Setter test"
)
status_lines_proc <- status_lines |>
mutate(
prefix = str_extract(feature, "^(test_)?[gs]et_"),
slot = str_replace(feature, "^(test_)?[gs]et_", "")
) |>
select(-feature)
# combine with missing fields
status_lines_required <- crossing(
class = c("InMemoryAnnData", "HDF5AnnData", "ZarrAnnData", "Seurat", "SingleCellExperiment"),
prefix = c("get_", "test_get_", "set_", "test_set_"),
slot = c(
"X",
"layers",
"obs",
"var",
"obs_names",
"var_names",
"obsm",
"varm",
"obsp",
"varp",
"uns",
"raw"
),
status = "missing"
)
status_required <- bind_rows(
status_lines_proc,
anti_join(
status_lines_required,
status_lines_proc,
by = c("class", "prefix", "slot")
)
)
# Fill in non-required slots
status <- status_required |>
group_by(class) |>
complete(prefix, slot, fill = list(status = "missing")) |>
ungroup()
# check duplicated status
status_dup <- status |>
group_by(class, prefix, slot) |>
filter(n() > 1) |>
ungroup() |>
mutate(
str = paste0(
source_file, "#", line_number, " -- ", class, " ", prefix, slot
)
)
if (nrow(status_dup) > 0) {
stop(
"Duplicated status lines found:\n", paste(status_dup$str, collapse = "\n")
)
}
# create formatted data frame for printing
status_formatted <- status |>
mutate(
prefix_formatted = strip_prefix[prefix],
status_formatted = ifelse(
status == "missing",
"",
paste0(
"[", c("done" = "✅", "wip" = "🚧", "missing" = "")[status],
"](https://github.com/scverse/anndataR/blob/main/", source_file,
"#L", line_number, ")"
)
)
) |>
select(class, Slot = slot, prefix_formatted, status_formatted) |>
spread(prefix_formatted, status_formatted)
```
# Objects
These tables show the status of the implementation of different `AnnData` back ends.
```{r impl-table-objects, echo=FALSE, results="asis"}
# loop over each of the classes and print the table as markdown
all_classes <- unique(status_formatted$class)
object_classes <- all_classes[!all_classes %in% c("Seurat", "SingleCellExperiment")]
for (class_name in object_classes) {
cat("## `", class_name, "`\n\n", sep = "")
df <- status_formatted |>
filter(class == class_name) |>
select(-class) |>
knitr::kable(escape = FALSE, align = "lcccc")
cat(paste(as.character(df), collapse = "\n"))
cat("\n\n")
}
```
# Conversion
These tables show the implementation status of conversion between `AnnData` and other objects.
```{r impl-table-conversion, echo=FALSE, results="asis"}
# loop over each of the classes and print the table as markdown
for (class_name in c("SingleCellExperiment", "Seurat")) {
cat("## `", class_name, "`\n\n", sep = "")
df <- status_formatted |>
filter(class == class_name) |>
select(
Slot,
From = Setter,
`From test` = `Setter test`,
To = Getter,
`To test` = `Getter test`
) |>
knitr::kable(escape = FALSE, align = "lcccc")
cat(paste(as.character(df), collapse = "\n"))
cat("\n\n")
}
```
# Known issues
This section lists current known issues in `r Biocpkg("anndataR")`.
Only certain types of issues are listed here, for additional issues see the [GitHub issue tracker](https://github.com/scverse/anndataR/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen).
```{r known-issues, echo=FALSE, results="asis"}
known_issues_path <- system.file("known_issues.yaml", package = "anndataR")
data <- yaml::read_yaml(known_issues_path)$known_issues
for (i in seq_along(data)) {
str <- paste0(
"## Issue: ", data[[i]]$description, "\n\n",
" * Affected backend: ", paste0("`", data[[i]]$backend, "`", collapse = ", "), "\n",
" * Affected slot(s): ", paste0("`", data[[i]]$slot, "`", collapse = ", "), "\n",
" * Affected dtype(s): ", paste0("`", data[[i]]$dtype, "`", collapse = ", "), "\n",
" * Probable cause: ", data[[i]]$process, "\n",
" * To investigate: ", data[[i]]$to_investigate, "\n",
" * To fix: ", data[[i]]$to_fix, "\n\n",
"### Error message\n\n",
paste(paste0(" ", strsplit(data[[i]]$error_message, "\n", fixed = TRUE)[[1]], "\n"), collapse = ""), "\n\n",
"### Proposed solution\n\n",
data[[i]]$proposed_solution, "\n\n"
)
cat(str)
}
```
# Session info
```{r sessioninfo}
sessionInfo()
```