Skip to content

Commit

Permalink
fixed most vdiffr tests except startrac and clonalBias
Browse files Browse the repository at this point in the history
  • Loading branch information
Qile0317 committed Nov 7, 2023
1 parent 80f06ad commit afc62ee
Show file tree
Hide file tree
Showing 13 changed files with 161 additions and 72 deletions.
19 changes: 10 additions & 9 deletions R/clonalBias.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,14 @@ 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"])))
#Plotting
plot <- ggplot(bias, aes(x=ncells,y=bias)) +
bias$cloneSize <- factor(bias$cloneSize , rev(levels(meta[, "cloneSize"])))

if (exportTable) {
return(bias)
}

#else, return the plot
ggplot(bias, aes(x=ncells,y=bias)) +
geom_point(aes(fill=Top_state, size = cloneSize), shape = 21, stroke = 0.25) +
stat_quantile(data=df_shuffle,
quantiles = c(corrected_p),
Expand All @@ -115,13 +120,9 @@ clonalBias <- function(sc.data,
color = "black",
lty = 2) +
scale_fill_manual(values = .colorizer(palette, length(unique(bias[,"Top_state"])))) +
theme_classic() +
xlab("Clone Size") +
theme_classic() +
xlab("Clone Size") +
ylab("Clonotype Bias")
if (exportTable == TRUE) {
return(bias)
}
return(plot)
}

#Background summary of clones
Expand Down
7 changes: 4 additions & 3 deletions R/clonalNetwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ clonalNetwork <- function(sc.data,
V(graph)$size <- unname(clone.number)
centers <- centers[rownames(centers) %in% names(V(graph)),]

if (exportTable) {
return(edge.list1)
}

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 All @@ -228,9 +232,6 @@ clonalNetwork <- function(sc.data,
axis.line = element_line(colour = "black"),
legend.key=element_blank()
)
if (exportTable) {
return(edge.list1)
}
return(plot)
}

4 changes: 2 additions & 2 deletions R/clonalRarefaction.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ clonalRarefaction <- function(input.data,
})
col <- length(input.data)
mat <- iNEXT(mat.list, q=hill.numbers, datatype="abundance",nboot = n.boots)
plot <- ggiNEXT(mat, type=plot.type) +
plot <- suppressMessages(ggiNEXT(mat, type=plot.type) +
scale_shape_manual(values = rep(16,col)) +
scale_fill_manual(values = rep("white", col)) +
scale_color_manual(values = c(.colorizer(palette,col))) +
theme_classic()
theme_classic())
if (exportTable == TRUE) {
return(plot["data"])
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/aaKmers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ std::unordered_map<char, unsigned long int> allAaMap() {

class AaKmerCounter {
private:
// ideally these are all constants except bins
// ideally these are all constants except bins but this works :/
std::unordered_map<unsigned long int, int> aaUIntKmerMap;
int k;
unsigned long int mask;
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: 84 additions & 0 deletions tests/testthat/_snaps/clonalBias/clonalbias-plot.new.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit afc62ee

Please sign in to comment.