Include all species

This commit is contained in:
Elias Projahn 2021-08-25 12:00:22 +02:00
parent abab22a907
commit 129793e055

17
data.R
View file

@ -1,4 +1,5 @@
library(data.table)
library(rlog)
#' Merge genome data from files in `path` into `data.table`s.
#'
@ -26,14 +27,17 @@ load_data <- function(path) {
# Each file will contain data on one species.
file_names <- list.files(paste(path, "genomes", sep = "/"))
n_species <- length(file_names)
for (file_name in file_names) {
for (i in seq_along(file_names)) {
file_name <- file_names[i]
species_id <- strsplit(file_name, split = ".", fixed = TRUE)[[1]][1]
# Only continue for replicatively aging species.
# TODO: Which other species should be included?
if (original_species[id == species_id, group] == "replicative") {
species_path <- paste(path, "genomes", file_name, sep = "/")
log_info(sprintf(
"Reading species %i/%i (%s)", i, n_species, species_id
))
species_distances <- fread(species_path)
# Compute the median distance across all genes of this species and
@ -52,9 +56,8 @@ load_data <- function(path) {
distances <- rbindlist(list(distances, species_distances))
}
}
# Order species by there median distance.
# Order species by their median distance.
setorder(species, median_distance)
list(