From 2057aa57a8101381adb9dffdd5a05e741843791e Mon Sep 17 00:00:00 2001 From: teddyCodex Date: Mon, 14 Oct 2024 19:00:08 +0100 Subject: [PATCH 1/4] refactor functions in multiple files --- R/msa.R | 10 +++++----- R/networks_domarch.R | 8 ++++---- R/networks_gencontext.R | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/R/msa.R b/R/msa.R index e56cc32c..4c48f323 100644 --- a/R/msa.R +++ b/R/msa.R @@ -24,7 +24,7 @@ ############# ## Sample Runs -# msa_pdf(fasta_path="data/alns/pspb.gismo.fa" )#, out_path="data/msapdf") +# createMSA_PDF(fasta_path="data/alns/pspb.gismo.fa" )#, out_path="data/msapdf") ######################################### ## Generates MSA PDF from a Fasta file ## @@ -34,7 +34,7 @@ #' @description #' Generates a multiple sequence alignment from a fasta file #' -#' msa_pdf is a function that reads a fasta file and generates a multiple sequence alignment as +#' createMSA_PDF is a function that reads a fasta file and generates a multiple sequence alignment as #' a pdf #' #' @@ -55,9 +55,9 @@ #' #' @examples #' \dontrun{ -#' msa_pdf() +#' createMSA_PDF() #' } -msa_pdf <- function(fasta_path, out_path = NULL, +createMSA_PDF <- function(fasta_path, out_path = NULL, lowerbound = NULL, upperbound = NULL) { ## SAMPLE ARGUMENTS to test run # fasta_path=here("../molevol_data/project_data/phage_defense/full_analysis_20210108/g3d.both_lin.gen.da_sub.fa") @@ -196,7 +196,7 @@ msa_pdf <- function(fasta_path, out_path = NULL, #' @export #' #' @examples -generate_msa <- function(fa_file = "", outfile = "") { +createMSA_Kalign <- function(fa_file = "", outfile = "") { prot_aa <- readAAStringSet( path = fa_file, format = "fasta" diff --git a/R/networks_domarch.R b/R/networks_domarch.R index fea0a195..9215aa93 100755 --- a/R/networks_domarch.R +++ b/R/networks_domarch.R @@ -46,9 +46,9 @@ #' #' @examples #' \dontrun{ -#' domain_network(pspa) +#' createDomainNetwork(pspa) #' } -domain_network <- function(prot, column = "DomArch", domains_of_interest, cutoff = 70, layout = "nice", query_color = adjustcolor("green", alpha.f = .5)) { +createDomainNetwork <- function(prot, column = "DomArch", domains_of_interest, cutoff = 70, layout = "nice", query_color = adjustcolor("green", alpha.f = .5)) { # by domain networks or all, as required. tryCatch( { @@ -250,9 +250,9 @@ domain_network <- function(prot, column = "DomArch", domains_of_interest, cutoff #' #' @examples #' \dontrun{ -#' domain_network(pspa) +#' createDomainNetwork(pspa) #' } -BinaryDomainNetwork <- function(prot, column = "DomArch", domains_of_interest, cutoff = 70, +createBinaryDomainNetwork <- function(prot, column = "DomArch", domains_of_interest, cutoff = 70, layout = "nice", query_color = adjustcolor("yellow", alpha.f = .5), partner_color = adjustcolor("skyblue", alpha.f = .5), border_color = adjustcolor("grey", alpha.f = .8), diff --git a/R/networks_gencontext.R b/R/networks_gencontext.R index e0dd63da..7df6c270 100755 --- a/R/networks_gencontext.R +++ b/R/networks_gencontext.R @@ -39,7 +39,7 @@ #' \dontrun{ #' domain_network(pspa) #' } -gc_undirected_network <- function(prot, column = "GenContext", domains_of_interest, cutoff_type = "Lineage", cutoff = 1, layout = "grid") { +createUndirectedGenomicContextNetwork <- function(prot, column = "GenContext", domains_of_interest, cutoff_type = "Lineage", cutoff = 1, layout = "grid") { # by domain networks or all, as required. # ye is either all of prot.list or centered on one domain @@ -146,7 +146,7 @@ gc_undirected_network <- function(prot, column = "GenContext", domains_of_intere #' \dontrun{ #' gc_directed_network(pspa, column = "GenContex", cutoff = 55) #' } -GenContextNetwork <- function(prot, domains_of_interest, column = "GenContext", +createGenomicContextNetwork <- function(prot, domains_of_interest, column = "GenContext", cutoff = 40, layout = "grid", directed = TRUE) { From b665a4dfd062f3a359cb907040cb8c384a23450c Mon Sep 17 00:00:00 2001 From: teddyCodex Date: Mon, 14 Oct 2024 19:03:29 +0100 Subject: [PATCH 2/4] Update NAMESPACE and .Rd files --- NAMESPACE | 12 ++++++------ ...ainNetwork.Rd => createBinaryDomainNetwork.Rd} | 8 ++++---- man/{domain_network.Rd => createDomainNetwork.Rd} | 8 ++++---- ...tNetwork.Rd => createGenomicContextNetwork.Rd} | 6 +++--- man/{generate_msa.Rd => createMSA_Kalign.Rd} | 6 +++--- man/{msa_pdf.Rd => createMSA_PDF.Rd} | 15 ++++++++++----- ...d => createUndirectedGenomicContextNetwork.Rd} | 6 +++--- 7 files changed, 33 insertions(+), 28 deletions(-) rename man/{BinaryDomainNetwork.Rd => createBinaryDomainNetwork.Rd} (92%) rename man/{domain_network.Rd => createDomainNetwork.Rd} (90%) rename man/{GenContextNetwork.Rd => createGenomicContextNetwork.Rd} (91%) rename man/{generate_msa.Rd => createMSA_Kalign.Rd} (70%) rename man/{msa_pdf.Rd => createMSA_PDF.Rd} (77%) rename man/{gc_undirected_network.Rd => createUndirectedGenomicContextNetwork.Rd} (90%) diff --git a/NAMESPACE b/NAMESPACE index fe4c23d6..4c05dc94 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,8 +1,6 @@ # Generated by roxygen2: do not edit by hand -export(BinaryDomainNetwork) export(GCA2Lineage) -export(GenContextNetwork) export(IPG2Lineage) export(acc2FA) export(acc2Lineage) @@ -29,14 +27,19 @@ export(convertAlignment2FA) export(convertAlignment2Trees) export(convertFA2Tree) export(countByColumn) +export(createBinaryDomainNetwork) +export(createDomainNetwork) export(createFA2Tree) +export(createGenomicContextNetwork) export(createJobResultsURL) export(createJobStatusEmailMessage) +export(createMSA_Kalign) +export(createMSA_PDF) export(createRepresentativeAccNum) +export(createUndirectedGenomicContextNetwork) export(createWordCloud2Element) export(createWordCloudElement) export(create_lineage_lookup) -export(domain_network) export(downloadAssemblySummary) export(efetchIPG) export(extractAccNum) @@ -44,9 +47,7 @@ export(filterByDomains) export(filterByFrequency) export(findParalogs) export(formatJobArgumentsHTML) -export(gc_undirected_network) export(generateAllAlignments2FA) -export(generate_msa) export(getAccNumFromFA) export(getTopAccByLinDomArch) export(get_proc_medians) @@ -54,7 +55,6 @@ export(get_proc_weights) export(make_opts2procs) export(mapAcc2Name) export(map_advanced_opts2procs) -export(msa_pdf) export(plotIPR2Viz) export(plotIPR2VizWeb) export(plotLineageDA) diff --git a/man/BinaryDomainNetwork.Rd b/man/createBinaryDomainNetwork.Rd similarity index 92% rename from man/BinaryDomainNetwork.Rd rename to man/createBinaryDomainNetwork.Rd index bb7e2353..4f0bdc5a 100644 --- a/man/BinaryDomainNetwork.Rd +++ b/man/createBinaryDomainNetwork.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/networks_domarch.R -\name{BinaryDomainNetwork} -\alias{BinaryDomainNetwork} +\name{createBinaryDomainNetwork} +\alias{createBinaryDomainNetwork} \title{Domain Network} \usage{ -BinaryDomainNetwork( +createBinaryDomainNetwork( prot, column = "DomArch", domains_of_interest, @@ -42,6 +42,6 @@ A network of domains is returned based on shared domain architectures. } \examples{ \dontrun{ -domain_network(pspa) +createDomainNetwork(pspa) } } diff --git a/man/domain_network.Rd b/man/createDomainNetwork.Rd similarity index 90% rename from man/domain_network.Rd rename to man/createDomainNetwork.Rd index 528e4924..1588af17 100644 --- a/man/domain_network.Rd +++ b/man/createDomainNetwork.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/networks_domarch.R -\name{domain_network} -\alias{domain_network} +\name{createDomainNetwork} +\alias{createDomainNetwork} \title{Domain Network} \usage{ -domain_network( +createDomainNetwork( prot, column = "DomArch", domains_of_interest, @@ -33,6 +33,6 @@ A network of domains is returned based on shared domain architectures. } \examples{ \dontrun{ -domain_network(pspa) +createDomainNetwork(pspa) } } diff --git a/man/GenContextNetwork.Rd b/man/createGenomicContextNetwork.Rd similarity index 91% rename from man/GenContextNetwork.Rd rename to man/createGenomicContextNetwork.Rd index 2eeebbc5..ac6deb84 100644 --- a/man/GenContextNetwork.Rd +++ b/man/createGenomicContextNetwork.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/networks_gencontext.R -\name{GenContextNetwork} -\alias{GenContextNetwork} +\name{createGenomicContextNetwork} +\alias{createGenomicContextNetwork} \title{Genomic Context Directed Network} \usage{ -GenContextNetwork( +createGenomicContextNetwork( prot, domains_of_interest, column = "GenContext", diff --git a/man/generate_msa.Rd b/man/createMSA_Kalign.Rd similarity index 70% rename from man/generate_msa.Rd rename to man/createMSA_Kalign.Rd index a68eb8b4..946f04ae 100644 --- a/man/generate_msa.Rd +++ b/man/createMSA_Kalign.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/msa.R -\name{generate_msa} -\alias{generate_msa} +\name{createMSA_Kalign} +\alias{createMSA_Kalign} \title{Function to generate MSA using kalign} \usage{ -generate_msa(fa_file = "", outfile = "") +createMSA_Kalign(fa_file = "", outfile = "") } \arguments{ \item{outfile}{} diff --git a/man/msa_pdf.Rd b/man/createMSA_PDF.Rd similarity index 77% rename from man/msa_pdf.Rd rename to man/createMSA_PDF.Rd index 4d5fed17..7cd7516a 100644 --- a/man/msa_pdf.Rd +++ b/man/createMSA_PDF.Rd @@ -1,10 +1,15 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/msa.R -\name{msa_pdf} -\alias{msa_pdf} +\name{createMSA_PDF} +\alias{createMSA_PDF} \title{Multiple Sequence Alignment} \usage{ -msa_pdf(fasta_path, out_path = NULL, lowerbound = NULL, upperbound = NULL) +createMSA_PDF( + fasta_path, + out_path = NULL, + lowerbound = NULL, + upperbound = NULL +) } \arguments{ \item{fasta_path}{Character. The path location of the fasta file to be read.} @@ -21,11 +26,11 @@ Default is NULL. If value is NULL, the entire multiple sequence alignment is pri \description{ Generates a multiple sequence alignment from a fasta file -msa_pdf is a function that reads a fasta file and generates a multiple sequence alignment as +createMSA_PDF is a function that reads a fasta file and generates a multiple sequence alignment as a pdf } \examples{ \dontrun{ -msa_pdf() +createMSA_PDF() } } diff --git a/man/gc_undirected_network.Rd b/man/createUndirectedGenomicContextNetwork.Rd similarity index 90% rename from man/gc_undirected_network.Rd rename to man/createUndirectedGenomicContextNetwork.Rd index 28cf1abb..d61c23df 100644 --- a/man/gc_undirected_network.Rd +++ b/man/createUndirectedGenomicContextNetwork.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/networks_gencontext.R -\name{gc_undirected_network} -\alias{gc_undirected_network} +\name{createUndirectedGenomicContextNetwork} +\alias{createUndirectedGenomicContextNetwork} \title{Domain Network} \usage{ -gc_undirected_network( +createUndirectedGenomicContextNetwork( prot, column = "GenContext", domains_of_interest, From cdac9a3cc8a446596474fdc27892c2cc5fffbb3b Mon Sep 17 00:00:00 2001 From: David Mayer Date: Tue, 22 Oct 2024 15:27:32 -0600 Subject: [PATCH 3/4] let R sort NAMESPACE --- NAMESPACE | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 025f00cf..d91f16c9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -34,9 +34,9 @@ export(createFA2Tree) export(createGenomicContextNetwork) export(createJobResultsURL) export(createJobStatusEmailMessage) +export(createLineageLookup) export(createMSA_Kalign) export(createMSA_PDF) -export(createLineageLookup) export(createRepresentativeAccNum) export(createUndirectedGenomicContextNetwork) export(createWordCloud2Element) @@ -55,7 +55,6 @@ export(getTopAccByLinDomArch) export(mapAcc2Name) export(mapAdvOption2Process) export(mapOption2Process) -export(msa_pdf) export(plotEstimatedWallTimes) export(plotIPR2Viz) export(plotIPR2VizWeb) From 22504868261a7a56fa93c4889ac42a9becb66fff Mon Sep 17 00:00:00 2001 From: David Mayer Date: Tue, 22 Oct 2024 15:33:13 -0600 Subject: [PATCH 4/4] function/doc consistency --- R/networks_gencontext.R | 4 ++-- man/createUndirectedGenomicContextNetwork.Rd | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/networks_gencontext.R b/R/networks_gencontext.R index 7df6c270..ca1ef52d 100755 --- a/R/networks_gencontext.R +++ b/R/networks_gencontext.R @@ -8,7 +8,7 @@ ## GC Undirected Network ## ########################### -#' Domain Network +#' createUndirectedGenomicContextNetwork #' #' @description #' This function creates a domain network from the 'DomArch' column. @@ -37,7 +37,7 @@ #' #' @examples #' \dontrun{ -#' domain_network(pspa) +#' createUndirectedGenomicContextNetwork(pspa) #' } createUndirectedGenomicContextNetwork <- function(prot, column = "GenContext", domains_of_interest, cutoff_type = "Lineage", cutoff = 1, layout = "grid") { # by domain networks or all, as required. diff --git a/man/createUndirectedGenomicContextNetwork.Rd b/man/createUndirectedGenomicContextNetwork.Rd index d61c23df..b74da141 100644 --- a/man/createUndirectedGenomicContextNetwork.Rd +++ b/man/createUndirectedGenomicContextNetwork.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/networks_gencontext.R \name{createUndirectedGenomicContextNetwork} \alias{createUndirectedGenomicContextNetwork} -\title{Domain Network} +\title{createUndirectedGenomicContextNetwork} \usage{ createUndirectedGenomicContextNetwork( prot, @@ -35,6 +35,6 @@ A network of domains is returned based on shared domain architectures. } \examples{ \dontrun{ -domain_network(pspa) +createUndirectedGenomicContextNetwork(pspa) } }