Closed sa-lee closed 8 years ago
Incriminating code is here for ancestral_df
ances_lines <- s_f[(which(grepl("^Inferred ancestry of.*", s_f)) + 1):(which(grepl("^Estimated Allele Frequencies .*", s_f)) - 1)] ances_lines <- str_trim(ances_lines) ances_lines <- gsub("[(:)]", "", ances_lines) ances_lines <- str_split_fixed(ances_lines, "\\s+", n = 4 + pops) header <- ances_lines[1, ][1:3] ances_lines <- ances_lines[2:nrow(ances_lines), 2:ncol(ances_lines)] # if Label (column 1 contains a string value the next line will produce NAs class(ances_lines) <- "numeric" ancest_df <- data.frame(ances_lines) colnames(ancest_df)[1:3] <- header colnames(ancest_df)[4:ncol(ancest_df)] <- paste("Cluster", seq(1, ncol(ancest_df) - 3))
Incriminating code is here for ancestral_df