Skip to content

Commit

Permalink
add vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Oct 4, 2024
1 parent 9119239 commit 40e488c
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.quarto/
*.html
*.R
*_files
_quarto.yaml
133 changes: 133 additions & 0 deletions vignettes/structure.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
title: "Package structure"
vignette: >
%\VignetteIndexEntry{Package structure}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{quarto::html}
editor_options:
chunk_output_type: console
knitr:
opts_chunk:
collapse: true
comment: "#>"
---

```{mermaid}
classDiagram
laminr --> RichInstance

Check warning on line 17 in vignettes/structure.qmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/structure.qmd,line=17,col=4,[indentation_linter] Indentation should be 0 spaces but is 4 spaces.

Check warning on line 17 in vignettes/structure.qmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/structure.qmd,line=17,col=13,[assignment_linter] Use <-, not ->, for assignment.

Check warning on line 17 in vignettes/structure.qmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/structure.qmd,line=17,col=13,[error] unexpected '->'
laminr --> UserSettings
laminr --> InstanceSettings
RichInstance --|> Instance
Instance --> InstanceAPI
Instance --> Module
Core --|> Module
Bionty --|> Module
Module --> Registry
Registry --> Field
Registry --> RichRecord
Artifact --|> Record
RichInstance --> Core
RichInstance --> Bionty
Core --> Artifact
RichRecord --|> Record

Check warning on line 33 in vignettes/structure.qmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/structure.qmd,line=33,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
class laminr{

Check warning on line 34 in vignettes/structure.qmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/structure.qmd,line=34,col=4,[indentation_linter] Indentation should be 0 spaces but is 4 spaces.
+connect(String slug): RichInstance

Check warning on line 35 in vignettes/structure.qmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/structure.qmd,line=35,col=8,[indentation_linter] Indentation should be 0 spaces but is 8 spaces.
}

Check warning on line 36 in vignettes/structure.qmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/structure.qmd,line=36,col=4,[indentation_linter] Indentation should be 0 spaces but is 4 spaces.
class UserSettings{

Check warning on line 38 in vignettes/structure.qmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/structure.qmd,line=38,col=4,[indentation_linter] Indentation should be 0 spaces but is 4 spaces.
+initialize(...): UserSettings

Check warning on line 39 in vignettes/structure.qmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/structure.qmd,line=39,col=8,[indentation_linter] Indentation should be 0 spaces but is 8 spaces.
+email: String
+access_token: String
+uid: String
+uuid: String
+handle: String
+name: String
}

Check warning on line 46 in vignettes/structure.qmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/structure.qmd,line=46,col=4,[indentation_linter] Indentation should be 0 spaces but is 4 spaces.
class InstanceSettings{
+initialize(...): InstanceSettings
+owner: String
+name: String
+id: String
+schema_id: String
+api_url: String
}
class Instance{
+initialize(InstanceSettings Instance_settings, API api, Map<String, any> schema): Instance
+get_modules(): Module[]
+get_module(String module_name): Module
+get_module_names(): String[]
}
class InstanceAPI{
+initialize(InstanceSettings Instance_settings)
+get_schema(): Map~String, Any~
+get_record(...): Map~String, Any~
}
class RichInstance{
+initialize(InstanceSettings Instance_settings, API api, Map<String, any> schema): RichInstance
+Registry Artifact
+Registry Collection
+...registry accessors...
+Registry User
+Bionty bionty
}
class Core{
+Registry Artifact
+Registry Collection
+...registry accessors...
+Registry User
}
class Bionty{
+Registry CellLine
+Registry CellMarker
+...registry accessors...
+Registry Tissue
}
class Module{
+initialize(Instance Instance, API api, String module_name, Map<String, any> module_schema): Module
+name: String
+get_registries(): Registry[]
+get_registry(String registry_name): Registry
+get_registry_names(): String[]
}
class Registry{
+initialize(Instance Instance, Module module, API api, String registry_name, Map<String, Any> registry_schema): Registry
+name: String
+class_name: String
+is_link_table: Bool
+get_fields(): Field[]
+get_field(String field_name): Field
+get_field_names(): String[]
+get(String id_or_uid, Bool include_foreign_keys, List~String~ select, Bool verbose): RichRecord
+get_registry_class(): RichRecordClass
}
class Artifact{
+initialize(...): Artifact
+cache(): String
+load(): Any
}
class Field{
+initialize(...): Field
+type: String
+through: Map
+field_name: String
+registry_name: String
+column_name: String
+module_name: String
+is_link_table: Bool
+relation_type: String
+related_field_name: String
+related_registry_name: String
+related_module_name: String
}
class RichRecord{
+...field value accessors...
}
class Record{
+initialize(Instance Instance, Registry registry, API api, Map<String, Any> data): Record
+get_value(String field_name): Any
}
```
104 changes: 104 additions & 0 deletions vignettes/usage.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
title: "Usage"
vignette: >
%\VignetteIndexEntry{Usage}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{quarto::html}
editor_options:
chunk_output_type: console
knitr:
opts_chunk:
collapse: true
comment: "#>"
---

```{r setup}
library(laminr)
```

## Instance

### Connect to a LaminDB instance

```{r connect}
db <- connect("laminlabs/cellxgene")
```


### Print a LaminDB instance

```{r print_instance}
db
```

### Get module

```{r get_module}
db$get_module("core")
db$bionty
```

## Registry

```{r get_artifact_registry}
db$Artifact
```

```{r get_bionty_celline}
db$bionty$CellLine
```

## Record

### Get artifact

```{r get_artifact}
artifact <- db$Artifact$get("KBW89Mf7IGcekja2hADu")
```

### Print artifact

```{r print_artifact}
artifact
```

### Print simple fields

```{r print_simple_fields}
artifact$id
artifact$uid
artifact$key
```

### Print related fields

```{r print_related_fields}
artifact$storage
artifact$created_by
artifact$experimental_factors
```

### Cache artifact

:::{.callout-note}
Only S3 storage is supported at the moment.
:::

```{r cache_artifact}
artifact$cache()
```

### Load artifact

:::{.callout-note}
Only S3 storage and AnnData accessors are supported at the moment.
:::

```{r load_artifact}
artifact$load()
```

0 comments on commit 40e488c

Please sign in to comment.