3 Installation from source
7 libxml2-dev, libssl-dev, curl
9 2. Build the ArvadosR package tarball
14 That will create a tarball of the Arvados package in the current directory.
16 3. Install the R package and its dependencies
18 Then start R. Assuming the generated tarball is named `ArvadosR_0.0.1.tar.gz`,
21 > install.packages(c('R6', 'httr', 'stringr', 'jsonlite', 'curl', 'XML'))
22 > install.packages('./ArvadosR_0.0.1.tar.gz', repos = NULL, type="source", dependencies = TRUE)
27 --------------------------------------------------------------------------------------------------------------------------------
31 arv <- Arvados$new("insert_token", "insert_host_name")
33 --------------------------------------------------------------------------------------------------------------------------------
37 arv$getCollection("uuid")
39 --------------------------------------------------------------------------------------------------------------------------------
42 collectionList <- arv$listCollections(list(list("uuid", "=", "aaaaa-4zz18-ccccccccccccccc")), limit = 10, offset = 2)
44 --------------------------------------------------------------------------------------------------------------------------------
48 deletedCollection <- arv$deleteCollection("uuid")
50 --------------------------------------------------------------------------------------------------------------------------------
54 updatedCollection <- arv$updateCollection("uuid", list(list(name = "new_name", description = "new_desciption")))
56 --------------------------------------------------------------------------------------------------------------------------------
60 createdCollection <- arv$createCollection(list(list(name = "new_name", description = "new_desciption")))
62 --------------------------------------------------------------------------------------------------------------------------------
64 --------------------------------------------------------------------------------------------------------------------------------
66 #Collection content manipulation:
68 --------------------------------------------------------------------------------------------------------------------------------
70 --------------------------------------------------------------------------------------------------------------------------------
72 #Create collection object:
74 collection <- Collection$new(arv, "uuid")
76 --------------------------------------------------------------------------------------------------------------------------------
78 #Get file/folder content as character vector
80 collection$getFileContent()
82 --------------------------------------------------------------------------------------------------------------------------------
84 #This will return ArvadosFile or Subcollection from internal tree-like structure.
86 arvadosFile <- collection$get("location/to/my/file.cpp")
90 arvadosSubcollection <- collection$get("location/to/my/directory/")
92 --------------------------------------------------------------------------------------------------------------------------------
94 #Read whole file or just a portion of it.
96 fileContent <- arvadosFile$read()
97 fileContent <- arvadosFile$read("text")
98 fileContent <- arvadosFile$read("raw", offset = 1024, length = 512)
100 --------------------------------------------------------------------------------------------------------------------------------
102 #Get ArvadosFile or Subcollection size
104 size <- arvadosFile$getSizeInBytes()
105 size <- arvadosSubcollection$getSizeInBytes()
107 --------------------------------------------------------------------------------------------------------------------------------
109 #Create new file in a collection
113 collection$add(arvadosFileOrSubcollectionOrFileName, optionalRelativePath)
117 collection$add("main.cpp", "cpp/src/")
121 folder <- Subcollection$new("src")
122 file <- ArvadosFile$new("main.cpp")
125 collection$add(folder, "cpp")
127 #Both examples will add file "main.cpp" in "./cpp/src/" folder if folder exists.
128 #If subcollection contains more files or folders they will be added recursively.
130 #You can also add multiple files
132 collection$add(c("path/to/my/file.cpp", "path/to/other/file.cpp"))
134 --------------------------------------------------------------------------------------------------------------------------------
136 #Write to existing file (Override current content of the file)
138 arvadosFile <- collection$get("location/to/my/file.cpp")
140 arvadosFile$write("This is new file content")
142 --------------------------------------------------------------------------------------------------------------------------------
144 #Delete file from a collection
146 file <- collection$get("location/to/my/file.cpp")
148 file$removeFromCollection()
152 collection$remove(file)
154 #Both examples will remove file "file.cpp" from a collection
155 #If subcollection contains more files or folders they will be removed recursively.
157 #You can also remove multiple files
159 collection$remove(c("path/to/my/file.cpp", "path/to/other/file.cpp"))
161 --------------------------------------------------------------------------------------------------------------------------------
163 #Move file or folder inside collection
165 file <- collection$get("location/to/my/file.cpp")
167 file$move("destination/file.cpp")
171 subcollection <- collection$get("location/to/folder")
173 subcollection$move("destination/folder")
175 #Make sure to include folder name in destination
177 #file$move("destination/") will not work
179 --------------------------------------------------------------------------------------------------------------------------------
181 --------------------------------------------------------------------------------------------------------------------------------
183 # Working with projects:
187 arv$getProject("uuid")
189 --------------------------------------------------------------------------------------------------------------------------------
192 projects <- arv$listProjects(list(list("uuid", "=", "aaaaa-j7d0g-ccccccccccccccc")), limit = 10, offset = 2)
194 --------------------------------------------------------------------------------------------------------------------------------
198 deletedProject <- arv$deleteProject("uuid")
200 --------------------------------------------------------------------------------------------------------------------------------
204 updatedProject <- arv$updateProject("uuid", list(list(name = "new_name", description = "new_desciption")))
206 --------------------------------------------------------------------------------------------------------------------------------
210 createdProject <- arv$createProject(list(list(name = "project_name", description = "project_desciption")))
212 --------------------------------------------------------------------------------------------------------------------------------