CollectionR Documentation

R6 Class Representing Arvados Collection

Description

Collection class provides interface for working with Arvados collections, for exaplme actions like creating, updating, moving or removing are possible.

Public fields

uuid

Autentic for Collection UUID.

Methods

Public methods


Method new()

Initialize new enviroment.

Usage
Collection$new(api, uuid)
Arguments
api

Arvados enviroment.

uuid

The UUID Autentic for Collection UUID.

Returns

A new 'Collection' object.

Examples
collection <- Collection$new(arv, CollectionUUID)

Method add()

Adds ArvadosFile or Subcollection specified by content to the collection. Used only with ArvadosFile or Subcollection.

Usage
Collection$add(content, relativePath = "")
Arguments
content

Content to be added.

relativePath

Path to add content.


Method readArvFile()

Read file content.

Usage
Collection$readArvFile(
  file,
  con,
  sep = ",",
  istable = NULL,
  fileclass = "SeqFastadna",
  Ncol = NULL,
  Nrow = NULL,
  wantedFunction = NULL
)
Arguments
file

Name of the file.

sep

Separator used in reading tsv, csv file format.

istable

Used in reading txt file to check if the file is table or not.

fileclass

Used in reading fasta file to set file class.

Ncol

Used in reading binary file to set numbers of columns in data.frame.

Nrow

Used in reading binary file to set numbers of rows in data.frame size.

col

Collection from which the file is read.

Examples
collection <- Collection$new(arv, collectionUUID)
readFile <- collection$readArvFile(arvadosFile, istable = 'yes')                    # table
readFile <- collection$readArvFile(arvadosFile, istable = 'no')                     # text
readFile <- collection$readArvFile(arvadosFile)                                     # xlsx, csv, tsv, rds, rdata
readFile <- collection$readArvFile(arvadosFile, fileclass = 'lala')                 # fasta
readFile <- collection$readArvFile(arvadosFile, Ncol= 4, Nrow = 32)                 # binary, only numbers
readFile <- collection$readArvFile(arvadosFile, Ncol = 5, Nrow = 150, istable = "factor") # binary with factor or text

Method writeFile()

Write file content

Usage
Collection$writeFile(name, file, istable = NULL, seqName = NULL)
Arguments
name

Name of the file.

file

File to be saved.

istable

Used in writing txt file to check if the file is table or not.

Examples
collection <- Collection$new(arv, collectionUUID)
writeFile <- collection$writeFile("myoutput.csv", file, istable = NULL)             # csv
writeFile <- collection$writeFile("myoutput.fasta", file, istable = NULL)           # fasta
writeFile <- collection$writeFile("myoutputtable.txt", file, istable = "yes")       # txt table
writeFile <- collection$writeFile("myoutputtext.txt", file, istable = "no")         # txt text
writeFile <- collection$writeFile("myoutputbinary.dat", file)                       # binary
writeFile <- collection$writeFile("myoutputxlsx.xlsx", file)                        # xlsx

Method create()

Creates one or more ArvadosFiles and adds them to the collection at specified path.

Usage
Collection$create(files)
Arguments
files

Content to be created.

Examples
collection <- arv$collections_create(name = collectionTitle, description = collectionDescription, owner_uuid = collectionOwner, properties = list("ROX37196928443768648" = "ROX37742976443830153"))

Method remove()

Remove one or more files from the collection.

Usage
Collection$remove(paths)
Arguments
paths

Content to be removed.

Examples
collection$remove(fileName.format)

Method move()

Moves ArvadosFile or Subcollection to another location in the collection.

Usage
Collection$move(content, destination)
Arguments
content

Content to be moved.

destination

Path to move content.

Examples
collection$move("fileName.format", path)

Method copy()

Copies ArvadosFile or Subcollection to another location in the collection.

Usage
Collection$copy(content, destination)
Arguments
content

Content to be moved.

destination

Path to move content.

Examples
copied <- collection$copy("oldName.format", "newName.format")

Method refresh()

Refreshes the environment.

Usage
Collection$refresh()
Examples
collection$refresh()

Method getFileListing()

Returns collections file content as character vector.

Usage
Collection$getFileListing()
Examples
list <- collection$getFileListing()

Method get()

If relativePath is valid, returns ArvadosFile or Subcollection specified by relativePath, else returns NULL.

Usage
Collection$get(relativePath)
Arguments
relativePath

Path from content is taken.

Examples
arvadosFile <- collection$get(fileName)

Method getRESTService()

Usage
Collection$getRESTService()

Method setRESTService()

Usage
Collection$setRESTService(newRESTService)

See Also

https://github.com/arvados/arvados/tree/main/sdk/R

Examples


## ------------------------------------------------
## Method `Collection$new`
## ------------------------------------------------

collection <- Collection$new(arv, CollectionUUID)

## ------------------------------------------------
## Method `Collection$readArvFile`
## ------------------------------------------------

collection <- Collection$new(arv, collectionUUID)
readFile <- collection$readArvFile(arvadosFile, istable = 'yes')                    # table
readFile <- collection$readArvFile(arvadosFile, istable = 'no')                     # text
readFile <- collection$readArvFile(arvadosFile)                                     # xlsx, csv, tsv, rds, rdata
readFile <- collection$readArvFile(arvadosFile, fileclass = 'lala')                 # fasta
readFile <- collection$readArvFile(arvadosFile, Ncol= 4, Nrow = 32)                 # binary, only numbers
readFile <- collection$readArvFile(arvadosFile, Ncol = 5, Nrow = 150, istable = "factor") # binary with factor or text

## ------------------------------------------------
## Method `Collection$writeFile`
## ------------------------------------------------

collection <- Collection$new(arv, collectionUUID)
writeFile <- collection$writeFile("myoutput.csv", file, istable = NULL)             # csv
writeFile <- collection$writeFile("myoutput.fasta", file, istable = NULL)           # fasta
writeFile <- collection$writeFile("myoutputtable.txt", file, istable = "yes")       # txt table
writeFile <- collection$writeFile("myoutputtext.txt", file, istable = "no")         # txt text
writeFile <- collection$writeFile("myoutputbinary.dat", file)                       # binary
writeFile <- collection$writeFile("myoutputxlsx.xlsx", file)                        # xlsx

## ------------------------------------------------
## Method `Collection$create`
## ------------------------------------------------

collection <- arv$collections_create(name = collectionTitle, description = collectionDescription, owner_uuid = collectionOwner, properties = list("ROX37196928443768648" = "ROX37742976443830153"))

## ------------------------------------------------
## Method `Collection$remove`
## ------------------------------------------------

collection$remove(fileName.format)

## ------------------------------------------------
## Method `Collection$move`
## ------------------------------------------------

collection$move("fileName.format", path)

## ------------------------------------------------
## Method `Collection$copy`
## ------------------------------------------------

copied <- collection$copy("oldName.format", "newName.format")

## ------------------------------------------------
## Method `Collection$refresh`
## ------------------------------------------------

collection$refresh()

## ------------------------------------------------
## Method `Collection$getFileListing`
## ------------------------------------------------

list <- collection$getFileListing()

## ------------------------------------------------
## Method `Collection$get`
## ------------------------------------------------

arvadosFile <- collection$get(fileName)