Mercurial > repos > prog > lcmsmatching
diff KeggCompound.R @ 1:253d531a0193 draft
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit 36c9d8099c20a1ae848f1337c16564335dd8fb2b
author | prog |
---|---|
date | Sat, 03 Sep 2016 17:02:01 -0400 |
parents | e66bb061af06 |
children |
line wrap: on
line diff
--- a/KeggCompound.R Tue Jul 12 12:02:37 2016 -0400 +++ b/KeggCompound.R Sat Sep 03 17:02:01 2016 -0400 @@ -20,9 +20,9 @@ # Define fields regex regex <- character() - regex[[RBIODB.NAME]] <- "^NAME\\s+([^,;]+)" - regex[[RBIODB.CHEBI.ID]] <- "^\\s+ChEBI:\\s+(\\S+)" - regex[[RBIODB.LIPIDMAPS.ID]] <- "^\\s+LIPIDMAPS:\\s+(\\S+)" + regex[[BIODB.NAME]] <- "^NAME\\s+([^,;]+)" + regex[[BIODB.CHEBI.ID]] <- "^\\s+ChEBI:\\s+(\\S+)" + regex[[BIODB.LIPIDMAPS.ID]] <- "^\\s+LIPIDMAPS:\\s+(\\S+)" for (text in contents) { @@ -50,26 +50,26 @@ # ENZYME ID g <- str_match(s, "^ENTRY\\s+EC\\s+(\\S+)") if ( ! is.na(g[1,1])) - compound$setField(RBIODB.ACCESSION, paste('ec', g[1,2], sep = ':')) + compound$setField(BIODB.ACCESSION, paste('ec', g[1,2], sep = ':')) # ENTRY ID else { g <- str_match(s, "^ENTRY\\s+(\\S+)\\s+Compound") if ( ! is.na(g[1,1])) - compound$setField(RBIODB.ACCESSION, paste('cpd', g[1,2], sep = ':')) + compound$setField(BIODB.ACCESSION, paste('cpd', g[1,2], sep = ':')) # OTHER ID else { g <- str_match(s, "^ENTRY\\s+(\\S+)") if ( ! is.na(g[1,1])) - compound$setField(RBIODB.ACCESSION, g[1,2]) + compound$setField(BIODB.ACCESSION, g[1,2]) } } # ORGANISM g <- str_match(s, "^ORGANISM\\s+(\\S+)") if ( ! is.na(g[1,1])) - compound$setField(RBIODB.ACCESSION, paste(g[1,2], compound$getField(RBIODB.ACCESSION), sep = ':')) + compound$setField(BIODB.ACCESSION, paste(g[1,2], compound$getField(BIODB.ACCESSION), sep = ':')) } } @@ -77,7 +77,7 @@ } # Replace elements with no accession id by NULL - compounds <- lapply(compounds, function(x) if (is.na(x$getField(RBIODB.ACCESSION))) NULL else x) + compounds <- lapply(compounds, function(x) if (is.na(x$getField(BIODB.ACCESSION))) NULL else x) # If the input was a single element, then output a single object if (drop && length(contents) == 1)