lunapi.bdc

Small Python client for files stored in a Gen3/BioData Catalyst commons.

The client deliberately deals in file-index records rather than depending on the external gen3-client executable. This keeps it usable by notebooks and desktop applications alike while allowing each Gen3 deployment to supply its own endpoint and project identifier.

Attributes

bdc

Classes

BDCClient

Authenticated file browser/downloader for a Gen3 commons.

Module Contents

class lunapi.bdc.BDCClient(endpoint=_DEFAULT_ENDPOINT, key_id=None, api_key=None, project=None, session=None, token=None)[source]

Authenticated file browser/downloader for a Gen3 commons.

Parameters:
  • endpoint (str) – Base URL of the Gen3 commons.

  • key_id (str) – API-key pair created by the commons Profile page.

  • api_key (str) – API-key pair created by the commons Profile page.

  • project (str, optional) – Project identifier used by files() when supplied.

  • session (requests.Session, optional) – Injectable HTTP session for tests or callers with custom TLS setup.

endpoint = ''[source]
key_id = ''[source]
api_key = ''[source]
project = None[source]
token = None[source]
session[source]
property authenticated: bool[source]
authenticate() str[source]
projects() list[str][source]

Return project IDs visible to the current credentials when available.

files(project=None) list[dict][source]

Return normalized file-index records for project.

Gen3 deployments expose slightly different metadata keys. The normalizer accepts the common indexd fields and preserves the raw record under raw for callers needing deployment-specific data.

recording_groups(project=None) list[dict][source]

Group EDF records with same-basename sidecars.

download(record: dict, destination: str | os.PathLike, force=False, progress: Callable[[int, int], None] | None = None) pathlib.Path[source]

Download one normalized index record to destination.

Existing files are skipped unless force is true. A Range header resumes a partial file when the server supports it.

lunapi.bdc.bdc[source]