From 7982ce9cb56569aca2b59e5ac46fa45bd59098e1 Mon Sep 17 00:00:00 2001 From: teddyCodex Date: Tue, 8 Oct 2024 18:34:23 +0100 Subject: [PATCH] refactor function names in pre-msa-tree and reverse_operons --- R/pre-msa-tree.R | 16 ++++++++-------- R/reverse_operons.R | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/pre-msa-tree.R b/R/pre-msa-tree.R index 44979c3c..833a1335 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) + writeMSAAAMultipleAlignment2FA(aligned, outpath) } return(aligned) } -#' write.MsaAAMultipleAlignment +#' writeMSAAAMultipleAlignment2FA #' #' @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) { +writeMSAAAMultipleAlignment2FA <- 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)