populateInternalDirectoryMigration: migration function to populate internal directory with...

Usage Arguments Examples

Usage

1

Arguments

synId
G
Q
topId

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
##---- 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 (synId, G, Q = NULL, topId)
{
    if (is.null(Q)) {
        Q <- list()
        Q$adj <- G$adj
        Q$adj[1:length(Q$adj)] <- 0
        Q$id <- G$id
        Q$id[1] <- topId
        G$id[1] <- topId
        rownames(G$adj) <- G$id
        colnames(G$adj) <- G$id
        rownames(Q$adj) <- G$id
        colnames(Q$adj) <- G$id
        names(G$type) <- G$id
        names(G$name) <- G$id
        Q$newid <- Q$id
        names(Q$newid) <- Q$id
        synId <- topId
    }
    e <- names(which(G$adj[synId, ] == 1))
    if (length(e) > 0) {
        for (i in 1:length(e)) {
            if (Q$adj[synId, e[i]] == 0) {
                Q$adj[synId, e[i]] <- 1
                if (G$type[e[i]] == "org.sagebionetworks.repo.model.Folder") {
                  Q$newid[e[i]] <- makeNewFolder(synId, e[i],
                    Q, G)
                  Q <- populateNewDirectory2(e[i], G, Q, topId)
                }
                else if (G$type[e[i]] == "org.sagebionetworks.repo.model.FileEntity") {
                  w1 <- which(Q$adj[, Q$newid[e[i]]] == 1)
                  print(c(G$name[e[i]], Q$newid[w1], e[i]))
                  makeLink(fileId = as.character(e[i]), parentId = as.character(Q$newid[w1]),
                    linkName = as.character(G$name[e[i]]))
                }
                else {
                  stop("Object type not recognized\n")
                }
            }
            else {
                return(Q)
            }
        }
    }
    else {
        return(Q)
    }
    return(Q)
  }

Sage-Bionetworks/rSynapseUtilities documentation built on May 9, 2019, 12:13 p.m.