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
\dontrun{
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
\dontrun{
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 = 'fasta')                # 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,
  collectionUUID,
  fileFormat,
  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
\dontrun{
collection <- Collection$new(arv, collectionUUID)
writeFile <- collection$writeFile(name = "myoutput.csv", file = file, fileFormat = "csv", istable = NULL, collectionUUID = collectionUUID)             # csv
writeFile <- collection$writeFile(name = "myoutput.tsv", file = file, fileFormat = "tsv", istable = NULL, collectionUUID = collectionUUID)             # tsv
writeFile <- collection$writeFile(name = "myoutput.fasta", file = file, fileFormat = "fasta", istable = NULL, collectionUUID = collectionUUID)         # fasta
writeFile <- collection$writeFile(name = "myoutputtable.txt", file = file, fileFormat = "txt", istable = "yes", collectionUUID = collectionUUID)       # txt table
writeFile <- collection$writeFile(name = "myoutputtext.txt", file = file, fileFormat = "txt", istable = "no", collectionUUID = collectionUUID)         # txt text
writeFile <- collection$writeFile(name = "myoutputbinary.dat", file = file, fileFormat = "dat", collectionUUID = collectionUUID)                       # binary
writeFile <- collection$writeFile(name = "myoutputxlsx.xlsx", file = file, fileFormat = "xlsx", collectionUUID = collectionUUID)                       # 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
\dontrun{
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
\dontrun{
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
\dontrun{
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
\dontrun{
copied <- collection$copy("oldName.format", "newName.format")
}

Method refresh()

Refreshes the environment.

Usage
Collection$refresh()
Examples
\dontrun{
collection$refresh()
}

Method getFileListing()

Returns collections file content as character vector.

Usage
Collection$getFileListing()
Examples
\dontrun{
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
\dontrun{
arvadosFile <- collection$get(fileName)
}

Method getRESTService()

Usage
Collection$getRESTService()

Method setRESTService()

Usage
Collection$setRESTService(newRESTService)

See Also

https://git.arvados.org/arvados.git/tree/HEAD:/sdk/R

Examples


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

## Not run: 
collection <- Collection$new(arv, CollectionUUID)

## End(Not run)

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

## Not run: 
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 = 'fasta')                # 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

## End(Not run)

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

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

## End(Not run)

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

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

## End(Not run)

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

## Not run: 
collection$remove(fileName.format)

## End(Not run)

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

## Not run: 
collection$move("fileName.format", path)

## End(Not run)

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

## Not run: 
copied <- collection$copy("oldName.format", "newName.format")

## End(Not run)

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

## Not run: 
collection$refresh()

## End(Not run)

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

## Not run: 
list <- collection$getFileListing()

## End(Not run)

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

## Not run: 
arvadosFile <- collection$get(fileName)

## End(Not run)