Skip to content

Commit

Permalink
Merge pull request #5 from danforthcenter/vignette
Browse files Browse the repository at this point in the history
update to use aws
  • Loading branch information
joshqsumner authored Sep 10, 2024
2 parents 3bb2744 + d935fa2 commit addc7cc
Show file tree
Hide file tree
Showing 7 changed files with 524 additions and 132 deletions.
8 changes: 5 additions & 3 deletions R/asvDist.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ asvDist <- function(asvTab, asvCols = NULL, method = "spearman",
#* *plotting*
if (plot) {
# consider grouping things here maybe with hclust.
p <- ggplot2::ggplot(ldf, ggplot2::aes(x = .data[["c1"]],
y = .data[["c2"]],
fill = ldf[[method]])) +
p <- ggplot2::ggplot(ldf, ggplot2::aes(
x = .data[["c1"]],
y = .data[["c2"]],
fill = ldf[[method]]
)) +
ggplot2::geom_tile(color = NA, linewidth = 0) +
viridis::scale_fill_viridis(na.value = "grey100") +
ggplot2::labs(fill = method) +
Expand Down
8 changes: 4 additions & 4 deletions R/netcomi2scb.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
#' @examples
#' \dontrun{
#' if ("NetCoMi" %in% installed.packages()) {
#' microNetObj <- NetCoMi::netConstruct(as.matrix(asv[, grepl("ASV", colnames(asv))]),
#' measure = "spearman", sparsMethod = "t-test", alpha = 0.7
#' )
#' net <- netcomi2scb(microNetObj)
#' microNetObj <- NetCoMi::netConstruct(as.matrix(asv[, grepl("ASV", colnames(asv))]),
#' measure = "spearman", sparsMethod = "t-test", alpha = 0.7
#' )
#' net <- netcomi2scb(microNetObj)
#' }
#' }
#' @export
Expand Down
6 changes: 4 additions & 2 deletions R/qc.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ qc <- function(file = NULL, asvTab = NULL, taxa = NULL, asvAbnd = 100, sampleAbn
asvTab <- taxa_filtering_output$asvTab
taxa <- taxa_filtering_output$taxa
#* `Sample Abundance filtering`
sample_filtering_output <- .qc_sample_abundance_filter(asvTab, sampleAbnd, metadata, return_removed,
separate, split)
sample_filtering_output <- .qc_sample_abundance_filter(
asvTab, sampleAbnd, metadata, return_removed,
separate, split
)
asvTab <- sample_filtering_output$asvTab
metadata <- sample_filtering_output$metadata
removed <- sample_filtering_output$removed
Expand Down
6 changes: 4 additions & 2 deletions R/threshPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ threshPlot <- function(thresh, asv, asvCols = NULL, phenotype = NULL, unit = "as
clusters <- unique(nodes[[clusterCol]])
clust_ag <- do.call(cbind, lapply(clusters, function(clust) {
asvs_in_cluster <- nodes[nodes[[clusterCol]] == clust, "asv"]
setNames(data.frame(rowSums(as.data.frame(asv[, c(asvs_in_cluster)]))),
c(paste0("cluster_", clust)))
setNames(
data.frame(rowSums(as.data.frame(asv[, c(asvs_in_cluster)]))),
c(paste0("cluster_", clust))
)
}))
asv <- cbind(asv[, -which(grepl("ASV", colnames(asv)))], clust_ag)
}
Expand Down
5 changes: 3 additions & 2 deletions R/threshUpset.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ threshUpset <- function(thresh, mode = "phenotype",
sub_upset_data[[pvalcol]] <- ifelse(sub_upset_data[[pvalcol]] < cutoff, TRUE, FALSE)
data.table::setDT(sub_upset_data)
upsetPlotData <- as.data.frame(data.table::dcast(sub_upset_data,
asv ~ phenotype,
value.var = pvalcol))
asv ~ phenotype,
value.var = pvalcol
))
p <- ComplexUpset::upset(upsetPlotData, intersect = colnames(upsetPlotData)[-1])
p[[2]] <- p[[2]] +
ggplot2::labs(
Expand Down
2 changes: 1 addition & 1 deletion tools/linting.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ style_pkg("~/syncomBuildR", dry = "off", scope = "line_breaks")
style_pkg("~/syncomBuildR", dry = "off", scope = "tokens")

if(FALSE){
file = "~/syncomBuildR/R/netThresh.R"
file = "~/syncomBuildR/vignettes/dada2.Rmd"
styler::style_file(file, scope = "line_breaks")
lintr::lint(file, linters = lintr::linters_with_defaults(lintr::line_length_linter(length = 105L),
lintr::object_name_linter(styles = c("snake_case", "symbols",
Expand Down
Loading

0 comments on commit addc7cc

Please sign in to comment.