From f20f977307f2f3ca5fc6165f51137a90879ea77f Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Mon, 7 Oct 2024 10:56:48 +0200 Subject: [PATCH 1/3] Fixed the parsing of the env files (#12) * Fixed the parsing of the env files * update changelog --- CHANGELOG.md | 4 ++++ R/settings_store.R | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17bbc0b..ce0607a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ - Linting action. - Commands for roxygenizing (`/document`) and restyling the source code (`/style`). +## BUG FIXES + +* Fixed the parsing of the env files in `~/.lamin` due to changes in the lamindb-setup Python package (PR #12). + # laminr v0.0.1 Initial POC implementation of the LaminDB API client for R. diff --git a/R/settings_store.R b/R/settings_store.R index 5b5492b..04a0254 100644 --- a/R/settings_store.R +++ b/R/settings_store.R @@ -85,7 +85,8 @@ name <- gsub(env_prefix, "", name_with_prefix) if (!name %in% names(field_types)) { - cli_abort(paste0("Unknown field: ", name)) + cli_warn(paste0("Unexpected field in '", env_file, "': ", name)) + return(list(name = name, value = NULL)) } raw_type <- field_types[[name]] @@ -120,12 +121,14 @@ env_prefix <- "lamindb_instance_" field_types <- list( + api_url = "Optional[str]", owner = "str", name = "str", storage_root = "str", storage_region = "str", db = "Optional[str]", schema_str = "Optional[str]", + schema_id = "Optional[str]", id = "str", git_repo = "Optional[str]", keep_artifacts_local = "Optional[bool]" @@ -141,6 +144,7 @@ email = "str", password = "str", access_token = "str", + api_key = "Optional[str]", uid = "str", uuid = "str", handle = "str", From 384b6d7d75e43f08fed486de28447fa5bb767378 Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 7 Oct 2024 14:04:48 +0200 Subject: [PATCH 2/3] Simplify README (#14) * Update README.md * Update README.md * Copy changes to README.qmd * Render README * Update CHANGELOG --------- Co-authored-by: Luke Zappia --- CHANGELOG.md | 4 ++++ README.md | 56 +++++++++++++++++++++------------------------------- README.qmd | 53 ++++++++++++++++++++----------------------------- 3 files changed, 47 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce0607a..b833d55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ - Linting action. - Commands for roxygenizing (`/document`) and restyling the source code (`/style`). +## MINOR CHANGES + +* Update `README` with new set up instructions and simplify (PR #14) + ## BUG FIXES * Fixed the parsing of the env files in `~/.lamin` due to changes in the lamindb-setup Python package (PR #12). diff --git a/README.md b/README.md index a7d5a2a..57d277d 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,44 @@ -# LaminDB interface in R +# LaminR: Work with LaminDB instances in R + + [![R-CMD-check](https://github.com/laminlabs/laminr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/laminlabs/laminr/actions/workflows/R-CMD-check.yaml) -This package provides an interface to the LaminDB database. It allows -you to query the database and download data from it. +This package allows you to query and download data from LaminDB +instances. -## Installation +## Setup -You can install the development version from GitHub with: +Install the development version from GitHub: ``` r # install.packages("remotes") remotes::install_github("laminlabs/laminr") ``` -## Set up environment - -For this package to work, we first need to run the following commands in -the terminal: +Install the Lamin CLI and authenticate: ``` bash -pip install lamindb +pip install lamin-cli lamin login -lamin load laminlabs/cellxgene ``` ## Usage +Load the library + ``` r library(laminr) ``` -## Instance - -### Connect to a LaminDB instance +## Database instance ``` r db <- connect("laminlabs/cellxgene") -``` - -### Print a LaminDB instance - -``` r db ``` @@ -74,7 +67,7 @@ db .module_classes: list .settings: InstanceSettings, R6 -### Get module +### Schema module ``` r db$get_module("core") @@ -138,7 +131,7 @@ db$bionty .module_name: bionty .registry_classes: list -## Registry +### Registry ``` r db$Artifact @@ -192,17 +185,12 @@ db$bionty$CellLine .record_class: R6ClassGenerator .registry_name: cellline -## Record +### Record -### Get artifact +#### Get artifact ``` r artifact <- db$Artifact$get("KBW89Mf7IGcekja2hADu") -``` - -### Print artifact - -``` r artifact ``` @@ -286,7 +274,7 @@ artifact .registry: Registry, R6 get_value: function (key) -### Print simple fields +#### Print simple fields ``` r artifact$id @@ -306,7 +294,7 @@ artifact$key [1] "cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad" -### Print related fields +#### Print related fields ``` r artifact$storage @@ -467,7 +455,7 @@ artifact$experimental_factors .registry: Registry, R6 get_value: function (key) -### Cache artifact +### Download and cache an artifact > [!NOTE] > @@ -479,9 +467,9 @@ artifact$cache() Warning: Data is missing expected fields: run_id, created_by_id - ℹ 's3://cellxgene-data-public/cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad' already exists at '/home/rcannood/.cache/lamindb/cellxgene-data-public/cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad' + ℹ 's3://cellxgene-data-public/cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad' already exists at '/home/luke/.cache/lamindb/cellxgene-data-public/cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad' -### Load artifact +### Load an artifact > [!NOTE] > @@ -493,7 +481,7 @@ artifact$load() Warning: Data is missing expected fields: run_id, created_by_id - ℹ 's3://cellxgene-data-public/cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad' already exists at '/home/rcannood/.cache/lamindb/cellxgene-data-public/cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad' + ℹ 's3://cellxgene-data-public/cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad' already exists at '/home/luke/.cache/lamindb/cellxgene-data-public/cell-census/2024-07-01/h5ads/fe52003e-1460-4a65-a213-2bb1a508332f.h5ad' AnnData object with n_obs × n_vars = 51552 × 36398 obs: 'donor_id', 'Predicted_labels_CellTypist', 'Majority_voting_CellTypist', 'Manually_curated_celltype', 'assay_ontology_term_id', 'cell_type_ontology_term_id', 'development_stage_ontology_term_id', 'disease_ontology_term_id', 'self_reported_ethnicity_ontology_term_id', 'is_primary_data', 'organism_ontology_term_id', 'sex_ontology_term_id', 'tissue_ontology_term_id', 'suspension_type', 'tissue_type', 'cell_type', 'assay', 'disease', 'organism', 'sex', 'tissue', 'self_reported_ethnicity', 'development_stage', 'observation_joinid' diff --git a/README.qmd b/README.qmd index 7d7a267..3ee72c1 100644 --- a/README.qmd +++ b/README.qmd @@ -1,56 +1,50 @@ --- -title: LaminDB interface in R +title: "LaminR: Work with LaminDB instances in R" format: gfm --- + + + + [![R-CMD-check](https://github.com/laminlabs/laminr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/laminlabs/laminr/actions/workflows/R-CMD-check.yaml) -This package provides an interface to the LaminDB database. It allows you to query the database and download data from it. +This package allows you to query and download data from LaminDB instances. -## Installation +## Setup -You can install the development version from GitHub with: +Install the development version from GitHub: ```R # install.packages("remotes") remotes::install_github("laminlabs/laminr") ``` -## Set up environment - - -For this package to work, we first need to run the following commands in the terminal: +Install the Lamin CLI and authenticate: ```bash -pip install lamindb +pip install lamin-cli lamin login -lamin load laminlabs/cellxgene ``` ## Usage +Load the library + ```{r setup} library(laminr) ``` -## Instance - -### Connect to a LaminDB instance +## Database instance ```{r connect} db <- connect("laminlabs/cellxgene") -``` - - -### Print a LaminDB instance - -```{r print_instance} db ``` -### Get module +### Schema module ```{r get_module} db$get_module("core") @@ -58,7 +52,7 @@ db$get_module("core") db$bionty ``` -## Registry +### Registry ```{r get_artifact_registry} db$Artifact @@ -68,21 +62,16 @@ db$Artifact db$bionty$CellLine ``` -## Record +### Record -### Get artifact +#### Get artifact ```{r get_artifact} artifact <- db$Artifact$get("KBW89Mf7IGcekja2hADu") -``` - -### Print artifact - -```{r print_artifact} artifact ``` -### Print simple fields +#### Print simple fields ```{r print_simple_fields} artifact$id @@ -92,7 +81,7 @@ artifact$uid artifact$key ``` -### Print related fields +#### Print related fields ```{r print_related_fields} artifact$storage @@ -102,7 +91,7 @@ artifact$created_by artifact$experimental_factors ``` -### Cache artifact +### Download and cache an artifact :::{.callout-note} Only S3 storage is supported at the moment. @@ -112,7 +101,7 @@ Only S3 storage is supported at the moment. artifact$cache() ``` -### Load artifact +### Load an artifact :::{.callout-note} Only S3 storage and AnnData accessors are supported at the moment. From 75d8a7ef4071917431523f800fcc1788a462671a Mon Sep 17 00:00:00 2001 From: Alex Wolf Date: Mon, 7 Oct 2024 14:15:54 +0200 Subject: [PATCH 3/3] Auto-generate changelog at https://docs.lamin.ai/changelog (#15) --- .github/workflows/doc-changes.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/doc-changes.yml diff --git a/.github/workflows/doc-changes.yml b/.github/workflows/doc-changes.yml new file mode 100644 index 0000000..b7b9db0 --- /dev/null +++ b/.github/workflows/doc-changes.yml @@ -0,0 +1,23 @@ +name: doc-changes + +on: + pull_request_target: + branches: + - main + types: + - closed + +jobs: + latest-changes: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - run: pip install "laminci[doc-changes]@git+https://github.com/laminlabs/laminci" + - run: laminci doc-changes + env: + repo_token: ${{ secrets.GITHUB_TOKEN }} + docs_token: ${{ secrets.LAMIN_BUILD_DOCS }} + changelog_file: lamin-docs/docs/changelog/soon/laminr.md \ No newline at end of file