Hi! Thanks for developing this package. I would like to recreate the module completeness heatmap in your documentation here using my own results of kegg mapper. I have lists of KO numbers for each genome and I'd like to visualize them. I am having trouble working with the code below. What exactly are the objects mf and candspid? They seem to be file lists, but of what file types?
Do you have suggestions for how to use the for loop with pre-computed KOs and avoid the mapper step?
## Load pre-computed KOs, and recursively perform completeness calculation.
mf <- list.files("../")
mf <- mf[startsWith(mf, "M")]
annos <- list()
candspid <- list.files("../species_dir")
candspid <- sample(candspid, 10)
## Obtain EC to KO mapping file from KEGG REST API
mapper <- data.table::fread("https://rest.kegg.jp/link/ec/ko", header=FALSE)
suppressMessages(
for (i in candspid) {
mcs <- NULL
df <- read.table(paste0("../species_dir/",i), sep="\t", header=1)
fid <- paste0("ec:",df[df$ontology=="ec",]$function_id)
kos <- mapper[mapper$V2 %in% fid,]$V1 |> strsplit(":") |> sapply("[",2) |> unique()
for (mid in mf) {
mc <- module_completeness(module(mid, directory="../"),
query = kos)
mcs <- c(mcs, mc$complete |> mean()) ## Mean of blocks
}
annos[[as.character(i)]] <- mcs
}
)
Hi! Thanks for developing this package. I would like to recreate the module completeness heatmap in your documentation here using my own results of kegg mapper. I have lists of KO numbers for each genome and I'd like to visualize them. I am having trouble working with the code below. What exactly are the objects
mfandcandspid? They seem to be file lists, but of what file types?Do you have suggestions for how to use the for loop with pre-computed KOs and avoid the mapper step?
Thanks!
Carmen