Skip to contents

Filtered tables, the whole dataset, and a release's checksummed artefacts. Every function writes to path (a file, or an existing directory to save the server's file name in) and returns the path written.

Usage

downloads_proteins(
  path,
  format = c("csv", "json", "fasta"),
  ...,
  client = plasticdb_client()
)

downloads_microorganisms(
  path,
  format = c("csv", "json"),
  ...,
  client = plasticdb_client()
)

downloads_plastics(
  path,
  format = c("csv", "json"),
  ...,
  client = plasticdb_client()
)

downloads_papers(
  path,
  format = c("csv", "json"),
  ...,
  client = plasticdb_client()
)

downloads_protein_variants(
  path,
  format = c("csv", "json"),
  ...,
  client = plasticdb_client()
)

downloads_dataset(
  path,
  format = c("zip", "json"),
  max_wait = 0,
  client = plasticdb_client()
)

downloads_search(
  path,
  q,
  format = c("json", "zip"),
  client = plasticdb_client()
)

downloads_artefacts(release = NULL, client = plasticdb_client())

downloads_release_file(file, path, release = NULL, client = plasticdb_client())

downloads_manifest(release = NULL, client = plasticdb_client())

downloads_structure(
  structure_id,
  path,
  release = NULL,
  client = plasticdb_client()
)

Arguments

path

A file, or an existing directory to save the file in.

format

The file format.

...

Filters, as for the matching *_list() function.

client

A plasticdb_client().

max_wait

Seconds to keep waiting while the dataset ZIP is built.

q

The search text.

release

A release version, or NULL for the pinned or current one.

file

An artefact's path within the release, e.g. "parquet/proteins.parquet".

structure_id

A structure's numeric id.

Value

The path written (downloads_artefacts(): a tibble; downloads_manifest(): a list).

Details

  • downloads_proteins(), downloads_microorganisms(), downloads_plastics(), downloads_papers() and downloads_protein_variants() save one table as CSV or JSON (proteins also as FASTA), filtered as the matching *_list() function. A pinned client downloads that release's table as published (any filter is then plasticdb_release_unsupported_filter); the file is kept in the BiocFileCache, so a second call is a local copy.

  • downloads_dataset() saves every public record: a ZIP of CSVs with a README and licence, or one JSON (live only). The ZIP is built on demand; while it is being built the server answers 503 with Retry-After (plasticdb_service_unavailable, field retry_after); max_wait (seconds) keeps waiting that long for it.

  • downloads_search() saves every record matching a search (live only).

  • downloads_artefacts() lists the files a release published (Parquet tables, reference databases, MANIFEST.json); downloads_release_file() saves one, checked against the SHA-256 the release published (a mismatch is plasticdb_checksum and nothing is kept); downloads_manifest() returns the parsed MANIFEST.json; and downloads_structure() saves one structure's coordinates as published by a release (gzipped PDB). Release artefacts are immutable, so they are always cached. release defaults to the client's pinned release, else the current one.

Examples

path <- downloads_plastics(tempdir())
head(utils::read.csv(path)[, c("id", "name")])
# \donttest{
downloads_proteins(tempdir(), format = "fasta", plastic = "PET")
downloads_dataset(tempdir(), max_wait = 300)
## Release artefacts exist once a dataset release is published:
client <- plasticdb_client(release = "2026.50")
tryCatch({
    downloads_artefacts(client = client)
    downloads_release_file("parquet/proteins.parquet", tempdir(),
        client = client)
}, plasticdb_error = function(e) message(conditionMessage(e)))
# }