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

Made changes in assign_job_queue.R, cleanup.R, lineage.R, msa.R, tree.R #106

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ importFrom(shiny,showNotification)
importFrom(stats,as.formula)
importFrom(stats,complete.cases)
importFrom(stats,logLik)
importFrom(stats,median)
importFrom(stats,na.omit)
importFrom(stringi,stri_extract_all_regex)
importFrom(stringi,stri_replace_all_regex)
Expand Down Expand Up @@ -276,6 +277,7 @@ importFrom(tidyr,replace_na)
importFrom(tidyr,separate)
importFrom(tidyr,unite)
importFrom(utils,combn)
importFrom(utils,globalVariables)
importFrom(viridis,scale_fill_viridis)
importFrom(visNetwork,visEdges)
importFrom(visNetwork,visGroups)
Expand Down
5 changes: 3 additions & 2 deletions R/assign_job_queue.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ mapAdvOption2Process <- function(advanced_opts) {
#'
#' @importFrom dplyr across everything select summarise
#' @importFrom rlang warn abort inform
#'
#' @importFrom stats median
#'
#' @return [list] names: processes; values: median runtime (seconds)
#'
#' see molevol_scripts/R/metrics.R for info on functions called here
Expand Down Expand Up @@ -210,7 +211,7 @@ writeProcessRuntime2TSV <- function(dir_job_results, filepath) {
names_to = "process",
values_to = "median_seconds"
) |>
dplyr::arrange(dplyr::desc(median_seconds))
dplyr::arrange(dplyr::desc(.data$median_seconds))

# Write the resulting tibble to a TSV file
readr::write_tsv(df_proc_medians, file = filepath)
Expand Down
4 changes: 4 additions & 0 deletions R/globals.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# File to put all data.table variables that aren't defined otherwise

#' @importFrom utils globalVariables
utils::globalVariables(c("Protein"))
8 changes: 4 additions & 4 deletions R/lineage.R
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,10 @@ IPG2Lineage <- function(accessions, ipg_file,
{
# browser()
acc <- accessions[i]
acc_inds <- which(mergedTax$Protein == acc)
acc_inds <- which(.data$mergedTax$Protein == acc)
Copy link
Collaborator

@the-mayer the-mayer Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed and makes me think that the IPG2Lineage() function defined in acc2lin.R may be more recent/relevant. mergedTax looks like it may have been pulled from the Global Environment at some point in the past -- it will not work as it exists in this function.

Again, this is outside the scope of this issue, but something we will need to disambiguate (acc2lin.R vs lineage.R)/correct moving forward!

if (length(acc_inds) != 0) {
# refseq inds take precedence
refseq_inds <- acc_inds[which(mergedTax[acc_inds, ]$Source == "RefSeq")]
refseq_inds <- acc_inds[which(.data$mergedTax[acc_inds, ]$Source == "RefSeq")]
if (length(refseq_inds) != 0) {
# Take the first first row of the refseq (smallest index)
refseq_rows[i] <- refseq_inds[1]
Expand All @@ -424,15 +424,15 @@ IPG2Lineage <- function(accessions, ipg_file,
}
if (length(genbank_rows) != 0) {
genbank_ipg_dt <- ipg_dt[genbank_rows, ]
genbank_lins <- GCA2Lineage(gca_ipg_dt,
genbank_lins <- GCA2Lineage(.data$gca_ipg_dt,
assembly_path = genbank_assembly_path,
lineagelookup_path
)
}


lins <- GCA2Lineage(prot_data = ipg_dt, assembly_path, lineagelookup_path)
lins <- lins[!is.na(Lineage)] %>% unique()
lins <- lins[!is.na(.data$Lineage)] %>% unique()

return(lins)
}
Expand Down
2 changes: 1 addition & 1 deletion R/msa.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ createMSA_PDF <- function(fasta_path, out_path = NULL,
#' will be saved.
#'
#' @importFrom Biostrings readAAStringSet
#'
#'
#' @return A list containing the alignment object and the output file path.
#' @export
#'
Expand Down
5 changes: 1 addition & 4 deletions R/tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
convertFA2Tree <- function(fa_path = here("data/alns/pspa_snf7.fa"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these default/example files don't exist, we could remove them. Otherwise, placeholders that work might be a good idea!

tre_path = here("data/alns/pspa_snf7.tre"),
fasttree_path = here("src/FastTree")) {
# fa_path=here("data/alns/pspa_snf7.fa")
# tre_path=here("data/alns/pspa_snf7.tre")
# fasttree_path=here("src/FastTree")

# Check if the FASTA file exists
if (!file.exists(fa_path)) {
Expand Down Expand Up @@ -89,7 +86,7 @@ convertFA2Tree <- function(fa_path = here("data/alns/pspa_snf7.fa"),
message(fa_path)
system2(
command = fasttree_path,
args = paste(c(fa_path, ">", tre_path),
args = paste(c(fa_path, ">", .data$tre_path),
sep = "", collapse = " "
)
)
Expand Down
Loading