Skip to content

Commit 580853c

Browse files
committed
Updates to native pipe
1 parent 909c535 commit 580853c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+532
-530
lines changed

DESCRIPTION

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: FacileAnalysis
22
Type: Package
33
Title: Modularized and interactive analyses over a FacileDataStore
4-
Version: 0.98.16
4+
Version: 0.98.17
55
Authors@R: c(
66
person(
77
"Steve", "Lianoglou",
@@ -22,15 +22,15 @@ Description: Provides modularized analysis methods commonly performed over
2222
URL: https://github.com/facilebio/FacileAnalysis
2323
BugReports: https://github.com/facilebio/FacileAnalysis/issues
2424
Depends:
25-
R (>= 3.6)
25+
R (>= 4.2.0)
2626
Imports:
2727
broom,
2828
checkmate,
2929
crosstalk,
3030
dplyr,
3131
DT,
3232
edgeR,
33-
FacileData (>= 0.98.0),
33+
FacileData (>= 0.98.5),
3434
FacileShine (>= 0.98.0),
3535
FacileViz (>= 0.98.0),
3636
ggplot2,
@@ -42,6 +42,7 @@ Imports:
4242
miniUI,
4343
sparrow (>= 0.98.5),
4444
sparrow.shiny,
45+
statmod (>= 1.5.0),
4546
plotly (>= 4.9.0),
4647
shiny (>= 1.3.1),
4748
shinycssloaders,
@@ -53,6 +54,7 @@ Imports:
5354
tidyr
5455
Suggests:
5556
airway,
57+
BiasedUrn,
5658
curl,
5759
DESeq2,
5860
FacileBiocData,
@@ -88,7 +90,7 @@ License: Apache License (>= 2.0)
8890
Encoding: UTF-8
8991
LazyData: true
9092
Roxygen: list(markdown = TRUE)
91-
RoxygenNote: 7.1.2
93+
RoxygenNote: 7.2.3
9294
Collate:
9395
'api.R'
9496
'biocbox.R'

NAMESPACE

-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ S3method(viz,FacileGadgetResult)
151151
S3method(viz,FacilePcaAnalysisResult)
152152
S3method(viz,FacileTtestAnalysisResult)
153153
S3method(viz,FacileTtestComparisonAnalysisResult)
154-
export("%>%")
155154
export(annotation)
156155
export(callModule)
157156
export(comparable)
@@ -226,7 +225,6 @@ importFrom(DT,datatable)
226225
importFrom(DT,formatRound)
227226
importFrom(DT,renderDT)
228227
importFrom(DT,replaceData)
229-
importFrom(FacileData,"%>%")
230228
importFrom(FacileShine,ReactiveFacileDataStore)
231229
importFrom(FacileShine,active_samples)
232230
importFrom(FacileShine,annotation)

R/api.R

+13-13
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ param.BiocBox <- function(x, name = NULL, ...) {
320320
#' the genes under test.
321321
#'
322322
#' ```
323-
#' dge <- FacileData::exampleFacileDataSet() %>%
324-
#' FacileData::filter_samples(indication == "BLCA") %>%
323+
#' dge <- FacileData::exampleFacileDataSet() |>
324+
#' FacileData::filter_samples(indication == "BLCA") |>
325325
#' flm_def(covariate = "sample_type",numer = "tumor", denom = "normal",
326-
#' batch = "sex") %>%
326+
#' batch = "sex") |>
327327
#' fdge()
328328
#' ```
329329
#'
@@ -387,23 +387,23 @@ ranks <- function(x, ...) {
387387
#' result.
388388
#'
389389
#' ```r
390-
#' sigs1 <- FacileData::exampleFacileDataSet() %>%
391-
#' FacileData::filter_samples(indication == "CRC") %>%
392-
#' fpca() %>%
390+
#' sigs1 <- FacileData::exampleFacileDataSet() |>
391+
#' FacileData::filter_samples(indication == "CRC") |>
392+
#' fpca() |>
393393
#' signature()
394-
#' sigs2 <- FacileData::exampleFacileDataSet() %>%
395-
#' FacileData::filter_samples(indication == "CRC") %>%
396-
#' fpca() %>%
397-
#' ranks() %>%
394+
#' sigs2 <- FacileData::exampleFacileDataSet() |>
395+
#' FacileData::filter_samples(indication == "CRC") |>
396+
#' fpca() |>
397+
#' ranks() |>
398398
#' signature()
399399
#' ```
400400
#'
401401
#' @export
402402
#' @param x A `FacileAnalysisResult`.
403403
#' @examples
404-
#' pca.sigs <- FacileData::exampleFacileDataSet() %>%
405-
#' FacileData::filter_samples(indication == "CRC") %>%
406-
#' fpca() %>%
404+
#' pca.sigs <- FacileData::exampleFacileDataSet() |>
405+
#' FacileData::filter_samples(indication == "CRC") |>
406+
#' fpca() |>
407407
#' signature()
408408
signature <- function(x, ...) {
409409
UseMethod("signature", x)

R/fdge-compare.R

+15-15
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@ NULL
2222
#' # Let's compare the tumor vs normal DGE results in CRC vs BLCA
2323
#'
2424
#' efds <- FacileData::exampleFacileDataSet()
25-
#' dge.crc <- FacileData::filter_samples(efds, indication == "CRC") %>%
26-
#' flm_def("sample_type", "tumor", "normal", "sex") %>%
25+
#' dge.crc <- FacileData::filter_samples(efds, indication == "CRC") |>
26+
#' flm_def("sample_type", "tumor", "normal", "sex") |>
2727
#' fdge()
28-
#' dge.blca <- FacileData::filter_samples(efds, indication == "BLCA") %>%
29-
#' flm_def("sample_type", "tumor", "normal", "sex") %>%
28+
#' dge.blca <- FacileData::filter_samples(efds, indication == "BLCA") |>
29+
#' flm_def("sample_type", "tumor", "normal", "sex") |>
3030
#' fdge()
3131
#' dge.comp <- compare(dge.crc, dge.blca)
32-
#' comp.hi <- tidy(dge.comp) %>%
33-
#' dplyr::group_by(interaction_group) %>%
34-
#' dplyr::slice(1:3) %>%
32+
#' comp.hi <- tidy(dge.comp) |>
33+
#' dplyr::group_by(interaction_group) |>
34+
#' dplyr::slice(1:3) |>
3535
#' dplyr::ungroup()
3636
#' # Static visualization generates the main "4-way" plot, as well as the
3737
#' # facets for each category.
3838
#' sviz <- viz(dge.comp, labels = c(x = "CRC", y = "BLCA"),
3939
#' subtitle = "Tumor vs normal comparisons across indications",
4040
#' highlight = comp.hi)
4141
#' # highlight some of them
42-
#' s.hi <- sviz$input_data %>%
43-
#' dplyr::group_by(interaction_group) %>%
44-
#' dplyr::slice(1:3) %>%
42+
#' s.hi <- sviz$input_data |>
43+
#' dplyr::group_by(interaction_group) |>
44+
#' dplyr::slice(1:3) |>
4545
#' dplyr::ungroup()
4646
#' if (requireNamespace("patchwork")) {
4747
#' patchwork::wrap_plots(
@@ -131,7 +131,7 @@ compare.FacileTtestAnalysisResult <- function(x, y,
131131
by = c("feature_type", "feature_id"))
132132

133133
if (isTRUE(idge[["with_stats"]])) {
134-
ires <- tidy(idge[["result"]]) %>%
134+
ires <- tidy(idge[["result"]]) |>
135135
select(feature_type, feature_id, {{stat.cols}})
136136
} else {
137137
ires <- idge[["result"]]
@@ -232,7 +232,7 @@ tidy.FacileTtestComparisonAnalysisResult <- function(
232232
.xsig & .ysig ~ labels["both"],
233233
.xsig & !.ysig ~ labels["x"],
234234
!.xsig & .ysig ~ labels["y"],
235-
TRUE ~ labels["none"])) %>%
235+
TRUE ~ labels["none"])) |>
236236
select(interaction_group, everything())
237237
attr(out, "labels") <- labels
238238
out
@@ -329,7 +329,7 @@ viz.FacileTtestComparisonAnalysisResult <- function(
329329
xdat$padj.min <- pmin(xdat$padj, xdat$padj.x, xdat$padj.y)
330330
xdat <- arrange(xdat, interaction_group, desc(padj.min))
331331

332-
gg.base <- xdat %>%
332+
gg.base <- xdat |>
333333
ggplot2::ggplot(ggplot2::aes(x = logFC.x, y = logFC.y)) +
334334
ggplot2::geom_hline(yintercept = 0, color = "red", linetype = "dashed") +
335335
ggplot2::geom_vline(xintercept = 0, color = "red", linetype = "dashed")
@@ -433,8 +433,8 @@ viz.FacileTtestComparisonAnalysisResult <- function(
433433

434434
# Calculate estimated logFC's between the *.x and *.y logFC in case we don't
435435
# make it all the way through the formal interaction analysis
436-
ires.tmp <- xres %>%
437-
full_join(yres, by = c("feature_id", "feature_type", "name")) %>%
436+
ires.tmp <- xres |>
437+
full_join(yres, by = c("feature_id", "feature_type", "name")) |>
438438
transmute(feature_id, feature_type, name, logFC = logFC.x - logFC.y,
439439
pval = NA_real_, padj = NA_real_)
440440

R/fdge-interact.R

+14-14
Original file line numberDiff line numberDiff line change
@@ -467,24 +467,24 @@ report.FacileTtestAnalysisResult <- function(x, type = c("dge", "features"),
467467
ntop <- ntop
468468
}
469469

470-
dat.all <- tidy(x) %>%
470+
dat.all <- tidy(x) |>
471471
select(symbol, feature_id, logFC, padj, pval)
472472

473-
dat.sig <- dat.all %>%
473+
dat.sig <- dat.all |>
474474
filter(
475475
(abs(logFC) >= min_logFC & padj <= max_padj) |
476476
feature_id %in% highlight)
477477

478-
dat.up <- dat.sig %>%
479-
arrange(desc(logFC)) %>%
478+
dat.up <- dat.sig |>
479+
arrange(desc(logFC)) |>
480480
head(ntop / 2)
481-
dat.down <- dat.sig %>%
482-
arrange(logFC) %>%
481+
dat.down <- dat.sig |>
482+
arrange(logFC) |>
483483
head(ntop / 2)
484484

485-
dat <- dat.up %>%
486-
bind_rows(dat.down) %>%
487-
rename(FDR = padj) %>%
485+
dat <- dat.up |>
486+
bind_rows(dat.down) |>
487+
rename(FDR = padj) |>
488488
distinct(feature_id, .keep_all = TRUE)
489489

490490
# Add link for gene and axe feature_id
@@ -511,7 +511,7 @@ report.FacileTtestAnalysisResult <- function(x, type = c("dge", "features"),
511511
# Generate volcano given the filtered data
512512
yaxis <- list(range = c(0, max(-log10(dat$pval)) + 0.1))
513513
xaxis <- list(range = (max(abs(dat$logFC)) + 0.2) * c(-1, 1))
514-
p <- sdat %>%
514+
p <- sdat |>
515515
plot_ly(x = ~logFC, y = ~-log10(pval),
516516
type = "scatter", mode = "markers",
517517
hoverinfo = "text",
@@ -529,9 +529,9 @@ report.FacileTtestAnalysisResult <- function(x, type = c("dge", "features"),
529529
"Symbol: ", symbol, "<br>",
530530
sprintf(paste0("logFC: %.", round_digits, "f<br>"), logFC),
531531
sprintf(paste0("FDR: %.", round_digits, "f<br>"), FDR),
532-
sprintf(paste0("pvalue: %.", round_digits, "f<br>"), pval))) %>%
532+
sprintf(paste0("pvalue: %.", round_digits, "f<br>"), pval))) |>
533533
layout(yaxis = yaxis, xaxis = xaxis, dragmode = "select",
534-
showlegend = FALSE) %>%
534+
showlegend = FALSE) |>
535535
config(displaylogo = FALSE)
536536

537537
if (webgl) p <- toWebGL(p)
@@ -541,11 +541,11 @@ report.FacileTtestAnalysisResult <- function(x, type = c("dge", "features"),
541541
if (isTRUE(all.equal(dat$symbol, dat$feature_id))) {
542542
noshow <- c(noshow, "symbol")
543543
}
544-
dtable <- sdat %>%
544+
dtable <- sdat |>
545545
datatable(filter = "top", extensions = "Scroller", style = "bootstrap",
546546
class = "compact", width = "100%", rownames = FALSE,
547547
options = dtopts, escape = !link_feature,
548-
colnames = setdiff(colnames(dat), noshow)) %>%
548+
colnames = setdiff(colnames(dat), noshow)) |>
549549
formatRound(c("logFC", "FDR", "pval"), round_digits)
550550

551551
# Title

R/fdge-shiny-runOptions.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ fdgeRunOptions <- function(input, output, session, rfds, model, assay, ...) {
6464
method. <- req(dge_method(), !unselected(dge_method()))
6565
ainfo <- req(assay$assay_info())
6666
atype <- req(ainfo$assay_type, !unselected(ainfo$assay_type))
67-
fdge_methods() %>%
68-
filter(.data$assay_type == .env$atype, .data$dge_method == .env$method.) %>%
69-
pull(can_sample_weight) %>%
67+
fdge_methods() |>
68+
filter(.data$assay_type == .env$atype, .data$dge_method == .env$method.) |>
69+
pull(can_sample_weight) |>
7070
isTRUE()
7171
})
7272

R/fdge-shiny.R

+13-13
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ NULL
3131
#' # run tumor vs normal comparisons vs each, then run compare() on the results
3232
#' options(facile.log.level.fshine = "trace")
3333
#' efds <- FacileData::exampleFacileDataSet()
34-
#' dge.crc <- efds %>%
35-
#' FacileData::filter_samples(indication == "CRC") %>%
34+
#' dge.crc <- efds |>
35+
#' FacileData::filter_samples(indication == "CRC") |>
3636
#' fdgeGadget(viewer = "pane")
37-
#' dge.blca <- efds %>%
38-
#' FacileData::filter_samples(indication == "BLCA") %>%
37+
#' dge.blca <- efds |>
38+
#' FacileData::filter_samples(indication == "BLCA") |>
3939
#' fdgeGadget(viewer = "pane")
4040
#' dge.comp <- compare(dge.crc, dge.blca)
4141
#'
@@ -441,9 +441,9 @@ fdgeView <- function(input, output, session, rfds, dgeres, ...,
441441
paste0(name, ".csv")
442442
},
443443
content = function(file) {
444-
dat <- req(featureviz()) %>%
445-
FacileViz::input_data() %>%
446-
select(dataset, sample_id, feature_id, feature_name, value) %>%
444+
dat <- req(featureviz()) |>
445+
FacileViz::input_data() |>
446+
select(dataset, sample_id, feature_id, feature_name, value) |>
447447
with_sample_covariates()
448448
write.csv(dat, file, row.names = FALSE)
449449
}
@@ -457,9 +457,9 @@ fdgeView <- function(input, output, session, rfds, dgeres, ...,
457457
if (is.null(selected)) {
458458
selected <- tibble(dataset = character(), sample_id = character())
459459
} else {
460-
selected <- featureviz() %>%
461-
input_data() %>%
462-
slice(as.integer(selected$key)) %>%
460+
selected <- featureviz() |>
461+
input_data() |>
462+
slice(as.integer(selected$key)) |>
463463
select(dataset, sample_id)
464464
}
465465
current <- paste(state$boxplot_select$dataset,
@@ -482,7 +482,7 @@ fdgeView <- function(input, output, session, rfds, dgeres, ...,
482482
},
483483
content = function(file) {
484484
.fdge <- req(isolate(dge()))
485-
# .result <- ranks(.fdge) %>% result()
485+
# .result <- ranks(.fdge) |> result()
486486
.result <- req(dge.stats())
487487
if ("padj" %in% colnames(.result)) {
488488
.result <- rename(.result, FDR = "padj")
@@ -512,13 +512,13 @@ fdgeView <- function(input, output, session, rfds, dgeres, ...,
512512
pageLength = 15,
513513
lengthMenu = c(15, 30, 50))
514514

515-
dtable <- dat %>%
515+
dtable <- dat |>
516516
datatable(filter = "top",
517517
# extensions = "Scroller",
518518
style = "bootstrap",
519519
class = "display", width = "100%", rownames = FALSE,
520520
selection = list(mode = "single", selected = 1, target = "row"),
521-
options = dtopts) %>%
521+
options = dtopts) |>
522522
formatRound(num.cols, 3)
523523
dtable
524524
}, server = TRUE)

0 commit comments

Comments
 (0)