Andres Suarez

Generation

generate functionWed, 07 Jun 2023

I can find out if the compounds I have in a list belong to an organism using Keggrest R package.

library(Keggrest) compounds = c("C00159", "C00772", "C00678", "C00355", "C00022") is_in_organism <- function(compound, organism) { compound = toString(compound) organism = toString(organism) tryCatch( { resp <- kegg_compound_2_organism(compound) if (organism %in% resp) { return(TRUE) } else { return(FALSE) } }, error = function(err) { return(FALSE) } ) } is_in_organism("C00159", "eco")

Want to kickstart your project?Use the new AI Studio to create your code