Skip to content

Commit

Permalink
Fixes #28 #29 and bump version from 0.10.1 to 0.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dweemx committed Nov 24, 2020
1 parent 917154c commit 73d0af1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: SCopeLoomR
Type: Package
Title: Build .loom files (compatible with SCope) and extract data from .loom files.
Version: 0.10.1
Version: 0.10.2
Author: dweemx
Maintainer: dweemx <mdewaegeneer@gmail.com>
Description: R package to build generic .loom files aligning with the default naming convention of the .loom format and
Expand Down
24 changes: 14 additions & 10 deletions R/loom.R
Original file line number Diff line number Diff line change
Expand Up @@ -3087,12 +3087,12 @@ get_cluster_info_by_cluster_name <- function(
get_clusterings <- function(
loom
) {
return (
get_col_attr_by_key(
loom = loom,
key = CA_CLUSTERINGS_NAME
)
clusterings <- get_col_attr_by_key(
loom = loom,
key = CA_CLUSTERINGS_NAME
)
row.names(x = clusterings) <- get_cell_ids(loom = loom)
return (clusterings)
}

#'@title get_global_md_clustering_by_id
Expand Down Expand Up @@ -3120,12 +3120,16 @@ get_clustering_by_id <- function(
get_clusterings_with_name <- function(
loom
){
md_clusterings <- get_global_meta_data(loom = loom)$clusterings
clustering_ids <- sapply(X = md_clusterings, FUN = function(x) { return (x$id)})
clusterings <- get_clusterings(loom = loom)
rownames(x = clusterings) <- get_cell_ids(loom = loom)
# Filter out clusterings not present in global metadata attribute
clusterings <- clusterings[, as.character(x = clustering_ids)]

for(i in seq_along(along.with = colnames(x = clusterings))){
for(clustering_id in clustering_ids){
md_clustering <- rlist::list.filter(.data = md_clusterings, id == clustering_id)[[1]]
cluster_levels <- sapply(
X = get_global_meta_data(loom = loom)$clusterings[[i]]$clusters,
X = md_clustering$clusters,
FUN = function(cluster) {
return (
setNames(
Expand All @@ -3135,8 +3139,8 @@ get_clusterings_with_name <- function(
)
}
)
clusterings[,i] <- factor(
x = clusterings[,i],
clusterings[, as.character(x = clustering_id)] <- factor(
x = clusterings[, as.character(x = clustering_id)],
levels = names(x = cluster_levels),
labels = cluster_levels
)
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SCopeLoomR v0.10.1
# SCopeLoomR v0.10.2
An R package (compatible with SCope) to create generic .loom files and extend them with other data e.g.: SCENIC regulons, Seurat clusters and markers, ... The package can also be used to read data from .loom files.

## Requirements
Expand Down Expand Up @@ -32,6 +32,12 @@ You can find a tutorial on how to create .loom files and read data from them in

## Version History

November 24, 2020

* Version 0.10.2
* Fix bug issue with `get_clusterings_with_name` and make it more robust: https://github.com/aertslab/SCopeLoomR/issues/29
* Add row.names when using `get_clusterings`: https://github.com/aertslab/SCopeLoomR/issues/28

October 02, 2020

* Version 0.10.1
Expand Down

0 comments on commit 73d0af1

Please sign in to comment.