Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored function names in R/ipr2viz.R #83

Merged
merged 5 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ export(extractAccNum)
export(filterByDomains)
export(filterByFrequency)
export(findParalogs)
export(find_top_acc)
export(formatJobArgumentsHTML)
export(gc_undirected_network)
export(generateAllAlignments2FA)
export(generate_all_aln2fa)
export(generate_msa)
export(getTopAccByLinDomArch)
export(get_accnums_from_fasta_file)
export(get_proc_medians)
export(get_proc_weights)
export(ipr2viz)
export(ipr2viz_web)
export(make_opts2procs)
export(mapAcc2Name)
export(map_acc2name)
export(map_advanced_opts2procs)
export(msa_pdf)
export(plotIPR2Viz)
export(plotIPR2VizWeb)
export(plotLineageDA)
export(plotLineageDomainRepeats)
export(plotLineageHeatmap)
Expand Down Expand Up @@ -97,7 +97,7 @@ export(summarizeDomArch_ByLineage)
export(summarizeGenContext)
export(summarizeGenContext_ByDomArchLineage)
export(summarizeGenContext_ByLineage)
export(theme_genes2)
export(themeGenes2)
export(to_titlecase)
export(totalGenContextOrDomArchCounts)
export(validateCountDF)
Expand Down
31 changes: 16 additions & 15 deletions R/ipr2viz.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
#################################
## Modified gggenes::theme_genes
#################################
## theme_genes2 adapted from theme_genes (w/o strip.text())
## themeGenes2 adapted from theme_genes (w/o strip.text())
## https://github.com/wilkox/gggenes/blob/master/R/theme_genes.R
#' Theme Genes2
#' themeGenes2
the-mayer marked this conversation as resolved.
Show resolved Hide resolved
#'
#' @importFrom ggplot2 element_blank element_line theme theme_grey
#'
#' @return
#' @export
#'
#' @examples
theme_genes2 <- function() {
themeGenes2 <- function() {
ggplot2::theme_grey() + ggplot2::theme(
panel.background = ggplot2::element_blank(),
panel.grid.major.y = ggplot2::element_line(colour = "grey80", size = 0.2),
Expand All @@ -41,7 +41,8 @@ theme_genes2 <- function() {
##################################
## Get Top N AccNum by Lin+DomArch
##################################
#' Group by lineage + DA then take top 20
#' getTopAccByLinDomArch
#' @description Group by lineage + DA then take top 20
#'
#' @param infile_full
#' @param DA_col
Expand All @@ -59,7 +60,7 @@ theme_genes2 <- function() {
#' @export
#'
#' @examples
find_top_acc <- function(infile_full,
getTopAccByLinDomArch <- function(infile_full,
DA_col = "DomArch.Pfam",
lin_col = "Lineage_short",
n = 20,
Expand Down Expand Up @@ -92,7 +93,7 @@ find_top_acc <- function(infile_full,
#############################################
## IPR + FULL files --> DomArch Visualization
#############################################
#' IPR2Viz
#' plotIPR2Viz
#'
#' @param infile_ipr
#' @param infile_full
Expand All @@ -115,7 +116,7 @@ find_top_acc <- function(infile_full,
#' @export
#'
#' @examples
ipr2viz <- function(infile_ipr = NULL, infile_full = NULL, accessions = c(),
plotIPR2Viz <- function(infile_ipr = NULL, infile_full = NULL, accessions = c(),
analysis = c("Pfam", "Phobius", "TMHMM", "Gene3D"),
group_by = "Analysis", # "Analysis"
topn = 20, name = "Name", text_size = 15, query = "All") {
Expand Down Expand Up @@ -143,8 +144,8 @@ ipr2viz <- function(infile_ipr = NULL, infile_full = NULL, accessions = c(),
## To filter by Analysis
analysis <- paste(analysis, collapse = "|")
## @SAM: This can't be set in stone since the analysis may change!
## Getting top n accession numbers using find_top_acc()
top_acc <- find_top_acc(
## Getting top n accession numbers using getTopAccByLinDomArch()
top_acc <- getTopAccByLinDomArch(
infile_full = infile_full,
DA_col = "DomArch.Pfam",
## @SAM, you could pick by the Analysis w/ max rows!
Expand Down Expand Up @@ -204,7 +205,7 @@ ipr2viz <- function(infile_ipr = NULL, infile_full = NULL, accessions = c(),
# , ncol = 1 + #scales = "free",
scale_fill_manual(values = CPCOLS, na.value = "#A9A9A9") +
theme_minimal() +
theme_genes2() +
themeGenes2() +
theme(
legend.position = "bottom",
legend.box = "horizontal",
Expand Down Expand Up @@ -234,7 +235,7 @@ ipr2viz <- function(infile_ipr = NULL, infile_full = NULL, accessions = c(),
) +
scale_fill_manual(values = CPCOLS, na.value = "#A9A9A9") +
theme_minimal() +
theme_genes2() +
themeGenes2() +
theme(
legend.position = "bottom",
legend.box = "horizontal",
Expand All @@ -248,7 +249,7 @@ ipr2viz <- function(infile_ipr = NULL, infile_full = NULL, accessions = c(),
return(plot)
}

#' IPR2Viz Web
#' plotIPR2VizWeb
#'
#' @param infile_ipr
#' @param accessions
Expand All @@ -270,7 +271,7 @@ ipr2viz <- function(infile_ipr = NULL, infile_full = NULL, accessions = c(),
#' @export
#'
#' @examples
ipr2viz_web <- function(infile_ipr,
plotIPR2VizWeb <- function(infile_ipr,
accessions,
analysis = c("Pfam", "Phobius", "TMHMM", "Gene3D"),
group_by = "Analysis", name = "Name",
Expand Down Expand Up @@ -346,7 +347,7 @@ ipr2viz_web <- function(infile_ipr,
# , ncol = 1 + #scales = "free",
scale_fill_manual(values = CPCOLS, na.value = "#A9A9A9") +
theme_minimal() +
theme_genes2() +
themeGenes2() +
theme(
legend.position = "bottom",
legend.box = "horizontal",
Expand Down Expand Up @@ -376,7 +377,7 @@ ipr2viz_web <- function(infile_ipr,
) +
scale_fill_manual(values = CPCOLS, na.value = "#A9A9A9") +
theme_minimal() +
theme_genes2() +
themeGenes2() +
theme(
legend.position = "bottom",
legend.box = "horizontal",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions man/find_top_acc.Rd → man/getTopAccByLinDomArch.Rd

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

10 changes: 5 additions & 5 deletions man/ipr2viz.Rd → man/plotIPR2Viz.Rd

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

10 changes: 5 additions & 5 deletions man/ipr2viz_web.Rd → man/plotIPR2VizWeb.Rd

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

10 changes: 5 additions & 5 deletions man/theme_genes2.Rd → man/themeGenes2.Rd

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

File renamed without changes.
Loading