5 --------------------------------------------------------------------------------------------------------------------------------
9 arv <- Arvados$new("insert_token", "insert_host_name")
11 --------------------------------------------------------------------------------------------------------------------------------
15 arv$getCollection("uuid")
17 --------------------------------------------------------------------------------------------------------------------------------
21 collectionList <- arv$listCollections(list("uuid", "=" "aaaaa-bbbbb-ccccccccccccccc"), limit = 10, offset = 2)
23 --------------------------------------------------------------------------------------------------------------------------------
27 deletedCollection <- arv$deleteCollection("uuid")
29 --------------------------------------------------------------------------------------------------------------------------------
33 updatedCollection <- arv$updateCollection("uuid", list((name = "new_name", description = "new_desciption")))
35 --------------------------------------------------------------------------------------------------------------------------------
39 cratedCollection <- arv$createCollection(list(list(name = "new_name", description = "new_desciption")))
41 --------------------------------------------------------------------------------------------------------------------------------
43 --------------------------------------------------------------------------------------------------------------------------------
45 #Collection content manipulation:
47 --------------------------------------------------------------------------------------------------------------------------------
49 --------------------------------------------------------------------------------------------------------------------------------
51 #Create collection object:
53 arv <- Arvados$new("insert_token", "insert_host_name")
54 collection <- Collection$new(arv, "uuid")
56 --------------------------------------------------------------------------------------------------------------------------------
58 #Get file/folder content as character vector
60 collection$getFileContent()
62 --------------------------------------------------------------------------------------------------------------------------------
64 #This will return ArvadosFile or Subcollection from internal tree-like structure.
66 arvadosFile <- collection$get("location/to/my/file.cpp")
70 arvadosSubcollection <- collection$get("location/to/my/directory/")
72 --------------------------------------------------------------------------------------------------------------------------------
74 #Read whole file or just a portion of it.
76 fileContent <- arvadosFile$read(offset = 1024, length = 512)
78 --------------------------------------------------------------------------------------------------------------------------------
80 #Get ArvadosFile or Subcollection size
82 size <- arvadosFile$getSizeInBytes()
83 size <- arvadosSubcollection$getSizeInBytes()
85 --------------------------------------------------------------------------------------------------------------------------------
87 #Create new file in a collection
91 collection$add(arvadosFileOrSubcollectionOrFileName, optionalRelativePath)
95 collection$add("main.cpp", "cpp/src/")
99 folder <- Subcollection$new("src")
100 file <- ArvadosFile$new("main.cpp")
103 collection$add(folder, "cpp")
105 #Both examples will add file "main.cpp" in "./cpp/src/" folder if folder exists.
106 #If subcollection contains more files or folders they will be added recursively.
108 #You can also add multiple files
110 collection$add(c("path/to/my/file.cpp", "path/to/other/file.cpp"))
112 --------------------------------------------------------------------------------------------------------------------------------
114 #Write to existing file (Override current content of the file)
116 arvadosFile <- collection$get("location/to/my/file.cpp")
118 arvadosFile$write("This is new file content")
120 --------------------------------------------------------------------------------------------------------------------------------
122 #Delete file from a collection
124 file <- collection$get("location/to/my/file.cpp")
126 file$removeFromCollection()
130 collection$remove(file)
132 #Both examples will remove file "file.cpp" from a collection
133 #If subcollection contains more files or folders they will be removed recursively.
135 #You can also remove multiple files
137 collection$remove(c("path/to/my/file.cpp", "path/to/other/file.cpp"))
139 --------------------------------------------------------------------------------------------------------------------------------
141 --------------------------------------------------------------------------------------------------------------------------------
145 arv$getProject("uuid")
147 --------------------------------------------------------------------------------------------------------------------------------
151 projects <- arv$listProjects(list("uuid", "=" "aaaaa-bbbbb-ccccccccccccccc"), limit = 10, offset = 2)
153 --------------------------------------------------------------------------------------------------------------------------------
157 deletedProject <- arv$deleteProject("uuid")
159 --------------------------------------------------------------------------------------------------------------------------------
163 updatedProject <- arv$updateProject("uuid", list((name = "new_name", description = "new_desciption")))
165 --------------------------------------------------------------------------------------------------------------------------------
169 cratedProject <- arv$createProject(list(list(name = "project_name", description = "project_desciption")))
171 --------------------------------------------------------------------------------------------------------------------------------