comparison NcbiGeneCompound.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
comparison
equal deleted inserted replaced
0:e66bb061af06 1:253d531a0193
19 19
20 compounds <- list() 20 compounds <- list()
21 21
22 # Define xpath expressions 22 # Define xpath expressions
23 xpath.expr <- character() 23 xpath.expr <- character()
24 xpath.expr[[RBIODB.ACCESSION]] <- "//Gene-track_geneid" 24 xpath.expr[[BIODB.ACCESSION]] <- "//Gene-track_geneid"
25 xpath.expr[[RBIODB.KEGG.ID]] <- "/Dbtag_db[text()='KEGG']/..//Object-id_str" 25 xpath.expr[[BIODB.KEGG.ID]] <- "/Dbtag_db[text()='KEGG']/..//Object-id_str"
26 xpath.expr[[RBIODB.UNIPROT.ID]] <- "//Gene-commentary_heading[text()='UniProtKB']/..//Dbtag_db[text()='UniProtKB/Swiss-Prot']/..//Object-id_str" 26 xpath.expr[[BIODB.UNIPROT.ID]] <- "//Gene-commentary_heading[text()='UniProtKB']/..//Dbtag_db[text()='UniProtKB/Swiss-Prot']/..//Object-id_str"
27 xpath.expr[[RBIODB.LOCATION]] <- "//Gene-ref_maploc" 27 xpath.expr[[BIODB.LOCATION]] <- "//Gene-ref_maploc"
28 xpath.expr[[RBIODB.PROTEIN.DESCRIPTION]] <- "//Gene-ref_desc" 28 xpath.expr[[BIODB.PROTEIN.DESCRIPTION]] <- "//Gene-ref_desc"
29 xpath.expr[[RBIODB.SYMBOL]] <- "//Gene-ref_locus" 29 xpath.expr[[BIODB.SYMBOL]] <- "//Gene-ref_locus"
30 xpath.expr[[RBIODB.SYNONYMS]] <- "//Gene-ref_syn_E" 30 xpath.expr[[BIODB.SYNONYMS]] <- "//Gene-ref_syn_E"
31 31
32 for (content in contents) { 32 for (content in contents) {
33 33
34 # Create instance 34 # Create instance
35 compound <- NcbigeneCompound$new() 35 compound <- NcbigeneCompound$new()
54 } 54 }
55 55
56 # CCDS ID 56 # CCDS ID
57 ccdsid <- .find.ccds.id(xml) 57 ccdsid <- .find.ccds.id(xml)
58 if ( ! is.na(ccdsid)) 58 if ( ! is.na(ccdsid))
59 compound$setField(RBIODB.NCBI.CCDS.ID, ccdsid) 59 compound$setField(BIODB.NCBI.CCDS.ID, ccdsid)
60 } 60 }
61 61
62 compounds <- c(compounds, compound) 62 compounds <- c(compounds, compound)
63 } 63 }
64 64
65 # Replace elements with no accession id by NULL 65 # Replace elements with no accession id by NULL
66 compounds <- lapply(compounds, function(x) if (is.na(x$getField(RBIODB.ACCESSION))) NULL else x) 66 compounds <- lapply(compounds, function(x) if (is.na(x$getField(BIODB.ACCESSION))) NULL else x)
67 67
68 # If the input was a single element, then output a single object 68 # If the input was a single element, then output a single object
69 if (drop && length(contents) == 1) 69 if (drop && length(contents) == 1)
70 compounds <- compounds[[1]] 70 compounds <- compounds[[1]]
71 71