A simple R interface for interacting with data and results stored in Pluto, the collaborative life sciences platform.
If you are accessing data programmatically for the first time, you'll need to generate a new API token. Navigate to your Account page in Pluto and click the "+ API token" button.
A new API token will be generated, and can then be copied or viewed.
This API token can be used to fetch data programmatically using this R package.
Copy the API token that you created on your Account page and store it in an environment variable called PLUTO_API_TOKEN. To do this, create an .Renviron
file containing:
PLUTO_API_TOKEN="<YOUR API TOKEN>"
# Load required dependencies
library(httr)
library(jsonlite)
library(rjson)
# Print PLUTO_API_TOKEN to confirm that it's in your environment
Sys.getenv('PLUTO_API_TOKEN')
# If PLUTO_API_TOKEN is blank, make sure the API key is in .Renviron
# and restart your R session, then rerun Sys.getenv('PLUTO_API_TOKEN')
# Import the pluto_read() function
devtools::source_url("https://github.com/pluto-biosciences/pluto-sdk-R/blob/main/pluto.R?raw=TRUE")
sample_data <- pluto_read(experiment_id = 'PLX140206',
data_type = 'sample')
# All 12 rows of the sample data were fetched
assay_data <- pluto_read(experiment_id = 'PLX140206',
data_type = 'assay')
# Paginating API calls to retrieve all 32544 rows in the assay data in batches of 10000 rows...
# Fetching rows 10001 to 20001...
# Fetching rows 20001 to 30001...
# Fetching rows 30001 to 32544...
Visit our website to learn more about the assays and analyses that Pluto supports. To fetch data from a specific analysis and plot, obtain the plot ID from the Methods Modal on any plot:
Use the plot ID in the pluto_read() function to fetch the underlying results:
deg_table <- pluto_read(experiment_id = "PLX140206",
plot_id = "386b3bbf-fc86-4071-88c2-6340634cdc62",
data_type = "results")
# Paginating API calls to retrieve all 16954 rows in the assay data in batches of 10000 rows...
# Fetching rows 10001 to 20001...
For more information about all available endpoints, visit the Pluto API docs