Andres Suarez

Generation

generate functionWed, 07 Jun 2023

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

compounds <- c("C06483", "C06484", "C06485") # List of KEGG compounds compounds <- c("C06483", "C06484", "C06485") compounds2 <- sapply(compounds, FUN=function(x) keggrest(paste("compound", x, sep=":"), "image")) compounds2 # Find out if the compounds belong to an organism or not for (i in compounds) { if (compounds2[[i]]=="http://rest.kegg.jp/biocyc/image/compound/C06483") { print("this is not an organism") } else if (compounds2[[i]]=="http://rest.kegg.jp/biocyc/image/compound/C06484") { print("This is an organism") } else { print("This is not an organism") } }

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