Created
September 3, 2021 17:43
-
-
Save chasemc/368af993165c0d928fd5b02732937ffc to your computer and use it in GitHub Desktop.
Parse HMMER domtblout in R, no dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse_domtblout_file <- function(dom){ | |
dom = readLines(dom) | |
dom <- dom[!grepl("^#", dom)] | |
dom <- lapply(strsplit(dom, "[ ]{1,}"), | |
function(x){ | |
parsed <- c(x[1:22], paste0(x[23:length(x)], collapse = " ")) | |
as.data.frame(t(parsed)) | |
}) | |
dom <- do.call(rbind, dom) | |
colnames(dom) <- c("target_name", | |
"target_accession", | |
"tlen", | |
"query_name", | |
"accession", | |
"qlen", | |
"E_value", | |
"score", | |
"bias", | |
"number", | |
"of", | |
"cEvalue", | |
"i_Evalue", | |
"score", | |
"bias", | |
"from_hmm_coord", | |
"to_hmm_coord", | |
"from_ali_coord", | |
"to_ali_coord", | |
"from_env_coord", | |
"to_env_coord", | |
"acc", | |
"description_of_target") | |
dom | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment