BiodbEntryFields {biodb} | R Documentation

## A class for handling description of all entry fields.

### Description

A class for handling description of all entry fields.

A class for handling description of all entry fields.

### Details

The unique instance of this class is handle by the `BiodbMain` class and accessed through the `getEntryFields()` method.

### Methods

#### Public methods

- `BiodbEntryFields$new()`

- `BiodbEntryFields$notifyCfgUpdate()`

- `BiodbEntryFields$isAlias()`

- `BiodbEntryFields$formatName()`

- `BiodbEntryFields$isDefined()`

- `BiodbEntryFields$checkIsDefined()`

- `BiodbEntryFields$getRealName()`

- `BiodbEntryFields$get()`

- `BiodbEntryFields$getFieldNames()`

- `BiodbEntryFields$getDatabaseIdField()`

- `BiodbEntryFields$print()`

- `BiodbEntryFields$define()`

- `BiodbEntryFields$terminate()`

- `BiodbEntryFields$clone()`

#### Method `new()`

New instance initializer. No BiodbEntryFields instance must be created directly. Instead, call the getEntryFields() method of BiodbMain.

##### Usage

    BiodbEntryFields$new(parent)

##### Arguments

`parent`

  The BiodbMain instance.

##### Returns

Nothing.

#### Method `notifyCfgUpdate()`

Call back method called when a value is modified inside the configuration.

##### Usage

    BiodbEntryFields$notifyCfgUpdate(k, v)

##### Arguments

`k`

  The config key name.

`v`

  The value associated with the key.

##### Returns

Nothing.

#### Method `isAlias()`

Tests if names are aliases.

##### Usage

    BiodbEntryFields$isAlias(name)

##### Arguments

`name`

  A character vector of names or aliases to test.

##### Returns

A logical vector, the same length as `name`, with TRUE for name values that are an alias of a field, and FALSE otherwise."

#### Method `formatName()`

Format field name(s) for biodb format: set to lower case and remove dot or underscore characters depending on configuration.

##### Usage

    BiodbEntryFields$formatName(name)

##### Arguments

`name`

  A character vector of names or aliases to test.

##### Returns

A character vector of formatted names.

#### Method `isDefined()`

Tests if names are defined fields.

##### Usage

    BiodbEntryFields$isDefined(name)

##### Arguments

`name`

  A character vector of names or aliases to test.

##### Returns

A logical vector, the same length as `name`, with TRUE for name values that corresponds to a defined field.

#### Method `checkIsDefined()`

Tests if names are valid defined fields. Throws an error if any name does not correspond to a defined field.

##### Usage

    BiodbEntryFields$checkIsDefined(name)

##### Arguments

`name`

  A character vector of names or aliases to test.

##### Returns

Nothing.

#### Method `getRealName()`

Gets the real names (main names) of fields. If some name is not found neither in aliases nor in real names, an error is thrown.

##### Usage

    BiodbEntryFields$getRealName(name, fail = TRUE)

##### Arguments

`name`

  A character vector of names or aliases.

`fail`

  Fails if name is unknown.

##### Returns

A character vector, the same length as `name`, with the real field name for each name given (i.e. each alias is replaced with the real name).

#### Method `get()`

Gets a BiodbEntryField instance.

##### Usage

    BiodbEntryFields$get(name, drop = TRUE)

##### Arguments

`name`

  A character vector of names or aliases.

`drop`

  If TRUE and only one name has been submitted, returns a single BiodbEntryField instance instead of a list.

##### Returns

A named list of BiodbEntryField instances. The names of the list are the real names of the entry fields, thus they may be different from the one provided inside the name argument.

#### Method `getFieldNames()`

Gets the main names of all fields.

##### Usage

    BiodbEntryFields$getFieldNames(type = NULL, computable = NULL)

##### Arguments

`type`

  Set this parameter to a character vector in order to return only the names of the fields corresponding to the types specified.

`computable`

  If set to TRUE, returns only the names of computable fields. If set to FALSE, returns only the names of fields that are not computable.

##### Returns

A character vector containing all selected field names.

#### Method `getDatabaseIdField()`

Gets a database ID field.

##### Usage

    BiodbEntryFields$getDatabaseIdField(database)

##### Arguments

`database`

  The name (i.e.: Biodb ID) of a database.

##### Returns

    accession numbers) for this database.

#### Method `print()`

Prints information about the instance.

##### Usage

    BiodbEntryFields$print()

##### Returns

Nothing.

#### Method `define()`

Defines fields.

##### Usage

    BiodbEntryFields$define(def)

##### Arguments

`def`

  A named list of field definitions. The names of the list are the main names of the fields.

##### Returns

Nothing.

#### Method `terminate()`

Terminates the instance. This method will be called automatically by the BiodbMain instance when you call

##### Usage

    BiodbEntryFields$terminate()

##### Arguments

`BiodbMain`

  :terminate().

##### Returns

Nothing.

#### Method `clone()`

The objects of this class are cloneable with this method.

##### Usage

    BiodbEntryFields$clone(deep = FALSE)

##### Arguments

`deep`

  Whether to make a deep clone.

### See Also

`BiodbMain` and child class `BiodbEntryField`.

### Examples

    # Getting information about the accession field:
    mybiodb <- biodb::newInst()
    entry.field <- mybiodb$getEntryFields()$get('accession')

    # Test if a name is an alias of a field
    mybiodb$getEntryFields()$isAlias('genesymbols')

    # Test if a name is associated with a defined field
    mybiodb$getEntryFields()$isDefined('name')

    # Terminate instance.
    mybiodb$terminate()

[Package biodb version 1.2.2 Index]