TopPathwayKegg:

Usage Arguments Author(s) Examples

Usage

1
TopPathwayKegg(name, pubchem)

Arguments

name
pubchem

Author(s)

Sarah Cherkaoui

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (name, pubchem) 
{
    Pathways <- matrix(ncol = 3)
    for (i in 1:length(puchem)) {
        s1 <- SearchKEGG(puchem[i], "pubchem")
        if (!is.list(s1)) {
            s1 <- SearchKEGG(name[i], "name")
        }
        if (is.list(s1)) {
            KeggPathway <- s1$KeggPathway
            for (j in 1:length(KeggPathway)) {
                if (is.character(KeggPathway[j]) && length(KeggPathway[j]) > 
                  0) {
                  s2 <- Mmatch(KeggPathway[j], Pathways[, 1])
                  if (length(s2) > 0) {
                    position <- s2[1]
                    Pathways[position, 2] <- as.numeric(Pathways[position, 
                      2]) + 1
                  }
                  else {
                    Pathways <- rbind(Pathways, c(KeggPathway[j], 
                      "1", s1$Name))
                  }
                }
            }
        }
    }
    Pathways <- Pathways[!is.na(Pathways[, 1]), ]
    Pathways <- Pathways[order(Pathways[, 2], decreasing = TRUE), 
        ]
    colnames(Pathways) <- c("Pathway", "Number", "Example")
    return(Pathways)
  }

cherkaos/MetabToPathways documentation built on May 13, 2019, 3:54 p.m.