Installing

library("devtools")
install_github("cellengine/cellengine-r-toolkit")

First steps

Authentication

For interactive sessions, calling authenticate() will prompt you for your login info:

library("cellengine")
authenticate() # prompts for username and password (and OTP if configured)
authenticate("username") # prompts for password (and OTP if configured)

Personal Access Tokens can also be used. These provide secure access with the ability to limit what actions the token can be used to perform. These are recommended over username/password authentication, especially for scripts.

library("cellengine")
authenticate(token = "cep_xxxxxxxxxxxxxxxxxxx")

Credentials can also be loaded from environment variables:

CELLENGINE_USERNAME=joesmith CELLENGINE_PASSWORD=mypassword
# or
CELLENGINE_AUTH_TOKEN=cep_xxxxxxxxxxxxxxxxxxx
library("cellengine")
authenticate() # retrieves from environment variables automatically

Basic operations

The CellEngine R Toolkit provides functions for: * Retrieving, creating and modifying experiments, gates, populations, compensations, FCS files and attachments. * Getting statistics, plots and FCS file content (data matrix). * Converting to and from flowCore objects (partial support, see issue #57).

Get experiments

You can list all experiments that you have access to:

experiments = getExperiments()

Or fetch individual experiments by ID or name:

exp2 = getExperiment("57c4d7d4e69a1e890c4d8d2f")
exp3 = getExperiment(byName("experiment_name"))

Looking up resources by name:

Experiments, gates, populations, FCS files, compensations and attachments can all be requested by name:

expt = getExperiment(byName("experiment_name"))
gate = getGate(expt$`_id`, byName("gate_name"))

Looking up a resource by name requires one extra API call and thus is slightly slower than using a resource by ID. However, by-name lookups are cached for the duration of the R session, so repeated by-name lookups of the same object are just as fast as a request by ID.

You can also create a per-Experiment lookup object, which can be used to find resources by name or ID. This makes it convenient to query different types of resources from a single experiment:

experimentId = "57c4d7d4e69a1e890c4d8d2f"
lookup = createLookup(experimentId)
gate = lookup("gates", "gate_name")
population = lookup("populations", "population_name")