From cb0f3a8405f847506d49252c2fa00bd4715bc242 Mon Sep 17 00:00:00 2001 From: Miles Smith Date: Thu, 12 Aug 2021 11:58:27 -0500 Subject: [PATCH] Fix: more of the same --- CHANGELOG.md | 5 ++++- DESCRIPTION | 2 +- NAMESPACE | 1 + R/paga.R | 46 +++++++++++++++++++++++++--------------------- pyproject.toml | 2 +- 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7a248e..22daacc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.5.3] - 2021-08-12 +### Fixed + - More missing imports and namespace specification + ## [2.5.2] - 2021-08-12 ### Fixed - Missing imports and namespace specification - ## [2.5.1] - 2021-08-12 ### Fixed - Fixed a typo diff --git a/DESCRIPTION b/DESCRIPTION index 6465372..3649728 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ReductionWrappers Title: Wrapper exposing several Python dimensional reduction tools -Version: 2.5.2 +Version: 2.5.3 Authors@R: person(given = "Miles", family = "Smith", diff --git a/NAMESPACE b/NAMESPACE index 77a533b..bee2110 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -30,6 +30,7 @@ importFrom(SingleCellExperiment,reducedDimNames) importFrom(SummarizedExperiment,"colData<-") importFrom(SummarizedExperiment,colData) importFrom(dplyr,across) +importFrom(dplyr,filter) importFrom(dplyr,mutate) importFrom(ggplot2,aes) importFrom(ggplot2,geom_point) diff --git a/R/paga.R b/R/paga.R index 1da444d..64266f1 100644 --- a/R/paga.R +++ b/R/paga.R @@ -61,7 +61,7 @@ #' @importFrom Seurat DietSeurat Idents<- DefaultAssay CreateDimReducObject #' @importFrom magrittr set_rownames set_colnames #' @importFrom rlang %||% -#' @importFrom dplyr mutate across +#' @importFrom dplyr mutate across filter #' @importFrom tibble as_tibble tibble #' #' @examples @@ -247,8 +247,8 @@ PAGA <- ) paga <- list( - connectivities = converted_object$uns[["paga"]]$connectivities$todense() |> - magrittr::set_rownames(levels(converted_object$obs[[converted_object$uns[["paga"]]$groups]])) |> + connectivities = converted_object$uns[["paga"]]$connectivities$todense() %>% + magrittr::set_rownames(levels(converted_object$obs[[converted_object$uns[["paga"]]$groups]])) %>% magrittr::set_colnames(levels(converted_object$obs[[converted_object$uns[["paga"]]$groups]])), connectivities_tree = converted_object$uns[["paga"]]$connectivities_tree$todense(), group_name = converted_object$uns[["paga"]]$groups, @@ -261,7 +261,7 @@ PAGA <- converted_object$uns[["paga"]]$pos ), .name_repair = ~make.names(c("group","x", "y")) - ) |> + ) %>% dplyr::mutate( dplyr::across( x:y, @@ -283,19 +283,19 @@ PAGA <- paga$edges <- tibble::tibble( group1 = paga$groups[row(paga$connectivities)[upper.tri(paga$connectivities)]], group2 = paga$groups[col(paga$connectivities)[upper.tri(paga$connectivities)]], - weight = paga$connectivities[upper.tri(paga$connectivities)] |> as.numeric() - ) |> - dplyr::mutate( - x1 = paga$position$x[match(.$group1, rownames(paga$position))] |> as.numeric(), - y1 = paga$position$y[match(.$group1, rownames(paga$position))] |> as.numeric(), - x2 = paga$position$x[match(.$group2, rownames(paga$position))] |> as.numeric(), - y2 = paga$position$y[match(.$group2, rownames(paga$position))] |> as.numeric() - ) |> - filter(weight >= edge_filter_weight) + weight = paga$connectivities[upper.tri(paga$connectivities)] %>% as.numeric() + ) %>% + dplyr::mutate( + x1 = paga$position$x[match(.$group1, rownames(paga$position))] %>% as.numeric(), + y1 = paga$position$y[match(.$group1, rownames(paga$position))] %>% as.numeric(), + x2 = paga$position$x[match(.$group2, rownames(paga$position))] %>% as.numeric(), + y2 = paga$position$y[match(.$group2, rownames(paga$position))] %>% as.numeric() + ) %>% + dplyr::filter(weight >= edge_filter_weight) paga_umap <- Seurat::CreateDimReducObject( - embeddings = converted_object$obsm[['X_umap']] |> - magrittr::set_rownames(colnames(object[[assay]])) |> + embeddings = converted_object$obsm[['X_umap']] %>% + magrittr::set_rownames(colnames(object[[assay]])) %>% magrittr::set_colnames( paste0( "UMAP_", @@ -337,7 +337,7 @@ PAGAplot <- object, edge_scale_weight = 0.2 ){ - object@misc$paga$position |> + object@misc$paga$position %>% ggplot2::ggplot(aes(x, y)) + ggplot2::geom_segment( data = object@misc$paga$edges, @@ -357,10 +357,14 @@ PAGAplot <- alpha = 1, show.legend = FALSE) + ggplot2::scale_color_brewer() + - ggplot2::geom_text(ggplot2::aes(label = group), - color = "black", - fontface = "bold") + - ggplot2::labs(x = "UMAP_1", - y = "UMAP_2") + + ggplot2::geom_text( + ggplot2::aes(label = group), + color = "black", + fontface = "bold" + ) + + ggplot2::labs( + x = "UMAP_1", + y = "UMAP_2" + ) + ggpubr::theme_pubr() } diff --git a/pyproject.toml b/pyproject.toml index a524ab6..80c5221 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "reductionwrappers" -version = "2.5.2" +version = "2.5.3" description = "companion Python installer for R package {ReductionWrappers}" authors = ["Miles Smith "] license = "BSD-3"