R SDK for Arvados Installation from source 1. Dependencies libxml2-dev, libssl-dev, curl 2. Build the ArvadosR package tarball cd arvados/sdk R CMD build R That will create a tarball of the Arvados package in the current directory. 3. Install the R package and its dependencies Then start R. Assuming the generated tarball is named `ArvadosR_0.0.1.tar.gz`, install it like this: > install.packages(c('R6', 'httr', 'stringr', 'jsonlite', 'curl', 'XML')) > install.packages('./ArvadosR_0.0.1.tar.gz', repos = NULL, type="source", dependencies = TRUE) > library('ArvadosR') 4. Examples of usage: -------------------------------------------------------------------------------------------------------------------------------- #Initialize API: arv <- Arvados$new("insert_token", "insert_host_name") -------------------------------------------------------------------------------------------------------------------------------- #Get collection: arv$getCollection("uuid") -------------------------------------------------------------------------------------------------------------------------------- #List collections: collectionList <- arv$listCollections(list(list("uuid", "=", "aaaaa-4zz18-ccccccccccccccc")), limit = 10, offset = 2) -------------------------------------------------------------------------------------------------------------------------------- #Delete collection: deletedCollection <- arv$deleteCollection("uuid") -------------------------------------------------------------------------------------------------------------------------------- #Update collection: updatedCollection <- arv$updateCollection("uuid", list(list(name = "new_name", description = "new_desciption"))) -------------------------------------------------------------------------------------------------------------------------------- #Create collection: createdCollection <- arv$createCollection(list(list(name = "new_name", description = "new_desciption"))) -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- #Collection content manipulation: -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- #Create collection object: collection <- Collection$new(arv, "uuid") -------------------------------------------------------------------------------------------------------------------------------- #Get file/folder content as character vector collection$getFileContent() -------------------------------------------------------------------------------------------------------------------------------- #This will return ArvadosFile or Subcollection from internal tree-like structure. arvadosFile <- collection$get("location/to/my/file.cpp") #or arvadosSubcollection <- collection$get("location/to/my/directory/") -------------------------------------------------------------------------------------------------------------------------------- #Read whole file or just a portion of it. fileContent <- arvadosFile$read(offset = 1024, length = 512) -------------------------------------------------------------------------------------------------------------------------------- #Get ArvadosFile or Subcollection size size <- arvadosFile$getSizeInBytes() size <- arvadosSubcollection$getSizeInBytes() -------------------------------------------------------------------------------------------------------------------------------- #Create new file in a collection #Call structure collection$add(arvadosFileOrSubcollectionOrFileName, optionalRelativePath) #Example collection$add("main.cpp", "cpp/src/") #or folder <- Subcollection$new("src") file <- ArvadosFile$new("main.cpp") folder$add(file) collection$add(folder, "cpp") #Both examples will add file "main.cpp" in "./cpp/src/" folder if folder exists. #If subcollection contains more files or folders they will be added recursively. #You can also add multiple files collection$add(c("path/to/my/file.cpp", "path/to/other/file.cpp")) -------------------------------------------------------------------------------------------------------------------------------- #Write to existing file (Override current content of the file) arvadosFile <- collection$get("location/to/my/file.cpp") arvadosFile$write("This is new file content") -------------------------------------------------------------------------------------------------------------------------------- #Delete file from a collection file <- collection$get("location/to/my/file.cpp") file$removeFromCollection() #Or collection$remove(file) #Both examples will remove file "file.cpp" from a collection #If subcollection contains more files or folders they will be removed recursively. #You can also remove multiple files collection$remove(c("path/to/my/file.cpp", "path/to/other/file.cpp")) -------------------------------------------------------------------------------------------------------------------------------- #Move file or folder inside collection file <- collection$get("location/to/my/file.cpp") file$move("destination/file.cpp") #Or subcollections subcollection <- collection$get("location/to/folder") subcollection$move("destination/folder") #Make sure to include folder name in destination #For example #file$move("destination/") will not work -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- # Working with projects: #Get project: arv$getProject("uuid") -------------------------------------------------------------------------------------------------------------------------------- #List projects: projects <- arv$listProjects(list(list("uuid", "=", "aaaaa-j7d0g-ccccccccccccccc")), limit = 10, offset = 2) -------------------------------------------------------------------------------------------------------------------------------- #Delete project: deletedProject <- arv$deleteProject("uuid") -------------------------------------------------------------------------------------------------------------------------------- #Update project: updatedProject <- arv$updateProject("uuid", list(list(name = "new_name", description = "new_desciption"))) -------------------------------------------------------------------------------------------------------------------------------- #Create project: createdProject <- arv$createProject(list(list(name = "project_name", description = "project_desciption"))) --------------------------------------------------------------------------------------------------------------------------------