Open j-andrews7 opened 1 year ago
Ah yeah. I can work on a fix probably this weekend (sorry for the delay). In the mean time, you could do something like:
library(universalmotif)
read_meme("../motif_databases/MOUSE/HOCOMOCOv11_core_MOUSE_mono_meme_format.meme") %>%
to_df() %>%
mutate(altname = dplyr::row_number()) %>%
to_list() %>%
write_meme("your_db_file_with_altnames.meme")
Or if you prefer a non-tidy style method:
library(universalmotif)
db <- read_meme("/path/to/db.meme")
db["altname"] <- seq_along(db)
write_meme(db, "your_db_with_altname.meme")
You'll have to forgive me if there are some code errors above, cause I wrote this from memory quickly.
Oh and even more alternatively, since you'd be reading the db into memory at this point anyway, you could pass the corrected db
object directly to runTomTom(database = db)
.
Thanks. Worked with:
db <- read_meme("../motif_databases/MOUSE/HOCOMOCOv11_core_MOUSE_mono_meme_format.meme")
db <- lapply(seq_along(db), function(x) {
y <- db[[x]]
y@altname <- as.character(x)
y
})
Edit: this actually works better for this specific database and keeps them all as one database:
db <- read_meme("/hpcf/authorized_apps/rhel8_apps/meme/install/5.5.4/share/meme-5.5.4/db/motif_databases/MOUSE/HOCOMOCOv11_core_MOUSE_mono_meme_format.meme") %>%
to_df()
db$altname <- unlist(strsplit(db$name, "_"))[c(TRUE, FALSE)]
When using streme output, it seems some databases throw an error due to a missing column that's expected.
Other databases (JASPAR2022_CORE_vertebrates_non-redundant_v2.meme, for instance) run fine.