R-api client
The MOLGENIS R API client allows you to retrieve, create, update and delete entities from within the R environment.
Just add
at the top of your script and you can connect to a MOLGENIS server. Typically the first thing you do is login and the last thing is logout.
NOTE: For https connections use
NOTE: The MOLGENIS R-api client supports up to R-version 3.2.x
Overview example
login
Login to the MOLGENIS REST API
logout
Logout from the MOLGENIS REST API and destroy the session.
##get
Retrieves entities and returns the result in a dataframe.
Parameter | Description | Required | Default |
---|---|---|---|
| The entity name | yes | |
| Query string in rsql/fiql format (see below) | No | NULL |
| The index of the thirst row to return | No | 0 |
| The maximum number of rows to return (max 10000) | No | 1000 |
| Vector of attributenames(columns) to return | No | All attributes |
| attributeName of the column to sort on | No | NULL |
| sort order, 'ASC' of 'DESC' | No | NULL |
Supported RSQL/FIQL query operators (see https://github.com/jirutka/rsql-parser)
Operator | Symbol |
---|---|
Logical AND |
|
Logical OR |
|
Group |
|
Equal to |
|
Less then |
|
Less then or equal to |
|
Greater than |
|
Greater tha or equal to |
|
Argument can be a single value, or multiple values in parenthesis separated by comma. Value that doesn’t contain any reserved character or a white space can be unquoted, other arguments must be enclosed in single or double quotes.
Examples
## add ``` molgenis.add(entity, ...) ```
Creates a new instance of an entity (i.e. a new row of the entity data table) and returns the id.
Parameter | Description | Required |
---|---|---|
entity | The entity name of the entity to create | yes |
... | Var arg list of attribute names and values | yes |
Example
addAll
Creates new instances of an entity (i.e. adds new rows to the entity data table) and returns the ids.
Parameter | Description | Required |
---|---|---|
entity | The entity name of the entity to create | yes |
rows | data frame where each row represents an entity instance | yes |
Example
## update ``` molgenis.update(entity, id, ...) ```
Updates un existing entity
Parameter | Description | Required |
---|---|---|
entity | The entity name | yes |
id | The id of the entity | Yes |
... | Var arg list of attribute names and values | yes |
Example
delete
Deletes an entity.
Parameter | Description | Required |
---|---|---|
entity | The entity name | yes |
id | The id of the entity | Yes |
Example
deleteList
Deletes a list of entities in an entityType.
Parameter | Description | Required |
---|---|---|
entity | The entityType name | yes |
rows | List with ids of the rows | yes |
Example
getEntityMetaData
Gets the entity metadata as list.
Example
getAttributeMetaData
Gets attribute metadata as list.
Parameter | Description | Required |
---|---|---|
entity | The entity name | yes |
attribute | The name of the attribute | Yes |
Example
Last updated