Skip to content

Commit

Permalink
working through final testthat
Browse files Browse the repository at this point in the history
Still have issues with clonalNetwork
  • Loading branch information
ncborcherding committed Nov 8, 2023
1 parent 357e63f commit 8a5a2a2
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 194 deletions.
16 changes: 10 additions & 6 deletions R/clonalBias.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,29 @@ clonalBias <- function(sc.data,
bias$cloneSize[i] <- as.vector(meta[which(meta[,cloneCall] == clone & meta[,split.by] == split),"cloneSize"])[1]
}

bias$cloneSize <- factor(bias$cloneSize , rev(levels(meta[, "cloneSize"])))
bias$cloneSize <- factor(bias$cloneSize, rev(levels(meta[, "cloneSize"])))

if (exportTable) {
return(bias)
}

bias$dotSize <- as.numeric(bias$cloneSize)

#else, return the plot
ggplot(bias, aes(x=ncells,y=bias)) +
geom_point(aes(fill=Top_state, size = cloneSize), shape = 21, stroke = 0.25) +
geom_point(aes(fill=Top_state, size = dotSize), shape = 21, stroke = 0.25) +
stat_quantile(data=df_shuffle,
quantiles = c(corrected_p),
method = "rqss",
lambda=3,
lambda = 3,
color = "black",
lty = 2) +
#This is ridiculous way to get around the internal ggplot "style"-based warnings
scale_size_continuous(breaks = as.vector(unique(bias$dotSize)), labels = as.vector(unique(bias$cloneSize))) +
scale_fill_manual(values = .colorizer(palette, length(unique(bias[,"Top_state"])))) +
theme_classic() +
xlab("Clone Size") +
ylab("Clonotype Bias")
labs(size = "cloneSize", fill = "Group") +
xlab("Clonal Size") +
ylab("Clonal Bias")
}

#Background summary of clones
Expand Down
5 changes: 3 additions & 2 deletions R/clonalNetwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ clonalNetwork <- function(sc.data,
}
}
if(is.null(edge.list)) {
stop("No shared clonotypes between the indicated identity")
stop("No shared clones between the indicated identity")
}

edge.list <- data.frame(edge.list)
Expand Down Expand Up @@ -207,7 +207,8 @@ clonalNetwork <- function(sc.data,
if (exportTable) {
return(edge.list1)
}

#Warning from this is produced by geom_edge_bend and there is nothng that can be done
#until the authors of the package update it.
plot <- ggraph(graph, layout = centers[match(names(V(graph)), rownames(centers)),]) +
geom_point(data = coord, aes(x = coord[,1], y = coord[,2], color = group.by)) +
geom_edge_bend(aes(edge_color = as.numeric(weight)),
Expand Down
3 changes: 2 additions & 1 deletion R/clonalOverlap.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ clonalOverlap <- function(input.data,
labs(fill = str_to_title(method)) +
geom_text(aes(label = round(value, digits = 3),
color = ifelse(value <= mean_value,
"white", "black"))) +
"white", "black")),
na.rm = TRUE) +
scale_fill_gradientn(colors = .colorizer(palette, 7), na.value = "white") +
scale_color_identity() +
theme_classic() +
Expand Down
2 changes: 1 addition & 1 deletion R/startracDiversity.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ StartracDiversity <- function(sc.data,
col <- length(unique(mat_melt[,"majorCluster"]))

plot <- ggplot(mat_melt, aes(x=majorCluster, y=value)) +
geom_boxplot(aes(fill = majorCluster), outlier.alpha = 0) +
geom_boxplot(aes(fill = majorCluster), outlier.alpha = 0, na.rm = TRUE) +
facet_grid(variable ~.) +
theme_classic() +
ylab("Index Score") +
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 0 additions & 84 deletions tests/testthat/_snaps/clonalBias/clonalbias-plot.new.svg

This file was deleted.

Loading

0 comments on commit 8a5a2a2

Please sign in to comment.