Skip to content

Commit

Permalink
working on final issues of dplyr|igraph conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ncborcherding committed May 3, 2024
1 parent 8652001 commit 406c9f0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ importFrom(SummarizedExperiment,colData)
importFrom(VGAM,dpareto)
importFrom(cubature,adaptIntegrate)
importFrom(dplyr,"%>%")
importFrom(dplyr,across)
importFrom(dplyr,all_of)
importFrom(dplyr,arrange)
importFrom(dplyr,bind_rows)
importFrom(dplyr,coalesce)
importFrom(dplyr,count)
importFrom(dplyr,desc)
importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,left_join)
Expand Down
13 changes: 7 additions & 6 deletions R/clonalCluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#' @importFrom rlang %||%
#' @importFrom SummarizedExperiment colData<- colData
#' @importFrom stats na.omit
#' @importFrom S4Vectors DataFrame
#'
#' @export
#' @concept Visualizing_Clones
#' @return Either amended input with edit-distanced clusters added
Expand Down Expand Up @@ -177,12 +179,11 @@ clonalCluster <- function(input.data,
col.name <- names(PreMeta) %||% colnames(PreMeta)
input.data[[col.name]] <- PreMeta
} else {
rownames <- rownames(colData(input.data))
combined_col_names <- unique(c(colnames(colData(input.data)), colnames(PreMeta)))
full_data <- merge(colData(input.data), PreMeta[rownames, , drop = FALSE], by = "row.names", all = TRUE)
colData(input.data) <- full_data[, combined_col_names]

rownames(colData(input.data)) <- rownames
combined_col_names <- unique(c(colnames(colData(sc.data)), colnames(PreMeta)))
full_data <- merge(colData(sc.data), PreMeta[rownames, , drop = FALSE], by = "row.names", all.x = TRUE)
rownames(full_data) <- full_data[, 1]
full_data <- full_data[, -1]
colData(sc.data) <- DataFrame(full_data[, combined_col_names])
}
} else {
#Reorder columns
Expand Down
4 changes: 1 addition & 3 deletions R/clonalNetwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#' @param chain indicate if both or a specific chain should be used -
#' e.g. "both", "TRA", "TRG", "IGH", "IGL".
#' @param exportTable Exports a table of the data into the global
#' environment in addition to the visualization.
#' @param exportClones Exports a table of clones that are shared
#' across multiple identity groups and ordered by the total number
#' of clone copies.
Expand All @@ -55,7 +54,7 @@
#' @import ggplot2
#' @importFrom stringr str_sort
#' @importFrom igraph graph_from_data_frame V `V<-`
#' @importFrom dplyr %>% group_by select summarize_all count n
#' @importFrom dplyr %>% group_by select summarize_all count n across all_of desc
#' @importFrom tidygraph as_tbl_graph activate
#' @importFrom ggraph ggraph geom_edge_bend geom_node_point scale_edge_colour_gradientn circle guide_edge_colourbar
#' @importFrom stats setNames
Expand All @@ -72,7 +71,6 @@ clonalNetwork <- function(sc.data,
filter.graph = FALSE,
cloneCall = "strict",
chain = "both",
exportTable = FALSE,
exportClones = FALSE,
palette = "inferno") {
to <- from <- weight <- y <- NULL
Expand Down
9 changes: 6 additions & 3 deletions R/combineExpression.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
#' @param addLabel This will add a label to the frequency header, allowing
#' the user to try multiple group.by variables or recalculate frequencies after
#' subsetting the data.
#' @importFrom dplyr bind_rows %>% summarise left_join mutate select n
#' @importFrom dplyr bind_rows %>% summarise left_join mutate select n all_of coalesce
#' @importFrom rlang %||% sym :=
#' @importFrom SummarizedExperiment colData<- colData
#' @importFrom S4Vectors DataFrame
#' @export
#' @concept SC_Functions
#' @return Single-cell object with clone information added to meta data
Expand Down Expand Up @@ -205,8 +206,10 @@ combineExpression <- function(input.data,
warning(.warn_str) }

combined_col_names <- unique(c(colnames(colData(sc.data)), colnames(PreMeta)))
full_data <- merge(colData(sc.data), PreMeta[rownames, , drop = FALSE], by = "row.names", all = TRUE)
colData(sc.data) <- full_data[, combined_col_names]
full_data <- merge(colData(sc.data), PreMeta[rownames, , drop = FALSE], by = "row.names", all.x = TRUE)
rownames(full_data) <- full_data[, 1]
full_data <- full_data[, -1]
colData(sc.data) <- DataFrame(full_data[, combined_col_names])

rownames(colData(sc.data)) <- rownames
}
Expand Down
6 changes: 2 additions & 4 deletions man/clonalNetwork.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 406c9f0

Please sign in to comment.