#' @export
makeOrthologTable <- function (old_orthologs, spec_orth, prefix) {
library(tidyverse)
source("R/addXenLaeOrthologs.R")
new_column <- paste(prefix, ".gene.stable.ID", sep = "")
# Adds new species' genes to ortholog table
old_orthologs[new_column] <- as.character(c(NA)) # Adds newly created species label as a column
if (prefix == "XenLae") {
old_orthologs <- addXenLaeOrthologs(old_orthologs, spec_orth, new_column) # Handles Xenopus laevis polyploidy problem
}
else {
for (row in 1:nrow(old_orthologs)) {
gene <- old_orthologs[row, "Gene.name"][[1]]
gene_ref_ID <- NA
if (length(which(spec_orth$Gene.name == gene |
spec_orth$Gene.name == tolower(gene) |
spec_orth$Gene.name == toupper(gene))) > 0) {
gene_ref_ID <- as.character(spec_orth[which(spec_orth$Gene.name == gene |
spec_orth$Gene.name == tolower(gene) |
spec_orth$Gene.name == toupper(gene)), "Ref.ID"][[1]])
old_orthologs[row, new_column] <- gene_ref_ID
}
}
}
all_orthologs <- old_orthologs[which(!is.na(old_orthologs[new_column])), ] # Only keeps genes for which there is data for new species
return(all_orthologs)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.