Skip to content
This repository was archived by the owner on Dec 30, 2024. It is now read-only.

Commit

Permalink
Fix: more of the same
Browse files Browse the repository at this point in the history
  • Loading branch information
milescsmith committed Aug 12, 2021
1 parent 4ae1279 commit cb0f3a8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 24 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
46 changes: 25 additions & 21 deletions R/paga.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -261,7 +261,7 @@ PAGA <-
converted_object$uns[["paga"]]$pos
),
.name_repair = ~make.names(c("group","x", "y"))
) |>
) %>%
dplyr::mutate(
dplyr::across(
x:y,
Expand All @@ -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_",
Expand Down Expand Up @@ -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,
Expand All @@ -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()
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "BSD-3"
Expand Down

0 comments on commit cb0f3a8

Please sign in to comment.