Skip to content

Commit 3c45178

Browse files
committed
fix conflicts
1 parent 51600a1 commit 3c45178

File tree

2 files changed

+9
-75
lines changed

2 files changed

+9
-75
lines changed

R/utilities.R

Lines changed: 7 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -512,80 +512,14 @@ update_SE_from_tibble <- function(.data_mutated, se, column_belonging = NULL) {
512512
}
513513
)) %>%
514514

515-
# In case unitary SE subset does not work because all same
516-
data.frame(row.names = pull(.,f_(se)$symbol), check.names = FALSE) %>%
517-
select(-!!f_(se)$symbol) %>%
518-
DataFrame(check.names = FALSE)
519-
520-
# This to avoid the mismatch between missing row names for counts
521-
# and numerical row names for rowData
522-
row_names_row <-
523-
row_data %>%
524-
rownames() %>%
525-
when(
526-
rownames(se) %>% is.null ~ as.integer(.),
527-
~ (.)
528-
)
529-
530-
# Subset if needed. This function is used by many dplyr utilities
531-
se <- se[row_names_row, row_names_col]
532-
533-
# Update
534-
colData(se) <- col_data
535-
rowData(se) <- row_data
536-
537-
# Count-like data that is NOT in the assay slot already
538-
colnames_assay <-
539-
colnames(.data_mutated) %>%
540-
setdiff(c(f_(se)$name, s_(se)$name, colnames(as.data.frame(head(rowRanges(se), 1))) )) %>%
541-
setdiff(colnames(col_data)) %>%
542-
setdiff(colnames(row_data)) %>%
543-
setdiff(assays(se) %>% names)
544-
545-
if (length(colnames_assay) > 0)
546-
assays(se) = #, withDimnames=FALSE) =
547-
assays(se, withDimnames = FALSE) %>% c(
548-
.data_mutated %>%
549-
550-
# Select assays column
551-
select(!!f_(se)$symbol, !!s_(se)$symbol, colnames_assay) %>%
552-
553-
# Pivot for generalising to many assays
554-
pivot_longer(cols = -c(!!s_(se)$symbol, !!f_(se)$symbol)) %>%
555-
nest(data___ = c(!!s_(se)$symbol, !!f_(se)$symbol, .data$value)) %>%
556-
557-
# Convert to matrix and to named list
558-
mutate(data___ = map2(
559-
.data$data___, .data$name,
560-
~ {
561-
.x =
562-
.x %>%
563-
spread(!!s_(se)$symbol, value) %>%
564-
as_matrix(rownames = !!f_(se)$symbol) %>%
565-
suppressWarnings()
566-
567-
# Rearrange if assays has colnames and rownames
568-
if(!is.null(rownames(se)) & !is.null(rownames(.x))) .x = .x[rownames(se),,drop=FALSE]
569-
if(!is.null(colnames(se)) & !is.null(colnames(.x))) .x = .x[,colnames(se),drop=FALSE]
570-
571-
572-
.x %>%
573-
574-
list() %>%
575-
setNames(.y)
576-
}
577-
)) %>%
578-
579-
# Create correct list
580-
pull(.data$data___) %>%
581-
reduce(c)
582-
)
583-
584-
# return
585-
se
586-
515+
# Create correct list
516+
pull(data___) %>%
517+
reduce(c)
518+
)
519+
520+
# return
521+
se
587522
}
588-
589523
#' @importFrom methods is
590524
slice_optimised <- function(.data, ..., .preserve=FALSE) {
591525

man/slice.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)