Xarray Linked Dataのロゴ

Xarray Linked Data

コミュニティ
ericmjl
xarray-linked-data

Design, build, and manipulate xarray data structures for highly linked, multi-dimensional data where measurements, derived estimates, and model outputs share coordinates and must stay synchronized. Use when: structuring laboratory/experimental/multi-assay data in xarray (Dataset or DataTree); designing coordinate systems for linked data; writing custom xarray indexes (custom Index subclasses, CoordinateTransforms, interval-based or N-D derived coordinate indexes); selecting/aligning/computing across linked xarray variables; linking data across experiments through shared coordinates or custom indexes; reading or manipulating xarray objects to help a user accomplish analysis goals; converting scattered CSV/Parquet/HDF5 workflows into unified xarray datasets. Covers: progressive data accumulation, coordinate design, sel/isel/where/align, groupby/rolling/ coarsen/resample, Dataset vs DataTree, custom index patterns (PeriodicIndex, RangeIndex, CoordinateTransform, NDIndex, DimensionInterval), and cross-experiment linking.

概要

公開者ericmjl
リポジトリskills
スキル名xarray-linked-data
スター
41
フォーク
5
同梱ファイル
9
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 9個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    ericmjlがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルXarray Linked DataをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/ericmjl/skills/tree/main/skills/xarray-linked-data
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ericmjl/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/xarray-linked-data .claude/skills/xarray-linked-data
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでXarray Linked Dataを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にXarray Linked Dataを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Xarray Linked Dataは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Xarray Linked Data

Xarray is the natural home for highly linked data: measurements, derived estimates, features, and model outputs sharing coordinates and staying synchronized through selection, computation, and storage.

When to use this skill

  • Designing xarray data structures for multi-dimensional, multi-assay data
  • Linking data from different experiments through shared coordinates
  • Writing custom xarray indexes (when default PandasIndex is insufficient)
  • Reading/manipulating xarray to accomplish analysis goals
  • Converting scattered-file workflows into unified coordinate-aligned datasets

Core mental model

Experiment Design          xarray Structure
─────────────────          ────────────────
Samples/subjects    →      dimension coordinates (e.g. molecule, sample)
Experimental factors →     dimension coordinates (e.g. target, cell_line, treatment)
Raw measurements    →      data variables (e.g. od450, intensity, uptake_pct_positive)
Derived estimates   →      data variables (e.g. ec50_nm, kd_nm)
Uncertainty         →      data variables along a `draw` dim (e.g. ec50_nm_posterior)
Features            →      data variables along a feature dimension
Splits/assignments  →      boolean mask variables along a split_type dimension
Physical units      →      coordinate attrs or CoordinateTransform indexes

Key principle: every piece of data knows its own coordinates. When you slice, everything stays aligned. No manual index-matching across files.

Quick reference

Design data structures

Read references/data-structure-design.md for full guidance.

python
# Progressive accumulation: start with raw data, add layers
ds = xr.Dataset(
    {"expression": (["molecule", "treatment", "replicate"], raw_data)},
    coords={
        "molecule": mol_ids,
        "treatment": ["control", "low", "high"],
        "replicate": ["r1", "r2", "r3"],
    },
)
# Add derived estimates — auto-aligned by coordinates
ds = ds.assign({"ec50": (["molecule"], ec50_estimates)})
# Add features along a new dimension
ds = ds.assign({"features": (["molecule", "feature"], feat_matrix)})

When to use Dataset vs DataTree:

  • Dataset: all variables share compatible dimensions/coordinates
  • DataTree: variables live on different grids (different resolutions, different assay types with incompatible shapes); use tree nodes with coordinate inheritance

Select and manipulate

Read references/selection-and-manipulation.md for full guidance.

python
# Label-based selection — everything stays aligned
# (.drop_vars() strips the leftover coordinate so the mask aligns cleanly)
train = ds.where(
    ds.train_mask.sel(split_type="random_80_20").drop_vars("split_type"), drop=True
)

# Pointwise indexing with shared dimension
targets = ds.sel(
    molecule=xr.DataArray(["LNP_003", "LNP_007"], dims="query"),
    method="nearest",
)

# Alignment with explicit join type
aligned_a, aligned_b = xr.align(ds_a, ds_b, join="inner")

Build custom indexes

Read references/custom-indexes.md for full guidance, including complete reference implementations.

When default PandasIndex (1-D monotonic labels) is insufficient, build a custom index. Three patterns, escalating complexity:

  1. Index subclass + hand-written sel — for custom selection logic (periodic/wrapping coordinates, domain-specific nearest-neighbor)
  2. CoordinateTransform subclass — for coordinate mappings with forward/reverse (pixel to physical, lazy z-stacks, nonlinear warps)
  3. Meta-index — wraps other indexes for linked multi-coordinate selection (interval cross-slicing, N-D derived coordinates)
python
# Register a custom index
ds = ds.drop_indexes("angle").set_xindex("angle", PeriodicIndex, period=360.0)

Link across experiments

Read references/cross-experiment-linking.md for full guidance.

python
# DataTree for multi-assay hierarchy: root defines the shared `molecule`
# coordinate, child nodes inherit it (a "deep" tree -- see nb5)
tree = xr.DataTree.from_dict({
    "/": xr.Dataset(coords={"molecule": mol_ids}),
    "/characterization/dls": dls_ds,
    "/characterization/hplc": hplc_ds,
    "/bioassays/binding": binding_ds,
    "/bioassays/flow_cytometry": flow_ds,
})
# One selection propagates to every node
tree.sel(molecule="LNP_007")

Reference notebooks

Self-verifying marimo notebooks with synthetic data covering diverse assay domains (cargo delivery, binding assays, cell-based assays, genomics, functional readouts, analytical chemistry). Run each with uv run:

NotebookTopic
01_linked_data_design.pyProgressive accumulation across 6 assay domains; PyMC posteriors on a draw dim; flat DataTree + Zarr persistence -- all linked by molecule
02_periodic_and_transform_indexes.pyPeriodicIndex + CoordinateTransform (flow cytometry, microscopy, mass spec)
03_ndindex_time_locking.pyNDIndex for N-D derived coordinates, time-locking to dosing events
04_linked_intervals_cross_slicing.pyDimensionInterval for concentration x time interval linking
05_cross_experiment_datatree.pyDeep DataTree (root-coordinate inheritance) for incompatible grids -- contrasted with Notebook 1's flat tree; cross-assay queries

API instability note

Custom indexes are an experimental xarray feature (since v2022.06.0). The API may change without deprecation notice. Pin xarray versions in notebooks and check the official docs for current API.

Key references

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Xarray Linked Data」では何ができますか?

Design, build, and manipulate xarray data structures for highly linked, multi-dimensional data where measurements, derived estimates, and model outputs share coordinates and must stay synchronized. Use when: structuring laboratory/experimental/multi-assay data in xarray (Dataset or DataTree); designing coordinate systems for linked data; writing custom xarray indexes (custom Index subclasses, CoordinateTransforms, interval-based or N-D derived coordinate indexes); selecting/aligning/computing across linked xarray variables; linking data across experiments through shared coordinates or custo...

TypingMindでXarray Linked Dataを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Xarray Linked Dataはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにXarray Linked Dataをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/ericmjl/skills/tree/main/skills/xarray-linked-dataを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Xarray Linked Dataを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Xarray Linked Dataは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもXarray Linked Dataを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Xarray Linked Data」は無料ですか?

はい。ericmjlがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇