From a246339f47d37ff60bdfb76a6861807b546c93f3 Mon Sep 17 00:00:00 2001 From: teddyCodex Date: Tue, 8 Oct 2024 23:36:16 +0100 Subject: [PATCH 1/5] refactor function names in R/pre-msa-tree and R/reverse-operons.R --- NAMESPACE | 7 ++- R/pre-msa-tree.R | 16 +++---- R/reverse_operons.R | 12 ++--- man/RepresentativeAccNums.Rd | 4 +- man/countbycolumn.Rd | 22 ---------- man/createRepresentativeAccNum.Rd | 27 ++++++++++++ man/filterbydomains.Rd | 44 ------------------- man/filterbyfrequency.Rd | 22 ---------- man/findparalogs.Rd | 26 ----------- man/getAccNumFromFA.Rd | 14 ++++++ man/get_accnums_from_fasta_file.Rd | 6 +-- man/{reveql.Rd => reverseOperonSeq.Rd} | 10 ++--- ...verse_operon.Rd => straightenOperonSeq.Rd} | 10 ++--- man/summarizebylineage.Rd | 25 ----------- man/totalgencontextordomarchcounts.Rd | 42 ------------------ man/words2wordcounts.Rd | 25 ----------- man/write.MsaAAMultipleAlignment.Rd | 8 +--- man/writeMSA_AA2FA.Rd | 21 +++++++++ 18 files changed, 94 insertions(+), 247 deletions(-) delete mode 100644 man/countbycolumn.Rd create mode 100644 man/createRepresentativeAccNum.Rd delete mode 100644 man/filterbydomains.Rd delete mode 100644 man/filterbyfrequency.Rd delete mode 100644 man/findparalogs.Rd create mode 100644 man/getAccNumFromFA.Rd rename man/{reveql.Rd => reverseOperonSeq.Rd} (56%) rename man/{reverse_operon.Rd => straightenOperonSeq.Rd} (53%) delete mode 100644 man/summarizebylineage.Rd delete mode 100644 man/totalgencontextordomarchcounts.Rd delete mode 100644 man/words2wordcounts.Rd create mode 100644 man/writeMSA_AA2FA.Rd diff --git a/NAMESPACE b/NAMESPACE index 53332439..fe2ad999 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -36,6 +36,7 @@ export(countByColumn) export(createFA2Tree) export(createJobResultsURL) export(createJobStatusEmailMessage) +export(createRepresentativeAccNum) export(createWordCloud2Element) export(createWordCloudElement) export(create_lineage_lookup) @@ -52,6 +53,7 @@ export(gc_undirected_network) export(generateAllAlignments2FA) export(generate_all_aln2fa) export(generate_msa) +export(getAccNumFromFA) export(get_accnums_from_fasta_file) export(get_proc_medians) export(get_proc_weights) @@ -83,14 +85,14 @@ export(removeTails) export(renameFA) export(rename_fasta) export(replaceQuestionMarks) -export(reveql) -export(reverse_operon) +export(reverseOperonSeq) export(run_deltablast) export(run_rpsblast) export(selectLongestDuplicate) export(sendJobStatusEmail) export(shortenLineage) export(sinkReset) +export(straightenOperonSeq) export(summarizeByLineage) export(summarizeDomArch) export(summarizeDomArch_ByLineage) @@ -103,6 +105,7 @@ export(totalGenContextOrDomArchCounts) export(validateCountDF) export(wordcloud3) export(write.MsaAAMultipleAlignment) +export(writeMSA_AA2FA) export(write_proc_medians_table) export(write_proc_medians_yml) importFrom(Biostrings,AAStringSet) diff --git a/R/pre-msa-tree.R b/R/pre-msa-tree.R index 44979c3c..fed495f4 100644 --- a/R/pre-msa-tree.R +++ b/R/pre-msa-tree.R @@ -546,7 +546,7 @@ acc2fa <- function(accessions, outpath, plan = "sequential") { return(result) } -#' RepresentativeAccNums +#' createRepresentativeAccNum #' #' @description #' Function to generate a vector of one Accession number per distinct observation from 'reduced' column @@ -566,7 +566,7 @@ acc2fa <- function(accessions, outpath, plan = "sequential") { #' @export #' #' @examples -RepresentativeAccNums <- function(prot_data, +createRepresentativeAccNum <- function(prot_data, reduced = "Lineage", accnum_col = "AccNum") { # Get Unique reduced column and then bind the AccNums back to get one AccNum per reduced column @@ -623,15 +623,15 @@ alignFasta <- function(fasta_file, tool = "Muscle", outpath = NULL) { ) if (typeof(outpath) == "character") { - write.MsaAAMultipleAlignment(aligned, outpath) + writeMSA_AA2FA(aligned, outpath) } return(aligned) } -#' write.MsaAAMultipleAlignment +#' writeMSA_AA2FA #' #' @description -#' Write MsaAAMultpleAlignment Objects as algined fasta sequence +#' Write MsaAAMultpleAlignment Objects as aligned fasta sequence #' MsaAAMultipleAlignment Objects are generated from calls to msaClustalOmega #' and msaMuscle from the 'msa' package #' @@ -647,7 +647,7 @@ alignFasta <- function(fasta_file, tool = "Muscle", outpath = NULL) { #' @export #' #' @examples -write.MsaAAMultipleAlignment <- function(alignment, outpath) { +writeMSA_AA2FA <- function(alignment, outpath) { l <- length(rownames(alignment)) fasta <- "" for (i in 1:l) @@ -660,7 +660,7 @@ write.MsaAAMultipleAlignment <- function(alignment, outpath) { return(fasta) } -#' get_accnums_from_fasta_file +#' getAccNumFromFA #' #' @param fasta_file #' @@ -671,7 +671,7 @@ write.MsaAAMultipleAlignment <- function(alignment, outpath) { #' @export #' #' @examples -get_accnums_from_fasta_file <- function(fasta_file) { +getAccNumFromFA <- function(fasta_file) { txt <- read_file(fasta_file) accnums <- stringi::stri_extract_all_regex(fasta_file, "(?<=>)[\\w,.]+")[[1]] return(accnums) diff --git a/R/reverse_operons.R b/R/reverse_operons.R index e4bbd50e..a2570e8d 100755 --- a/R/reverse_operons.R +++ b/R/reverse_operons.R @@ -3,7 +3,7 @@ # Modified by Janani Ravi and Samuel Chen -#' reveql +#' straightenOperonSeq #' #' @param prot #' @@ -11,7 +11,7 @@ #' @export #' #' @examples -reveql <- function(prot) { +straightenOperonSeq <- function(prot) { w <- prot # $GenContext.orig # was 'x' y <- rep(NA, length(w)) @@ -57,7 +57,7 @@ reveql <- function(prot) { ## The function to reverse operons -#' reverse_operon +#' reverseOperonSeq #' #' @param prot #' @@ -65,7 +65,7 @@ reveql <- function(prot) { #' @export #' #' @examples -reverse_operon <- function(prot) { +reverseOperonSeq <- function(prot) { gencontext <- prot$GenContext gencontext <- gsub(pattern = ">", replacement = ">|", x = gencontext) @@ -108,7 +108,7 @@ reverse_operon <- function(prot) { - ge <- lapply(1:length(ge), function(x) reveql(ge[[x]])) + ge <- lapply(1:length(ge), function(x) straightenOperonSeq(ge[[x]])) ye <- te[withouteq] @@ -141,4 +141,4 @@ reverse_operon <- function(prot) { # colnames(prot) <- c("AccNum","GenContext.orig","len", "GeneName","TaxID","Species") ## ??? straighten operons -# prot$GenContext.orig <- reverse_operon(prot) +# prot$GenContext.orig <- reverseOperonSeq(prot) diff --git a/man/RepresentativeAccNums.Rd b/man/RepresentativeAccNums.Rd index f617cde4..57d1f1ab 100644 --- a/man/RepresentativeAccNums.Rd +++ b/man/RepresentativeAccNums.Rd @@ -1,11 +1,9 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R \name{RepresentativeAccNums} \alias{RepresentativeAccNums} \title{Function to generate a vector of one Accession number per distinct observation from 'reduced' column} \usage{ -RepresentativeAccNums(prot_data, reduced = "Lineage", accnum_col = "AccNum") - RepresentativeAccNums(prot_data, reduced = "Lineage", accnum_col = "AccNum") } \arguments{ diff --git a/man/countbycolumn.Rd b/man/countbycolumn.Rd deleted file mode 100644 index 34fcc3e0..00000000 --- a/man/countbycolumn.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/summarize.R -\name{countByColumn} -\alias{countByColumn} -\title{Count By Column} -\usage{ -countByColumn(prot = prot, column = "DomArch", min.freq = 1) -} -\arguments{ -\item{min.freq}{} -} -\value{ -Describe return, in detail -} -\description{ -Count By Column -} -\examples{ -\dontrun{ -countByColumn() -} -} diff --git a/man/createRepresentativeAccNum.Rd b/man/createRepresentativeAccNum.Rd new file mode 100644 index 00000000..3703fe1a --- /dev/null +++ b/man/createRepresentativeAccNum.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/pre-msa-tree.R +\name{createRepresentativeAccNum} +\alias{createRepresentativeAccNum} +\title{createRepresentativeAccNum} +\usage{ +createRepresentativeAccNum( + prot_data, + reduced = "Lineage", + accnum_col = "AccNum" +) +} +\arguments{ +\item{prot_data}{Data frame containing Accession Numbers} + +\item{reduced}{Column from prot_data from which distinct observations +will be generated from. +One accession number will be assigned for each of these observations} + +\item{accnum_col}{Column from prot_data that contains Accession Numbers} +} +\description{ +Function to generate a vector of one Accession number per distinct observation from 'reduced' column +} +\author{ +Samuel Chen, Janani Ravi +} diff --git a/man/filterbydomains.Rd b/man/filterbydomains.Rd deleted file mode 100644 index 8c885363..00000000 --- a/man/filterbydomains.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/summarize.R -\name{filterByDomains} -\alias{filterByDomains} -\title{Filter by Domains} -\usage{ -filterByDomains( - prot, - column = "DomArch", - doms_keep = c(), - doms_remove = c(), - ignore.case = FALSE -) -} -\arguments{ -\item{prot}{Dataframe to filter} - -\item{column}{Column to search for domains in (DomArch column)} - -\item{doms_keep}{Vector of domains that must be identified within column in order for -observation to be kept} - -\item{doms_remove}{Vector of domains that, if found within an observation, will be removed} - -\item{ignore.case}{Should the matching be non case sensitive} -} -\value{ -Filtered data frame -} -\description{ -filterByDomains filters a data frame by identifying exact domain matches -and either keeping or removing rows with the identified domain -} -\note{ -There is no need to make the domains 'regex safe', that will be handled by this function -} -\examples{ -\dontrun{ -filterByDomains() -} -} -\author{ -Samuel Chen, Janani Ravi -} diff --git a/man/filterbyfrequency.Rd b/man/filterbyfrequency.Rd deleted file mode 100644 index d2c5f9cd..00000000 --- a/man/filterbyfrequency.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/summarize.R -\name{filterByFrequency} -\alias{filterByFrequency} -\title{Filter Frequency} -\usage{ -filterByFrequency(x, min.freq) -} -\arguments{ -\item{min.freq}{} -} -\value{ -Describe return, in detail -} -\description{ -Filter Frequency -} -\examples{ -\dontrun{ -filterByFrequency() -} -} diff --git a/man/findparalogs.Rd b/man/findparalogs.Rd deleted file mode 100644 index 4b5edbcf..00000000 --- a/man/findparalogs.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/summarize.R -\name{findParalogs} -\alias{findParalogs} -\title{Find Paralogs} -\usage{ -findParalogs(prot) -} -\arguments{ -\item{prot}{A data frame filtered by a Query, containing columns Species and Lineage} -} -\value{ -returns a dataframe containing paralogs and the counts. -} -\description{ -Creates a data frame of paralogs. -} -\note{ -Please refer to the source code if you have alternate file formats and/or -column names. -} -\examples{ -\dontrun{ -findParalogs(pspa) -} -} diff --git a/man/getAccNumFromFA.Rd b/man/getAccNumFromFA.Rd new file mode 100644 index 00000000..f2409965 --- /dev/null +++ b/man/getAccNumFromFA.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/pre-msa-tree.R +\name{getAccNumFromFA} +\alias{getAccNumFromFA} +\title{getAccNumFromFA} +\usage{ +getAccNumFromFA(fasta_file) +} +\arguments{ +\item{fasta_file}{} +} +\description{ +getAccNumFromFA +} diff --git a/man/get_accnums_from_fasta_file.Rd b/man/get_accnums_from_fasta_file.Rd index 84c163cc..f545d1a0 100644 --- a/man/get_accnums_from_fasta_file.Rd +++ b/man/get_accnums_from_fasta_file.Rd @@ -1,11 +1,9 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R \name{get_accnums_from_fasta_file} \alias{get_accnums_from_fasta_file} \title{Get accnums from fasta file} \usage{ -get_accnums_from_fasta_file(fasta_file) - get_accnums_from_fasta_file(fasta_file) } \arguments{ @@ -13,6 +11,4 @@ get_accnums_from_fasta_file(fasta_file) } \description{ Get accnums from fasta file - -get_accnums_from_fasta_file } diff --git a/man/reveql.Rd b/man/reverseOperonSeq.Rd similarity index 56% rename from man/reveql.Rd rename to man/reverseOperonSeq.Rd index 9dc2bcb8..d61ec5f2 100644 --- a/man/reveql.Rd +++ b/man/reverseOperonSeq.Rd @@ -1,14 +1,14 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/reverse_operons.R -\name{reveql} -\alias{reveql} -\title{reveql} +\name{reverseOperonSeq} +\alias{reverseOperonSeq} +\title{reverseOperonSeq} \usage{ -reveql(prot) +reverseOperonSeq(prot) } \arguments{ \item{prot}{} } \description{ -reveql +reverseOperonSeq } diff --git a/man/reverse_operon.Rd b/man/straightenOperonSeq.Rd similarity index 53% rename from man/reverse_operon.Rd rename to man/straightenOperonSeq.Rd index 270e2a62..fcd0c923 100644 --- a/man/reverse_operon.Rd +++ b/man/straightenOperonSeq.Rd @@ -1,14 +1,14 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/reverse_operons.R -\name{reverse_operon} -\alias{reverse_operon} -\title{reverse_operon} +\name{straightenOperonSeq} +\alias{straightenOperonSeq} +\title{straightenOperonSeq} \usage{ -reverse_operon(prot) +straightenOperonSeq(prot) } \arguments{ \item{prot}{} } \description{ -reverse_operon +straightenOperonSeq } diff --git a/man/summarizebylineage.Rd b/man/summarizebylineage.Rd deleted file mode 100644 index 2e445913..00000000 --- a/man/summarizebylineage.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/summarize.R -\name{summarizeByLineage} -\alias{summarizeByLineage} -\title{Summarize by Lineage} -\usage{ -summarizeByLineage(prot = "prot", column = "DomArch", by = "Lineage", query) -} -\arguments{ -\item{query}{} -} -\value{ -Describe return, in detail -} -\description{ -Summarize by Lineage -} -\examples{ -\dontrun{ -library(tidyverse) -tibble(DomArch = c("a+b", "a+b", "b+c", "a+b"), Lineage = c("l1", "l1", "l1", "l2")) |> - summarizeByLineage(query = "all") -} - -} diff --git a/man/totalgencontextordomarchcounts.Rd b/man/totalgencontextordomarchcounts.Rd deleted file mode 100644 index f457cb6a..00000000 --- a/man/totalgencontextordomarchcounts.Rd +++ /dev/null @@ -1,42 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/summarize.R -\name{totalGenContextOrDomArchCounts} -\alias{totalGenContextOrDomArchCounts} -\title{Total Counts} -\usage{ -totalGenContextOrDomArchCounts( - prot, - column = "DomArch", - lineage_col = "Lineage", - cutoff = 90, - RowsCutoff = FALSE, - digits = 2 -) -} -\arguments{ -\item{prot}{A data frame that must contain columns: -\itemize{\item Either 'GenContext' or 'DomArch.norep' \item count}} - -\item{column}{Character. The column to summarize} - -\item{cutoff}{Numeric. Cutoff for total count. Counts below cutoff value will not be shown. Default is 0.} - -\item{digits}{} -} -\value{ -Define return, in detail -} -\description{ -Creates a data frame with a totalcount column - -This function is designed to sum the counts column by either Genomic Context or Domain Architecture and creates a totalcount column from those sums. -} -\note{ -Please refer to the source code if you have alternate file formats and/or -column names. -} -\examples{ -\dontrun{ -totalGenContextOrDomArchCounts(pspa - gc_lin_counts, 0, "GC") -} -} diff --git a/man/words2wordcounts.Rd b/man/words2wordcounts.Rd deleted file mode 100644 index 7f60f226..00000000 --- a/man/words2wordcounts.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/summarize.R -\name{words2WordCounts} -\alias{words2WordCounts} -\title{Words 2 Word Counts} -\usage{ -words2WordCounts(string) -} -\arguments{ -\item{string}{} -} -\value{ -\link{tbl_df} table with 2 columns: 1) words & 2) counts/frequency -} -\description{ -Get word counts (wc) \link{DOMAINS (DA) or DOMAIN ARCHITECTURES (GC)} -} -\examples{ -\dontrun{ -tibble::tibble(DomArch = c("aaa+bbb", "a+b", "b+c", "b-c")) |> - elements2Words() |> - words2WordCounts() -} - -} diff --git a/man/write.MsaAAMultipleAlignment.Rd b/man/write.MsaAAMultipleAlignment.Rd index 17a05f50..e26f26e7 100644 --- a/man/write.MsaAAMultipleAlignment.Rd +++ b/man/write.MsaAAMultipleAlignment.Rd @@ -1,11 +1,9 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R \name{write.MsaAAMultipleAlignment} \alias{write.MsaAAMultipleAlignment} \title{Write MsaAAMultpleAlignment Objects as algined fasta sequence} \usage{ -write.MsaAAMultipleAlignment(alignment, outpath) - write.MsaAAMultipleAlignment(alignment, outpath) } \arguments{ @@ -16,10 +14,6 @@ write.MsaAAMultipleAlignment(alignment, outpath) \description{ MsaAAMultipleAlignment Objects are generated from calls to msaClustalOmega and msaMuscle from the 'msa' package - -Write MsaAAMultpleAlignment Objects as algined fasta sequence -MsaAAMultipleAlignment Objects are generated from calls to msaClustalOmega -and msaMuscle from the 'msa' package } \author{ Samuel Chen, Janani Ravi diff --git a/man/writeMSA_AA2FA.Rd b/man/writeMSA_AA2FA.Rd new file mode 100644 index 00000000..068e5b63 --- /dev/null +++ b/man/writeMSA_AA2FA.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/pre-msa-tree.R +\name{writeMSA_AA2FA} +\alias{writeMSA_AA2FA} +\title{writeMSA_AA2FA} +\usage{ +writeMSA_AA2FA(alignment, outpath) +} +\arguments{ +\item{alignment}{MsaAAMultipleAlignment object to be written as a fasta} + +\item{outpath}{Where the resulting FASTA file should be written to} +} +\description{ +Write MsaAAMultpleAlignment Objects as aligned fasta sequence +MsaAAMultipleAlignment Objects are generated from calls to msaClustalOmega +and msaMuscle from the 'msa' package +} +\author{ +Samuel Chen, Janani Ravi +} From 56b39da61292ae0facc31c104e90927f2483413e Mon Sep 17 00:00:00 2001 From: David Mayer Date: Fri, 11 Oct 2024 13:54:22 -0600 Subject: [PATCH 2/5] let R manage NAMESPACE sort order --- NAMESPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NAMESPACE b/NAMESPACE index 08f3aa92..dc5c95a4 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -52,8 +52,8 @@ export(gc_undirected_network) export(generateAllAlignments2FA) export(generate_all_aln2fa) export(generate_msa) -export(getTopAccByLinDomArch) export(getAccNumFromFA) +export(getTopAccByLinDomArch) export(get_accnums_from_fasta_file) export(get_proc_medians) export(get_proc_weights) From a74fb69a54f6a6ca39005f0b4d8cbf4dc15ee91c Mon Sep 17 00:00:00 2001 From: David Mayer Date: Fri, 11 Oct 2024 18:41:02 -0600 Subject: [PATCH 3/5] maintain function name consistency with CHANGED-pre-msa-tree.R and pre-msa-tree.R while we determine where these functions should live. --- NAMESPACE | 1 - R/CHANGED-pre-msa-tree.R | 6 +++--- man/write.MsaAAMultipleAlignment.Rd | 20 -------------------- man/writeMSA_AA2FA.Rd | 7 ++++++- 4 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 man/write.MsaAAMultipleAlignment.Rd diff --git a/NAMESPACE b/NAMESPACE index dc5c95a4..7271b65f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -104,7 +104,6 @@ export(to_titlecase) export(totalGenContextOrDomArchCounts) export(validateCountDF) export(wordcloud3) -export(write.MsaAAMultipleAlignment) export(writeMSA_AA2FA) export(write_proc_medians_table) export(write_proc_medians_yml) diff --git a/R/CHANGED-pre-msa-tree.R b/R/CHANGED-pre-msa-tree.R index c4a97589..a755df8c 100644 --- a/R/CHANGED-pre-msa-tree.R +++ b/R/CHANGED-pre-msa-tree.R @@ -610,12 +610,12 @@ alignFasta <- function(fasta_file, tool = "Muscle", outpath = NULL) { ) if (typeof(outpath) == "character") { - write.MsaAAMultipleAlignment(aligned, outpath) + writeMSA_AA2FA(aligned, outpath) } return(aligned) } -#' Write MsaAAMultpleAlignment Objects as algined fasta sequence +#' writeMSA_AA2FA #' #' @description #' MsaAAMultipleAlignment Objects are generated from calls to msaClustalOmega @@ -632,7 +632,7 @@ alignFasta <- function(fasta_file, tool = "Muscle", outpath = NULL) { #' @export #' #' @examples -write.MsaAAMultipleAlignment <- function(alignment, outpath) { +writeMSA_AA2FA <- function(alignment, outpath) { l <- length(rownames(alignment)) fasta <- "" for (i in 1:l) diff --git a/man/write.MsaAAMultipleAlignment.Rd b/man/write.MsaAAMultipleAlignment.Rd deleted file mode 100644 index e26f26e7..00000000 --- a/man/write.MsaAAMultipleAlignment.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R -\name{write.MsaAAMultipleAlignment} -\alias{write.MsaAAMultipleAlignment} -\title{Write MsaAAMultpleAlignment Objects as algined fasta sequence} -\usage{ -write.MsaAAMultipleAlignment(alignment, outpath) -} -\arguments{ -\item{alignment}{MsaAAMultipleAlignment object to be written as a fasta} - -\item{outpath}{Where the resulting FASTA file should be written to} -} -\description{ -MsaAAMultipleAlignment Objects are generated from calls to msaClustalOmega -and msaMuscle from the 'msa' package -} -\author{ -Samuel Chen, Janani Ravi -} diff --git a/man/writeMSA_AA2FA.Rd b/man/writeMSA_AA2FA.Rd index 068e5b63..a6798469 100644 --- a/man/writeMSA_AA2FA.Rd +++ b/man/writeMSA_AA2FA.Rd @@ -1,9 +1,11 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R \name{writeMSA_AA2FA} \alias{writeMSA_AA2FA} \title{writeMSA_AA2FA} \usage{ +writeMSA_AA2FA(alignment, outpath) + writeMSA_AA2FA(alignment, outpath) } \arguments{ @@ -12,6 +14,9 @@ writeMSA_AA2FA(alignment, outpath) \item{outpath}{Where the resulting FASTA file should be written to} } \description{ +MsaAAMultipleAlignment Objects are generated from calls to msaClustalOmega +and msaMuscle from the 'msa' package + Write MsaAAMultpleAlignment Objects as aligned fasta sequence MsaAAMultipleAlignment Objects are generated from calls to msaClustalOmega and msaMuscle from the 'msa' package From 5fcd985a88ab270245a554a44adb557fa02acaed Mon Sep 17 00:00:00 2001 From: David Mayer Date: Fri, 11 Oct 2024 18:42:56 -0600 Subject: [PATCH 4/5] maintain function name consistency across .R files while other determinations are made - getAccNumFromFA() --- NAMESPACE | 1 - R/CHANGED-pre-msa-tree.R | 4 ++-- man/getAccNumFromFA.Rd | 6 +++++- man/get_accnums_from_fasta_file.Rd | 14 -------------- 4 files changed, 7 insertions(+), 18 deletions(-) delete mode 100644 man/get_accnums_from_fasta_file.Rd diff --git a/NAMESPACE b/NAMESPACE index 7271b65f..23b29248 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -54,7 +54,6 @@ export(generate_all_aln2fa) export(generate_msa) export(getAccNumFromFA) export(getTopAccByLinDomArch) -export(get_accnums_from_fasta_file) export(get_proc_medians) export(get_proc_weights) export(make_opts2procs) diff --git a/R/CHANGED-pre-msa-tree.R b/R/CHANGED-pre-msa-tree.R index a755df8c..767d51aa 100644 --- a/R/CHANGED-pre-msa-tree.R +++ b/R/CHANGED-pre-msa-tree.R @@ -645,7 +645,7 @@ writeMSA_AA2FA <- function(alignment, outpath) { return(fasta) } -#' Get accnums from fasta file +#' getAccNumFromFA #' #' @param fasta_file #' @@ -655,7 +655,7 @@ writeMSA_AA2FA <- function(alignment, outpath) { #' @export #' #' @examples -get_accnums_from_fasta_file <- function(fasta_file) { +getAccNumFromFA <- function(fasta_file) { txt <- read_file(fasta_file) accnums <- stringi::stri_extract_all_regex(fasta_file, "(?<=>)[\\w,.]+")[[1]] return(accnums) diff --git a/man/getAccNumFromFA.Rd b/man/getAccNumFromFA.Rd index f2409965..d3ab8177 100644 --- a/man/getAccNumFromFA.Rd +++ b/man/getAccNumFromFA.Rd @@ -1,14 +1,18 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R \name{getAccNumFromFA} \alias{getAccNumFromFA} \title{getAccNumFromFA} \usage{ +getAccNumFromFA(fasta_file) + getAccNumFromFA(fasta_file) } \arguments{ \item{fasta_file}{} } \description{ +getAccNumFromFA + getAccNumFromFA } diff --git a/man/get_accnums_from_fasta_file.Rd b/man/get_accnums_from_fasta_file.Rd deleted file mode 100644 index f545d1a0..00000000 --- a/man/get_accnums_from_fasta_file.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R -\name{get_accnums_from_fasta_file} -\alias{get_accnums_from_fasta_file} -\title{Get accnums from fasta file} -\usage{ -get_accnums_from_fasta_file(fasta_file) -} -\arguments{ -\item{fasta_file}{} -} -\description{ -Get accnums from fasta file -} From d544f7ef932be8b44f04d1fae85bf715d976260b Mon Sep 17 00:00:00 2001 From: David Mayer Date: Fri, 11 Oct 2024 18:54:49 -0600 Subject: [PATCH 5/5] additional cross .R file consistency while other function placement decisions are made --- NAMESPACE | 7 ---- R/CHANGED-pre-msa-tree.R | 25 +++++++++++---- R/pre-msa-tree.R | 36 +++++++++++++-------- man/RepresentativeAccNums.Rd | 23 -------------- man/acc2fa.Rd | 3 ++ man/addLeaves2Alignment.Rd | 25 +++++++++++++-- man/addName.Rd | 18 +++++++++-- man/add_leaves.Rd | 50 ----------------------------- man/add_name.Rd | 39 ----------------------- man/alignFasta.Rd | 4 ++- man/convert2TitleCase.Rd | 9 +++++- man/convertAlignment2FA.Rd | 21 ++++++++++-- man/convert_aln2fa.Rd | 53 ------------------------------- man/createRepresentativeAccNum.Rd | 10 +++++- man/generateAllAlignments2FA.Rd | 35 ++++++++++++++++---- man/generate_all_aln2fa.Rd | 48 ---------------------------- man/mapAcc2Name.Rd | 10 ++++-- man/map_acc2name.Rd | 21 ------------ man/to_titlecase.Rd | 25 --------------- 19 files changed, 158 insertions(+), 304 deletions(-) delete mode 100644 man/RepresentativeAccNums.Rd delete mode 100644 man/add_leaves.Rd delete mode 100644 man/add_name.Rd delete mode 100644 man/convert_aln2fa.Rd delete mode 100644 man/generate_all_aln2fa.Rd delete mode 100644 man/map_acc2name.Rd delete mode 100644 man/to_titlecase.Rd diff --git a/NAMESPACE b/NAMESPACE index 23b29248..fe4c23d6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,7 +4,6 @@ export(BinaryDomainNetwork) export(GCA2Lineage) export(GenContextNetwork) export(IPG2Lineage) -export(RepresentativeAccNums) export(acc2FA) export(acc2Lineage) export(acc2fa) @@ -12,8 +11,6 @@ export(addLeaves2Alignment) export(addLineage) export(addName) export(addTaxID) -export(add_leaves) -export(add_name) export(advanced_opts2est_walltime) export(alignFasta) export(assign_job_queue) @@ -31,7 +28,6 @@ export(convert2TitleCase) export(convertAlignment2FA) export(convertAlignment2Trees) export(convertFA2Tree) -export(convert_aln2fa) export(countByColumn) export(createFA2Tree) export(createJobResultsURL) @@ -50,7 +46,6 @@ export(findParalogs) export(formatJobArgumentsHTML) export(gc_undirected_network) export(generateAllAlignments2FA) -export(generate_all_aln2fa) export(generate_msa) export(getAccNumFromFA) export(getTopAccByLinDomArch) @@ -58,7 +53,6 @@ export(get_proc_medians) export(get_proc_weights) export(make_opts2procs) export(mapAcc2Name) -export(map_acc2name) export(map_advanced_opts2procs) export(msa_pdf) export(plotIPR2Viz) @@ -99,7 +93,6 @@ export(summarizeGenContext) export(summarizeGenContext_ByDomArchLineage) export(summarizeGenContext_ByLineage) export(themeGenes2) -export(to_titlecase) export(totalGenContextOrDomArchCounts) export(validateCountDF) export(wordcloud3) diff --git a/R/CHANGED-pre-msa-tree.R b/R/CHANGED-pre-msa-tree.R index 767d51aa..2f6c8a62 100644 --- a/R/CHANGED-pre-msa-tree.R +++ b/R/CHANGED-pre-msa-tree.R @@ -54,7 +54,7 @@ convert2TitleCase <- function(x, y = " ") { ################################ ## Function to add leaves to an alignment file ## !! Add DA to leaves? -#' Adding Leaves to an alignment file w/ accessions +#' addLeaves2Alignment #' #' @author Janani Ravi #' @keywords alignment, accnum, leaves, lineage, species @@ -178,7 +178,7 @@ addLeaves2Alignment <- function(aln_file = "", } -#' Add Name +#' addName #' #' @author Samuel Chen, Janani Ravi #' @description This function adds a new 'Name' column that is comprised of components from @@ -252,7 +252,7 @@ addName <- function(data, ################################ ## Function to convert alignment 'aln' to fasta format for MSA + Tree -#' Adding Leaves to an alignment file w/ accessions +#' convertAlignment2FA #' #' @author Janani Ravi #' @keywords alignment, accnum, leaves, lineage, species @@ -320,6 +320,9 @@ convertAlignment2FA <- function(aln_file = "", return(fasta) } +#' mapAcc2Name +#' +#' @description #' Default renameFA() replacement function. Maps an accession number to its name #' #' @param line The line of a fasta file starting with '>' @@ -382,6 +385,9 @@ renameFA <- function(fa_path, outpath, ################################ ## generateAllAlignments2FA +#' generateAllAlignments2FA +#' +#' @description #' Adding Leaves to an alignment file w/ accessions #' #' @keywords alignment, accnum, leaves, lineage, species @@ -441,10 +447,11 @@ generateAllAlignments2FA <- function(aln_path = here("data/rawdata_aln/"), # accessions <- c("P12345","Q9UHC1","O15530","Q14624","P0DTD1") # accessions <- rep("ANY95992.1", 201) -#' acc2FA converts protein accession numbers to a fasta format. +#' acc2FA #' #' @description -#' Resulting fasta file is written to the outpath. +#' converts protein accession numbers to a fasta format. Resulting +#' fasta file is written to the outpath. #' #' @author Samuel Chen, Janani Ravi #' @keywords accnum, fasta @@ -539,6 +546,9 @@ acc2FA <- function(accessions, outpath, plan = "sequential") { return(result) } +#' createRepresentativeAccNum +#' +#' @description #' Function to generate a vector of one Accession number per distinct observation from 'reduced' column #' #' @author Samuel Chen, Janani Ravi @@ -556,7 +566,7 @@ acc2FA <- function(accessions, outpath, plan = "sequential") { #' @export #' #' @examples -RepresentativeAccNums <- function(prot_data, +createRepresentativeAccNum <- function(prot_data, reduced = "Lineage", accnum_col = "AccNum") { # Get Unique reduced column and then bind the AccNums back to get one AccNum per reduced column @@ -585,6 +595,9 @@ RepresentativeAccNums <- function(prot_data, return(accessions) } +#' alignFasta +#' +#' @description #' Perform a Multiple Sequence Alignment on a FASTA file. #' #' @author Samuel Chen, Janani Ravi diff --git a/R/pre-msa-tree.R b/R/pre-msa-tree.R index fed495f4..290a1644 100644 --- a/R/pre-msa-tree.R +++ b/R/pre-msa-tree.R @@ -49,7 +49,7 @@ api_key <- Sys.getenv("ENTREZ_API_KEY", unset = "YOUR_KEY_HERE") #' @export #' #' @examples -to_titlecase <- function(x, y = " ") { +convert2TitleCase <- function(x, y = " ") { s <- strsplit(x, y)[[1]] paste(toupper(substring(s, 1, 1)), substring(s, 2), sep = "", collapse = y @@ -59,7 +59,7 @@ to_titlecase <- function(x, y = " ") { ################################ ## Function to add leaves to an alignment file ## !! Add DA to leaves? -#' Adding Leaves to an alignment file w/ accessions +#' addLeaves2Alignment #' #' @author Janani Ravi #' @@ -95,9 +95,9 @@ to_titlecase <- function(x, y = " ") { #' #' @examples #' \dontrun{ -#' add_leaves("pspa_snf7.aln", "pspa.txt") +#' addLeaves2Alignment("pspa_snf7.aln", "pspa.txt") #' } -add_leaves <- function(aln_file = "", +addLeaves2Alignment <- function(aln_file = "", lin_file = "data/rawdata_tsv/all_semiclean.txt", # !! finally change to all_clean.txt!! # lin_file="data/rawdata_tsv/PspA.txt", reduced = FALSE) { @@ -184,7 +184,7 @@ add_leaves <- function(aln_file = "", } -#' Title +#' addName #' #' @author Samuel Chen, Janani Ravi #' @@ -209,7 +209,7 @@ add_leaves <- function(aln_file = "", #' @export #' #' @examples -add_name <- function(data, +addName <- function(data, accnum_col = "AccNum", spec_col = "Species", lin_col = "Lineage", lin_sep = ">", out_col = "Name") { cols <- c(accnum_col, "Kingdom", "Phylum", "Genus", "Spp") @@ -258,7 +258,7 @@ add_name <- function(data, ################################ ## Function to convert alignment 'aln' to fasta format for MSA + Tree -#' Adding Leaves to an alignment file w/ accessions +#' convertAlignment2FA #' #' @author Janani Ravi #' @@ -288,9 +288,9 @@ add_name <- function(data, #' #' @examples #' \dontrun{ -#' add_leaves("pspa_snf7.aln", "pspa.txt") +#' convertAlignment2FA("pspa_snf7.aln", "pspa.txt") #' } -convert_aln2fa <- function(aln_file = "", +convertAlignment2FA <- function(aln_file = "", lin_file = "data/rawdata_tsv/all_semiclean.txt", # !! finally change to all_clean.txt!! fa_outpath = "", reduced = FALSE) { @@ -324,6 +324,9 @@ convert_aln2fa <- function(aln_file = "", return(fasta) } +#' mapAcc2Name +#' +#' @description #' Default rename_fasta() replacement function. Maps an accession number to its name #' #' @param line he line of a fasta file starting with '>' @@ -340,7 +343,7 @@ convert_aln2fa <- function(aln_file = "", #' @export #' #' @examples -map_acc2name <- function(line, acc2name, acc_col = "AccNum", name_col = "Name") { +mapAcc2Name <- function(line, acc2name, acc_col = "AccNum", name_col = "Name") { # change to be the name equivalent to an add_names column # Find the first ' ' end_acc <- str_locate(line, " ")[[1]] @@ -386,7 +389,10 @@ rename_fasta <- function(fa_path, outpath, } ################################ -## generate_all_aln2fa +## generateAllAlignments2FA +#' generateAllAlignments2FA +#' +#' @description #' Adding Leaves to an alignment file w/ accessions #' #' @author Janani Ravi @@ -413,9 +419,9 @@ rename_fasta <- function(fa_path, outpath, #' #' @examples #' \dontrun{ -#' generate_all_aln2fa() +#' generateAllAlignments2FA() #' } -generate_all_aln2fa <- function(aln_path = here("data/rawdata_aln/"), +generateAllAlignments2FA <- function(aln_path = here("data/rawdata_aln/"), fa_outpath = here("data/alns/"), lin_file = here("data/rawdata_tsv/all_semiclean.txt"), reduced = F) { @@ -448,6 +454,10 @@ generate_all_aln2fa <- function(aln_path = here("data/rawdata_aln/"), # accessions <- rep("ANY95992.1", 201) #' acc2fa #' +#' @description +#' converts protein accession numbers to a fasta format. Resulting +#' fasta file is written to the outpath. +#' #' @author Samuel Chen, Janani Ravi #' @keywords accnum, fasta #' diff --git a/man/RepresentativeAccNums.Rd b/man/RepresentativeAccNums.Rd deleted file mode 100644 index 57d1f1ab..00000000 --- a/man/RepresentativeAccNums.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R -\name{RepresentativeAccNums} -\alias{RepresentativeAccNums} -\title{Function to generate a vector of one Accession number per distinct observation from 'reduced' column} -\usage{ -RepresentativeAccNums(prot_data, reduced = "Lineage", accnum_col = "AccNum") -} -\arguments{ -\item{prot_data}{Data frame containing Accession Numbers} - -\item{reduced}{Column from prot_data from which distinct observations -will be generated from. -One accession number will be assigned for each of these observations} - -\item{accnum_col}{Column from prot_data that contains Accession Numbers} -} -\description{ -Function to generate a vector of one Accession number per distinct observation from 'reduced' column -} -\author{ -Samuel Chen, Janani Ravi -} diff --git a/man/acc2fa.Rd b/man/acc2fa.Rd index 158b2d51..3e7a756d 100644 --- a/man/acc2fa.Rd +++ b/man/acc2fa.Rd @@ -15,6 +15,9 @@ Function may not work for vectors of length > 10,000} \item{plan}{} } \description{ +converts protein accession numbers to a fasta format. Resulting +fasta file is written to the outpath. + acc2fa converts protein accession numbers to a fasta format. Resulting fasta file is written to the outpath. } diff --git a/man/addLeaves2Alignment.Rd b/man/addLeaves2Alignment.Rd index a758ebd5..d00e6df7 100644 --- a/man/addLeaves2Alignment.Rd +++ b/man/addLeaves2Alignment.Rd @@ -1,9 +1,15 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R \name{addLeaves2Alignment} \alias{addLeaves2Alignment} -\title{Adding Leaves to an alignment file w/ accessions} +\title{addLeaves2Alignment} \usage{ +addLeaves2Alignment( + aln_file = "", + lin_file = "data/rawdata_tsv/all_semiclean.txt", + reduced = FALSE +) + addLeaves2Alignment( aln_file = "", lin_file = "data/rawdata_tsv/all_semiclean.txt", @@ -11,7 +17,7 @@ addLeaves2Alignment( ) } \arguments{ -\item{aln_file}{haracter. Path to file. Input tab-delimited file + +\item{aln_file}{Character. Path to file. Input tab-delimited file + alignment file accnum & alignment. Default is 'pspa_snf7.aln'} @@ -23,15 +29,25 @@ Default is 'pspa.txt'} only one sequence per lineage. Default is FALSE.} } \description{ +Adding Leaves to an alignment file w/ accessions +Genomic Contexts vs Domain Architectures. + Adding Leaves to an alignment file w/ accessions Genomic Contexts vs Domain Architectures. } \details{ +The alignment file would need two columns: 1. accession + +number and 2. alignment. The protein homolog accession to lineage mapping + +file should have + The alignment file would need two columns: 1. accession + number and 2. alignment. The protein homolog accession to lineage mapping + file should have } \note{ +Please refer to the source code if you have alternate + +file formats and/or column names. + Please refer to the source code if you have alternate + file formats and/or column names. } @@ -39,6 +55,9 @@ file formats and/or column names. \dontrun{ addLeaves2Alignment("pspa_snf7.aln", "pspa.txt") } +\dontrun{ +addLeaves2Alignment("pspa_snf7.aln", "pspa.txt") +} } \author{ Janani Ravi diff --git a/man/addName.Rd b/man/addName.Rd index e04f9849..6f171456 100644 --- a/man/addName.Rd +++ b/man/addName.Rd @@ -1,9 +1,18 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R \name{addName} \alias{addName} -\title{Add Name} +\title{addName} \usage{ +addName( + data, + accnum_col = "AccNum", + spec_col = "Species", + lin_col = "Lineage", + lin_sep = ">", + out_col = "Name" +) + addName( data, accnum_col = "AccNum", @@ -28,9 +37,14 @@ addName( Lineage, and AccNum info} } \value{ +Original data with a 'Name' column + Original data with a 'Name' column } \description{ +This function adds a new 'Name' column that is comprised of components from +Kingdom, Phylum, Genus, and species, as well as the accession + This function adds a new 'Name' column that is comprised of components from Kingdom, Phylum, Genus, and species, as well as the accession } diff --git a/man/add_leaves.Rd b/man/add_leaves.Rd deleted file mode 100644 index f1eeed10..00000000 --- a/man/add_leaves.Rd +++ /dev/null @@ -1,50 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pre-msa-tree.R -\name{add_leaves} -\alias{add_leaves} -\title{Adding Leaves to an alignment file w/ accessions} -\usage{ -add_leaves( - aln_file = "", - lin_file = "data/rawdata_tsv/all_semiclean.txt", - reduced = FALSE -) -} -\arguments{ -\item{aln_file}{Character. Path to file. Input tab-delimited file + -alignment file accnum & alignment. -Default is 'pspa_snf7.aln'} - -\item{lin_file}{Character. Path to file. Protein file with accession + -number to lineage mapping. -Default is 'pspa.txt'} - -\item{reduced}{Boolean. If TRUE, a reduced data frame will be generated with -only one sequence per lineage. Default is FALSE.} -} -\description{ -Adding Leaves to an alignment file w/ accessions -Genomic Contexts vs Domain Architectures. -} -\details{ -The alignment file would need two columns: 1. accession + -number and 2. alignment. The protein homolog accession to lineage mapping + -file should have -} -\note{ -Please refer to the source code if you have alternate + -file formats and/or column names. -} -\examples{ -\dontrun{ -add_leaves("pspa_snf7.aln", "pspa.txt") -} -} -\author{ -Janani Ravi -} -\keyword{accnum,} -\keyword{alignment,} -\keyword{leaves,} -\keyword{lineage,} -\keyword{species} diff --git a/man/add_name.Rd b/man/add_name.Rd deleted file mode 100644 index f19139e1..00000000 --- a/man/add_name.Rd +++ /dev/null @@ -1,39 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pre-msa-tree.R -\name{add_name} -\alias{add_name} -\title{Title} -\usage{ -add_name( - data, - accnum_col = "AccNum", - spec_col = "Species", - lin_col = "Lineage", - lin_sep = ">", - out_col = "Name" -) -} -\arguments{ -\item{data}{Data to add name column to} - -\item{accnum_col}{Column containing accession numbers} - -\item{spec_col}{Column containing species} - -\item{lin_col}{Column containing lineage} - -\item{lin_sep}{Character separating lineage levels} - -\item{out_col}{Column that contains the new 'Name' derived from Species, -Lineage, and AccNum info} -} -\value{ -Original data with a 'Name' column -} -\description{ -This function adds a new 'Name' column that is comprised of components from -Kingdom, Phylum, Genus, and species, as well as the accession -} -\author{ -Samuel Chen, Janani Ravi -} diff --git a/man/alignFasta.Rd b/man/alignFasta.Rd index 21b020cf..02a3026b 100644 --- a/man/alignFasta.Rd +++ b/man/alignFasta.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R \name{alignFasta} \alias{alignFasta} -\title{Perform a Multiple Sequence Alignment on a FASTA file.} +\title{alignFasta} \usage{ alignFasta(fasta_file, tool = "Muscle", outpath = NULL) @@ -21,6 +21,8 @@ aligned fasta sequence as a MsaAAMultipleAlignment object aligned fasta sequence as a MsaAAMultipleAlignment object } \description{ +Perform a Multiple Sequence Alignment on a FASTA file. + Perform a Multiple Sequence Alignment on a FASTA file. } \author{ diff --git a/man/convert2TitleCase.Rd b/man/convert2TitleCase.Rd index 84e7fa00..72619285 100644 --- a/man/convert2TitleCase.Rd +++ b/man/convert2TitleCase.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R \name{convert2TitleCase} \alias{convert2TitleCase} \alias{totitle,} @@ -7,6 +7,8 @@ \title{Changing case to 'Title Case'} \usage{ convert2TitleCase(text, delimitter) + +to_titlecase(text, delimitter) } \arguments{ \item{x}{Character vector.} @@ -15,8 +17,13 @@ convert2TitleCase(text, delimitter) } \description{ Translate string to Title Case w/ delimitter. + +Translate string to Title Case w/ delimitter. +Changing case to 'Title Case' } \seealso{ +chartr, toupper, and tolower. + chartr, toupper, and tolower. } \author{ diff --git a/man/convertAlignment2FA.Rd b/man/convertAlignment2FA.Rd index d6b4dc56..8e9ceb94 100644 --- a/man/convertAlignment2FA.Rd +++ b/man/convertAlignment2FA.Rd @@ -1,9 +1,16 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R \name{convertAlignment2FA} \alias{convertAlignment2FA} -\title{Adding Leaves to an alignment file w/ accessions} +\title{convertAlignment2FA} \usage{ +convertAlignment2FA( + aln_file = "", + lin_file = "data/rawdata_tsv/all_semiclean.txt", + fa_outpath = "", + reduced = FALSE +) + convertAlignment2FA( aln_file = "", lin_file = "data/rawdata_tsv/all_semiclean.txt", @@ -31,11 +38,18 @@ Adding Leaves to an alignment file w/ accessions Genomic Contexts vs Domain Architectures. } \details{ +The alignment file would need two columns: 1. accession + +number and 2. alignment. The protein homolog accession to lineage mapping + +file should have + The alignment file would need two columns: 1. accession + number and 2. alignment. The protein homolog accession to lineage mapping + file should have } \note{ +Please refer to the source code if you have alternate + +file formats and/or column names. + Please refer to the source code if you have alternate + file formats and/or column names. } @@ -44,6 +58,9 @@ file formats and/or column names. addLeaves2Alignment("pspa_snf7.aln", "pspa.txt") } +\dontrun{ +convertAlignment2FA("pspa_snf7.aln", "pspa.txt") +} } \author{ Janani Ravi diff --git a/man/convert_aln2fa.Rd b/man/convert_aln2fa.Rd deleted file mode 100644 index 8bebe31d..00000000 --- a/man/convert_aln2fa.Rd +++ /dev/null @@ -1,53 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pre-msa-tree.R -\name{convert_aln2fa} -\alias{convert_aln2fa} -\title{Adding Leaves to an alignment file w/ accessions} -\usage{ -convert_aln2fa( - aln_file = "", - lin_file = "data/rawdata_tsv/all_semiclean.txt", - fa_outpath = "", - reduced = FALSE -) -} -\arguments{ -\item{aln_file}{Character. Path to file. Input tab-delimited file + -alignment file accnum & alignment. -Default is 'pspa_snf7.aln'} - -\item{lin_file}{Character. Path to file. Protein file with accession + -number to lineage mapping. -Default is 'pspa.txt'} - -\item{fa_outpath}{Character. Path to the written fasta file. -Default is 'NULL'} - -\item{reduced}{Boolean. If TRUE, the fasta file will contain only one sequence per lineage. -Default is 'FALSE'} -} -\description{ -Adding Leaves to an alignment file w/ accessions -} -\details{ -The alignment file would need two columns: 1. accession + -number and 2. alignment. The protein homolog accession to lineage mapping + -file should have -} -\note{ -Please refer to the source code if you have alternate + -file formats and/or column names. -} -\examples{ -\dontrun{ -add_leaves("pspa_snf7.aln", "pspa.txt") -} -} -\author{ -Janani Ravi -} -\keyword{accnum,} -\keyword{alignment,} -\keyword{leaves,} -\keyword{lineage,} -\keyword{species} diff --git a/man/createRepresentativeAccNum.Rd b/man/createRepresentativeAccNum.Rd index 3703fe1a..3bd20522 100644 --- a/man/createRepresentativeAccNum.Rd +++ b/man/createRepresentativeAccNum.Rd @@ -1,9 +1,15 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R \name{createRepresentativeAccNum} \alias{createRepresentativeAccNum} \title{createRepresentativeAccNum} \usage{ +createRepresentativeAccNum( + prot_data, + reduced = "Lineage", + accnum_col = "AccNum" +) + createRepresentativeAccNum( prot_data, reduced = "Lineage", @@ -20,6 +26,8 @@ One accession number will be assigned for each of these observations} \item{accnum_col}{Column from prot_data that contains Accession Numbers} } \description{ +Function to generate a vector of one Accession number per distinct observation from 'reduced' column + Function to generate a vector of one Accession number per distinct observation from 'reduced' column } \author{ diff --git a/man/generateAllAlignments2FA.Rd b/man/generateAllAlignments2FA.Rd index 3bf9938a..8f9d8ffc 100644 --- a/man/generateAllAlignments2FA.Rd +++ b/man/generateAllAlignments2FA.Rd @@ -1,9 +1,16 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R \name{generateAllAlignments2FA} \alias{generateAllAlignments2FA} -\title{Adding Leaves to an alignment file w/ accessions} +\title{generateAllAlignments2FA} \usage{ +generateAllAlignments2FA( + aln_path = here("data/rawdata_aln/"), + fa_outpath = here("data/alns/"), + lin_file = here("data/rawdata_tsv/all_semiclean.txt"), + reduced = F +) + generateAllAlignments2FA( aln_path = here("data/rawdata_aln/"), fa_outpath = here("data/alns/"), @@ -15,28 +22,44 @@ generateAllAlignments2FA( \item{aln_path}{Character. Path to alignment files. Default is 'here("data/rawdata_aln/")'} -\item{fa_outpath}{Character. Path to file. Master protein file with AccNum & lineages. -Default is 'here("data/rawdata_tsv/all_semiclean.txt")'} - -\item{lin_file}{Character. Path to the written fasta file. +\item{fa_outpath}{Character. Path to the written fasta file. Default is 'here("data/alns/")'.} +\item{lin_file}{Character. Path to file. Master protein file with AccNum & lineages. +Default is 'here("data/rawdata_tsv/all_semiclean.txt")'} + \item{reduced}{Boolean. If TRUE, the fasta file will contain only one sequence per lineage. Default is 'FALSE'.} } \description{ +Adding Leaves to an alignment file w/ accessions + +Adding Leaves to all alignment files w/ accessions & DAs? + +Adding Leaves to an alignment file w/ accessions + Adding Leaves to all alignment files w/ accessions & DAs? } \details{ +The alignment files would need two columns separated by spaces: 1. AccNum and 2. alignment. The protein homolog file should have AccNum, Species, Lineages. + The alignment files would need two columns separated by spaces: 1. AccNum and 2. alignment. The protein homolog file should have AccNum, Species, Lineages. } \note{ +Please refer to the source code if you have alternate + file formats and/or column names. + Please refer to the source code if you have alternate + file formats and/or column names. } \examples{ \dontrun{ generateAllAlignments2FA() } +\dontrun{ +generateAllAlignments2FA() +} +} +\author{ +Janani Ravi } \keyword{accnum,} \keyword{alignment,} diff --git a/man/generate_all_aln2fa.Rd b/man/generate_all_aln2fa.Rd deleted file mode 100644 index ad6b7136..00000000 --- a/man/generate_all_aln2fa.Rd +++ /dev/null @@ -1,48 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pre-msa-tree.R -\name{generate_all_aln2fa} -\alias{generate_all_aln2fa} -\title{Adding Leaves to an alignment file w/ accessions} -\usage{ -generate_all_aln2fa( - aln_path = here("data/rawdata_aln/"), - fa_outpath = here("data/alns/"), - lin_file = here("data/rawdata_tsv/all_semiclean.txt"), - reduced = F -) -} -\arguments{ -\item{aln_path}{Character. Path to alignment files. -Default is 'here("data/rawdata_aln/")'} - -\item{fa_outpath}{Character. Path to the written fasta file. -Default is 'here("data/alns/")'.} - -\item{lin_file}{Character. Path to file. Master protein file with AccNum & lineages. -Default is 'here("data/rawdata_tsv/all_semiclean.txt")'} - -\item{reduced}{Boolean. If TRUE, the fasta file will contain only one sequence per lineage. -Default is 'FALSE'.} -} -\description{ -Adding Leaves to all alignment files w/ accessions & DAs? -} -\details{ -The alignment files would need two columns separated by spaces: 1. AccNum and 2. alignment. The protein homolog file should have AccNum, Species, Lineages. -} -\note{ -Please refer to the source code if you have alternate + file formats and/or column names. -} -\examples{ -\dontrun{ -generate_all_aln2fa() -} -} -\author{ -Janani Ravi -} -\keyword{accnum,} -\keyword{alignment,} -\keyword{leaves,} -\keyword{lineage,} -\keyword{species} diff --git a/man/mapAcc2Name.Rd b/man/mapAcc2Name.Rd index 0f5d447d..39ecb065 100644 --- a/man/mapAcc2Name.Rd +++ b/man/mapAcc2Name.Rd @@ -1,13 +1,15 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CHANGED-pre-msa-tree.R +% Please edit documentation in R/CHANGED-pre-msa-tree.R, R/pre-msa-tree.R \name{mapAcc2Name} \alias{mapAcc2Name} -\title{Default renameFA() replacement function. Maps an accession number to its name} +\title{mapAcc2Name} \usage{ +mapAcc2Name(line, acc2name, acc_col = "AccNum", name_col = "Name") + mapAcc2Name(line, acc2name, acc_col = "AccNum", name_col = "Name") } \arguments{ -\item{line}{The line of a fasta file starting with '>'} +\item{line}{he line of a fasta file starting with '>'} \item{acc2name}{Data Table containing a column of accession numbers and a name column} @@ -18,4 +20,6 @@ are mapped to} } \description{ Default renameFA() replacement function. Maps an accession number to its name + +Default rename_fasta() replacement function. Maps an accession number to its name } diff --git a/man/map_acc2name.Rd b/man/map_acc2name.Rd deleted file mode 100644 index fcdb3023..00000000 --- a/man/map_acc2name.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pre-msa-tree.R -\name{map_acc2name} -\alias{map_acc2name} -\title{Default rename_fasta() replacement function. Maps an accession number to its name} -\usage{ -map_acc2name(line, acc2name, acc_col = "AccNum", name_col = "Name") -} -\arguments{ -\item{line}{he line of a fasta file starting with '>'} - -\item{acc2name}{Data Table containing a column of accession numbers and a name column} - -\item{acc_col}{Name of the column containing Accession numbers} - -\item{name_col}{Name of the column containing the names that the accession numbers -are mapped to} -} -\description{ -Default rename_fasta() replacement function. Maps an accession number to its name -} diff --git a/man/to_titlecase.Rd b/man/to_titlecase.Rd deleted file mode 100644 index 45139d3b..00000000 --- a/man/to_titlecase.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pre-msa-tree.R -\name{to_titlecase} -\alias{to_titlecase} -\alias{totitle,} -\alias{to_title} -\title{To Titlecase} -\usage{ -to_titlecase(text, delimitter) -} -\arguments{ -\item{x}{Character vector.} - -\item{y}{Delimitter. Default is space (" ").} -} -\description{ -Translate string to Title Case w/ delimitter. -Changing case to 'Title Case' -} -\seealso{ -chartr, toupper, and tolower. -} -\author{ -Andrie, Janani Ravi -}