Skip to content

Commit

Permalink
Merge pull request #1076 from dandi/gh-1044
Browse files Browse the repository at this point in the history
Add classes for BIDS assets
  • Loading branch information
yarikoptic authored Aug 9, 2022
2 parents 0c634fd + e66abfd commit 7c42ed9
Show file tree
Hide file tree
Showing 14 changed files with 1,954 additions and 1,498 deletions.
1 change: 1 addition & 0 deletions dandi/cli/tests/test_ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def load(s):


@mark.skipif_no_network
@pytest.mark.xfail(reason="https://github.com/dandi/dandi-cli/issues/1097")
def test_ls_bids_file(bids_examples):
bids_file_path = "asl003/sub-Sub1/anat/sub-Sub1_T1w.nii.gz"
bids_file_path = os.path.join(bids_examples, bids_file_path)
Expand Down
4 changes: 4 additions & 0 deletions dandi/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ class DandiInstance(NamedTuple):
VIDEO_FILE_EXTENSIONS = [".mp4", ".avi", ".wmv", ".mov", ".flv", ".mkv"]
VIDEO_FILE_MODULES = ["processing", "acquisition"]

ZARR_EXTENSIONS = [".ngff", ".zarr"]

#: Maximum allowed depth of a Zarr directory tree
MAX_ZARR_DEPTH = 7

Expand All @@ -166,3 +168,5 @@ class DandiInstance(NamedTuple):

#: Maximum number of Zarr directory entries to delete at once
ZARR_DELETE_BATCH_SIZE = 100

BIDS_DATASET_DESCRIPTION = "dataset_description.json"
5 changes: 2 additions & 3 deletions dandi/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

import click

from .consts import DRAFT, dandiset_metadata_file
from .consts import DRAFT, ZARR_EXTENSIONS, dandiset_metadata_file
from .dandiapi import DandiAPIClient, RemoteAsset, RemoteDandiset
from .dandiarchive import BaseAssetIDURL, DandisetURL, ParsedDandiURL, parse_dandi_url
from .exceptions import NotFoundError
from .files import ZarrAsset
from .utils import get_instance, is_url


Expand Down Expand Up @@ -231,7 +230,7 @@ def find_local_asset(filepath: str) -> Tuple[str, str]:
"Use 'dandi download' or 'organize' first"
)
relpath = path.relative_to(dandiset.path).as_posix()
if path.is_dir() and path.suffix not in ZarrAsset.EXTENSIONS:
if path.is_dir() and path.suffix not in ZARR_EXTENSIONS:
relpath += "/"
return (dandiset.identifier, relpath)

Expand Down
Loading

0 comments on commit 7c42ed9

Please sign in to comment.