Skip to content

Commit

Permalink
refactor function names in pre-msa-tree and reverse_operons
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyCodex committed Oct 8, 2024
1 parent 1c22709 commit 7982ce9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions R/pre-msa-tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
#'
Expand All @@ -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)
Expand All @@ -660,7 +660,7 @@ write.MsaAAMultipleAlignment <- function(alignment, outpath) {
return(fasta)
}

#' get_accnums_from_fasta_file
#' getAccNumFromFA
#'
#' @param fasta_file
#'
Expand All @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions R/reverse_operons.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# Modified by Janani Ravi and Samuel Chen


#' reveql
#' straightenOperonSeq
#'
#' @param prot
#'
#' @return
#' @export
#'
#' @examples
reveql <- function(prot) {
straightenOperonSeq <- function(prot) {
w <- prot # $GenContext.orig # was 'x'

y <- rep(NA, length(w))
Expand Down Expand Up @@ -57,15 +57,15 @@ reveql <- function(prot) {

## The function to reverse operons

#' reverse_operon
#' reverseOperonSeq
#'
#' @param prot
#'
#' @return
#' @export
#'
#' @examples
reverse_operon <- function(prot) {
reverseOperonSeq <- function(prot) {
gencontext <- prot$GenContext

gencontext <- gsub(pattern = ">", replacement = ">|", x = gencontext)
Expand Down Expand Up @@ -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]

Expand Down Expand Up @@ -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)

0 comments on commit 7982ce9

Please sign in to comment.