Skip to content

Commit

Permalink
✨ Manually save collection (#78)
Browse files Browse the repository at this point in the history
Signed-off-by: zethson <[email protected]>
  • Loading branch information
Zethson committed Aug 2, 2024
1 parent 107bd1b commit b7cdb21
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
aws-region: us-east-1
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"

- name: install Python deps
run: pip install laminci
Expand Down
8 changes: 5 additions & 3 deletions cellxgene_lamin/curate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import re
from importlib import resources
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Iterable

import bionty as bt
import lamindb_setup as ln_setup
import pandas as pd
from lamin_utils import logger
from lamin_utils import colors, logger
from lamindb import Collection
from lamindb._curate import AnnDataCurator, validate_categories_in_df

from .fields import CellxGeneFields
Expand All @@ -16,6 +18,7 @@
from pathlib import Path

import anndata as ad
from lamindb import Artifact
from lnschema_core.types import FieldAttr


Expand Down Expand Up @@ -173,7 +176,6 @@ def to_cellxgene_anndata(
Args:
is_primary_data: Whether the measured data is primary data or not.
title: Title of the AnnData object. Commonly the name of the publication.
This parameter is required if the AnnData object is not a part of a Collection.
Returns:
An AnnData object which adheres to the cellxgene-schema.
Expand Down
12 changes: 5 additions & 7 deletions docs/cellxgene-curate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,14 @@
"outputs": [],
"source": [
"# register a new collection\n",
"collection = curate.save_collection(\n",
"title = \"Cross-tissue immune cell analysis reveals tissue-specific features in humans (for test demo only)\"\n",
"collection = ln.Collection(\n",
" [artifact], # registered artifact above, can also pass a list of artifacts\n",
" name=( # title of the publication\n",
" \"Cross-tissue immune cell analysis reveals tissue-specific features in humans\"\n",
" \" (for test demo only)\"\n",
" ),\n",
" name=title, # title of the publication\n",
" description=\"10.1126/science.abl5197\", # DOI of the publication\n",
" reference=\"E-MTAB-11536\", # accession number (e.g. GSE#, E-MTAB#, etc.)\n",
" reference_type=\"ArrayExpress\", # source type (e.g. GEO, ArrayExpress, SRA, etc.)\n",
")"
").save()"
]
},
{
Expand All @@ -405,7 +403,7 @@
},
"outputs": [],
"source": [
"adata_cxg = curate.to_cellxgene_anndata(is_primary_data=True)\n",
"adata_cxg = curate.to_cellxgene_anndata(is_primary_data=True, title=title)\n",
"adata_cxg"
]
},
Expand Down

0 comments on commit b7cdb21

Please sign in to comment.