Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into spatially_variable_genes
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Sep 4, 2024
2 parents 3854158 + 9493835 commit 339ba74
Show file tree
Hide file tree
Showing 231 changed files with 2,045 additions and 498 deletions.
21 changes: 1 addition & 20 deletions .github/workflows/viash-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,15 @@ name: viash test
on:
pull_request:
push:
branches: [ '**' ]
branches: [ main ]

jobs:
run_ci_check_job:
runs-on: ubuntu-latest
outputs:
run_ci: ${{ steps.github_cli.outputs.check }}
steps:
- name: 'Check if branch has an existing pull request and the trigger was a push'
id: github_cli
run: |
pull_request=$(gh pr list -R ${{ github.repository }} -H ${{ github.ref_name }} --json url --state open --limit 1 | jq '.[0].url')
# If the branch has a PR and this run was triggered by a push event, do not run
if [[ "$pull_request" != "null" && "$GITHUB_REF_NAME" != "main" && "${{ github.event_name == 'push' }}" == "true" && "${{ !contains(github.event.head_commit.message, 'ci force') }}" == "true" ]]; then
echo "check=false" >> $GITHUB_OUTPUT
else
echo "check=true" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GTHB_PAT }}

# phase 1
list:
needs: run_ci_check_job
env:
s3_bucket: s3://openproblems-data/resources_test/
runs-on: ubuntu-latest
if: "needs.run_ci_check_job.outputs.run_ci == 'true'"

outputs:
matrix: ${{ steps.set_matrix.outputs.matrix }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
README.html
README_files/
*.DS_Store
*__pycache__
*.h5ad
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ functionality:
path: script.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
setup:
- type: python
packages: [scikit-learn]
Expand Down
2 changes: 1 addition & 1 deletion src/common/check_dataset_schema/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ functionality:
path: test.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
test_setup:
- type: python
packages: viashpy
Expand Down
2 changes: 1 addition & 1 deletion src/common/check_yaml_schema/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ functionality:
path: script.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
setup:
- type: python
pypi:
Expand Down
4 changes: 2 additions & 2 deletions src/common/create_component/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ def generate_resources(par, script_path) -> str:
def generate_docker_platform(par) -> str:
"""Set up the docker platform for Python."""
if par["language"] == "python":
image_str = "ghcr.io/openproblems-bio/base_python:1.0.4"
image_str = "openproblems/base_python:1.0.0"
setup_type = "python"
package_example = "scib==1.1.5"
elif par["language"] == "r":
image_str = "ghcr.io/openproblems-bio/base_r:1.0.4"
image_str = "openproblems/base_r:1.0.0"
setup_type = "r"
package_example = "tidyverse"
return strip_margin(f'''\
Expand Down
2 changes: 1 addition & 1 deletion src/common/create_task_readme/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ functionality:
dest: openproblems-v2/_viash.yaml
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_r:1.0.4
image: openproblems/base_r:1.0.0
setup:
- type: r
packages: [dplyr, purrr, rlang, glue, yaml, fs, cli, igraph, rmarkdown, processx]
Expand Down
2 changes: 1 addition & 1 deletion src/common/extract_metadata/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ functionality:
path: test.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
test_setup:
- type: python
packages: viashpy
Expand Down
2 changes: 1 addition & 1 deletion src/common/extract_scores/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ functionality:
path: script.R
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_r:1.0.4
image: openproblems/base_r:1.0.0
setup:
- type: r
cran: [ tidyverse ]
Expand Down
77 changes: 77 additions & 0 deletions src/common/helper_functions/read_anndata_partial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import warnings
from pathlib import Path
import anndata as ad
import h5py
from scipy.sparse import csr_matrix
from anndata.experimental import read_elem, sparse_dataset


def read_anndata(
file: str,
backed: bool = False,
**kwargs
) -> ad.AnnData:
"""
Read anndata file
:param file: path to anndata file in h5ad format
:param kwargs: AnnData parameter to group mapping
"""
assert Path(file).exists(), f'File not found: {file}'

f = h5py.File(file, 'r')
kwargs = {x: x for x in f} if not kwargs else kwargs
if len(f.keys()) == 0:
return ad.AnnData()
# check if keys are available
for name, slot in kwargs.items():
if slot not in f:
warnings.warn(
f'Cannot find "{slot}" for AnnData parameter `{name}` from "{file}"'
)
adata = read_partial(f, backed=backed, **kwargs)
if not backed:
f.close()

return adata


def read_partial(
group: h5py.Group,
backed: bool = False,
force_sparse_types: [str, list] = None,
**kwargs
) -> ad.AnnData:
"""
Partially read h5py groups
:params group: file group
:params force_sparse_types: encoding types to convert to sparse_dataset via csr_matrix
:params backed: read sparse matrix as sparse_dataset
:params **kwargs: dict of slot_name: slot, by default use all available slot for the h5py file
:return: AnnData object
"""
if force_sparse_types is None:
force_sparse_types = []
elif isinstance(force_sparse_types, str):
force_sparse_types = [force_sparse_types]
slots = {}
if backed:
print('Read as backed sparse matrix...')

for slot_name, slot in kwargs.items():
print(f'Read slot "{slot}", store as "{slot_name}"...')
if slot not in group:
warnings.warn(f'Slot "{slot}" not found, skip...')
slots[slot_name] = None
else:
elem = group[slot]
iospec = ad._io.specs.get_spec(elem)
if iospec.encoding_type in ("csr_matrix", "csc_matrix") and backed:
slots[slot_name] = sparse_dataset(elem)
elif iospec.encoding_type in force_sparse_types:
slots[slot_name] = csr_matrix(read_elem(elem))
if backed:
slots[slot_name] = sparse_dataset(slots[slot_name])
else:
slots[slot_name] = read_elem(elem)
return ad.AnnData(**slots)

2 changes: 1 addition & 1 deletion src/common/ontology/check_obsolete_terms/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ functionality:
- path: /resources_test/common/cellxgene_census
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_r:1.0.4
image: openproblems/base_r:1.0.0
setup:
- type: r
packages: [ dplyr, tidyr, tibble, ontologyIndex, processx ]
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ functionality:
path: script.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
- type: nextflow
directives:
label: [lowmem, lowtime, lowcpu]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ functionality:
path: script.R
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_r:1.0.4
image: openproblems/base_r:1.0.0
setup:
- type: r
cran: [ purrr, dplyr, yaml, rlang, processx ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ functionality:
dest: test_file.yaml
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_r:1.0.4
image: openproblems/base_r:1.0.0
setup:
- type: r
cran: [ purrr, yaml, rlang, processx ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ functionality:
dest: test_file.yaml
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_r:1.0.4
image: openproblems/base_r:1.0.0
setup:
- type: r
cran: [ purrr, yaml, rlang, processx ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ functionality:
dest: test_file.yaml
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_r:1.0.4
image: openproblems/base_r:1.0.0
setup:
- type: r
cran: [ purrr, yaml, rlang, processx ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ functionality:
path: script.R
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_r:1.0.4
image: openproblems/base_r:1.0.0
setup:
- type: r
cran: [ purrr, yaml, rlang, dplyr, tidyr, readr, lubridate, dynutils, processx ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ functionality:
dest: test_file.yaml
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_r:1.0.4
image: openproblems/base_r:1.0.0
setup:
- type: r
cran: [ purrr, yaml, rlang, processx ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ functionality:
dest: test_file.yaml
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
- type: nextflow
- type: native
2 changes: 1 addition & 1 deletion src/datasets/loaders/cellxgene_census/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ functionality:
path: test.py
platforms:
- type: docker
#image: ghcr.io/openproblems-bio/base_python:1.0.4
#image: openproblems/base_python:1.0.0
image: python:3.11
setup:
- type: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ functionality:
path: test.py
platforms:
- type: docker
#image: ghcr.io/openproblems-bio/base_python:1.0.4
#image: openproblems/base_python:1.0.0
image: python:3.11
setup:
- type: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ functionality:
# path: /resources_test/common/openproblems_neurips2021/neurips2021_bmmc_cite.h5ad
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
- type: nextflow
directives:
label: [highmem, midcpu , midtime]
label: [highmem, midcpu, midtime]
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ functionality:
# path: /resources_test/common/openproblems_neurips2021/neurips2021_bmmc_cite.h5ad
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
- type: nextflow
directives:
label: [ highmem, midcpu, midtime]
2 changes: 1 addition & 1 deletion src/datasets/loaders/openproblems_v1/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ functionality:
path: test.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
setup:
- type: apt
packages: git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ functionality:
path: test.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
setup:
- type: apt
packages: git
Expand Down
2 changes: 1 addition & 1 deletion src/datasets/normalization/atac_tfidf/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ functionality:
path: script.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
setup:
- type: python
packages:
Expand Down
4 changes: 2 additions & 2 deletions src/datasets/normalization/l1_sqrt/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ functionality:
path: script.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
setup:
- type: python
packages:
- scprep
- numpy
- numpy<2
- type: nextflow
directives:
label: [midtime, midmem, midcpu]
2 changes: 1 addition & 1 deletion src/datasets/normalization/log_cp/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ functionality:
description: "Number of counts per cell. When set to -1, will use None."
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
- type: nextflow
directives:
label: [midtime, midmem, midcpu]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ functionality:
path: script.R
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_r:1.0.4
image: openproblems/base_r:1.0.0
setup:
- type: r
cran: [ Matrix, rlang, scran, BiocParallel ]
Expand Down
2 changes: 1 addition & 1 deletion src/datasets/normalization/prot_clr/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ functionality:
path: script.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
setup:
- type: python
packages:
Expand Down
2 changes: 1 addition & 1 deletion src/datasets/normalization/sqrt_cp/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ functionality:
description: "Number of counts per cell"
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
- type: nextflow
directives:
label: [midtime, midmem, midcpu]
2 changes: 1 addition & 1 deletion src/datasets/processors/hvg/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ functionality:
path: script.py
platforms:
- type: docker
image: ghcr.io/openproblems-bio/base_python:1.0.4
image: openproblems/base_python:1.0.0
- type: nextflow
directives:
label: [midtime, highmem, midcpu]
Loading

0 comments on commit 339ba74

Please sign in to comment.