跳到正文
Skillpedia
数据库51k · #3446

datalad

它能做什么

DataLad 是一个帮助管理大型科学数据集的工具。它可以让你高效地下载、组织和共享数据,并确保你清楚每份副本的位置,以及如何复现分析过程。

适用场景

  • ✓需要从 OpenNeuro 或 DANDI 等平台下载数据时。
  • ✓文件看起来像是失效的链接,或者只是一个很小的文本文件,而不是真正的数据时。
  • ✓需要确保将来能够完全相同地重复分析时。

技能链接

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/datalad/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/datalad/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“怎么下载我这个项目的全部数据?”

每周 5 个新技能,1 分钟读完。

工作原理

DataLad 使用 Git 来跟踪文件结构,并使用 git-annex 来管理大文件的内容。它会保存运行过哪些命令、使用了哪些数据的信息,方便你或其他人复现结果。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

DataLad

Overview

DataLad is a data management layer over Git and git-annex. Git tracks the dataset structure, small text files, and the history. git-annex tracks the content of large files, storing each file as a key and keeping the bytes somewhere that is not necessarily the local repository.

A normal clone retrieves Git history and the top-level file listing while leaving annexed bytes unfetched. Installed subdatasets have their own histories; a clone does not automatically populate them. Clone cost depends on Git history and file count, not just the data volume. Retrieve annexed bytes selectively with datalad get.

The second thing DataLad adds is provenance. datalad run executes a command and commits the result together with a machine-readable record of the command, its inputs, and its outputs. datalad rerun reads that record back and re-executes it. This turns "how was this figure produced" from an archaeology problem into a command.

When to use DataLad instead of plain Git

Use DataLad when any of the following holds:

  • Files are too large for Git to handle comfortably, or the total exceeds what every collaborator wants on disk.
  • Data lives in more than one place (a lab server, a cluster scratch, S3, a supercomputer) and you need to know which copies exist.
  • The analysis must be re-executable, and a plain commit message is not enough evidence.
  • You are consuming published datasets from OpenNeuro, DANDI, or datasets.datalad.org, which are distributed as DataLad datasets.
  • The project nests other datasets inside it and you want each one to keep its own independent history.

Use plain Git when the repository is code and text only, everything fits comfortably in Git, and nobody needs partial checkouts. DataLad on top of a small pure-code repository adds indirection without buying anything.

Installation

# git-annex is NOT written in Python but is available from PyPI if you already
# have git itself installed:
uv pip install git-annex
# You can also install it first from the system
# (Debian/Ubuntu: apt install git-annex; macOS: brew install git-annex;
#  conda-forge: conda install -c conda-forge git-annex)
uv pip install "datalad==1.6.5"
uv pip install "datalad-container==1.2.6"   # only for containers-run

datalad wtf --section dependencies   # confirm git-annex version is visible

The PyPI git-annex package supplies platform-specific binaries. The reviewed 10.20260901.post1 wheels cover Linux glibc 2.34+ (x86_64/ARM64), macOS ARM64 14+ and x86_64 15+, and Windows x86_64. Use a system package when no wheel matches. Keep its environment on PATH and verify the executable; the wheel does not supply Git itself. Configure Git author name/email before creating or saving a dataset.

datalad wtf prints the resolved environment and is the first thing to run when behaviour looks impossible. An old or missing git-annex is behind a large share of confusing errors.

DataLad is MIT licensed; git-annex has a separate AGPL license. Consult the upstream license when redistributing either tool.

The failure that bites first: pointers are not data

After datalad clone, annexed files exist as symlinks into .git/annex/objects/ (or as small pointer files where symlinks are unavailable, such as on Windows or a crippled filesystem). Nothing has downloaded the content yet.

Illustrative remote-data example; inspect the selected revision for the exact path and install NiBabel before the Python read. The refresh tested equivalent local pointer/get behavior without downloading imaging data.

datalad clone https://github.com/OpenNeuroDatasets/ds000001.git
cd ds000001
ls sub-01/anat/            # the file is listed
python -c "import nibabel; nibabel.load('sub-01/anat/sub-01_T1w.nii.gz')"   # fails
datalad get sub-01/anat/sub-01_T1w.nii.gz                                   # now it works

The failure mode to recognise: a tool reports the file as empty, truncated, corrupt, "not a gzip file", or a broken symlink, and the file size on disk is a few hundred bytes. These symptoms can indicate an unfetched annex pointer; confirm with annex status before diagnosing corruption. Run datalad get before reading data, and treat "file exists" as insufficient evidence that its content is present.

Before an analysis touches a directory, fetch it explicitly:

datalad get sub-01/                  # everything under a path

…
常见问题

为什么我的文件看起来像失效的链接?

这是因为 DataLad 默认只下载文件结构。你需要使用 'datalad get' 命令,才能下载你要用到的文件的实际内容。

如何确保分析过程可以复现?

使用 'datalad run' 命令来执行你的命令。它会自动记录哪些文件作为输入被使用,哪些文件作为输出被生成,方便你或其他人以后重新执行这次分析。

Git 和 DataLad 有什么区别?

Git 非常适合管理代码和小型文本文件。DataLad 则是在 Git 和 git-annex 的基础上构建的,用于管理大文件,并确保科学分析可以被复现。

详情

作者的原始描述

Retrieves, versions, and publishes scientific datasets with DataLad and git-annex, and captures computational provenance with datalad run, rerun, and containers-run. Use when cloning or fetching data from OpenNeuro, DANDI, datasets.datalad.org, or any DataLad dataset; when a file in a dataset reads as a broken symlink or a small pointer instead of real data; when an analysis needs a machine-readab

repo: K-Dense-AI/scientific-agent-skills

热度

GitHub 星标
51k
排名
#3446
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能