cohort-creator 0.3.0
Creates a neuroimaging cohort by aggregating data across datasets.
License: MIT
Requires Python: >=3.10

[![Test](https://github.com/neurodatascience/cohort_creator/actions/workflows/test.yml/badge.svg)](https://github.com/neurodatascience/cohort_creator/actions/workflows/test.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/neurodatascience/cohort_creator/main.svg)](https://results.pre-commit.ci/latest/github/neurodatascience/cohort_creator/main)
![License](https://img.shields.io/badge/license-MIT-blue.svg)
![https://github.com/psf/black](https://img.shields.io/badge/code%20style-black-000000.svg)
[![Sourcery](https://img.shields.io/badge/Sourcery-enabled-brightgreen)](https://sourcery.ai)
[![Documentation Status](https://readthedocs.org/projects/cohort-creator/badge/?version=latest)](https://cohort-creator.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/neurodatascience/cohort_creator/branch/main/graph/badge.svg?token=PMQYH0DIPX)](https://codecov.io/gh/neurodatascience/cohort_creator)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8313304.svg)](https://doi.org/10.5281/zenodo.8313304)
[![python versions](https://img.shields.io/pypi/pyversions/cohort_creator.svg)](https://pypi.org/project/cohort_creator/)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
# Cohort creator

> **TL;DR**
>
> Creates a neuroimaging cohort by aggregating data across datasets.

Command line tool to:

-   install a set of BIDS datalad datasets,
-   get the data for a set of participants,
-   copy the data to a new directory structure to create a "cohort".

It takes 2 files as input that should list:

-   datasets to be included in the cohort
-   subject in each dataset to be included in the cohort

Both of those files can be generated by the [neurobagel query tool](https://query.neurobagel.org/).

For examples of inputs TSV files see this [page](https://cohort-creator.readthedocs.io/en/latest/inputs.html).

It [outputs the cohort](<(https://cohort-creator.readthedocs.io/en/latest/outputs.html)>)
following the recommendations
from the [BIDS extension proposal 35](https://docs.google.com/document/d/1tFRNumQyIgjXBNC3brFDLO9FaikjL84noxK6Om-Ctik).

## Requirements

### Operating system

It is recommended to use this package on a linux / Mac OS.

If you are on Windows, try using WSL (Windows Subsystem for Linux) to run this package:
windows does not handle symbolic links well, and this package relies on symlinks.
If you decided to go ahead anyway make sure you have got a LOT of disk space available.

More information
[here](https://handbook.datalad.org/en/latest/intro/windows.html#ohnowindows)

### Python dependencies

Make sure you have the following installed:

-   datalad and its dependencies:

    -   if you are have anaconda / conda, it should be 'just' a matter of running

        ```bash
        conda install -c conda-forge datalad
        ```

    -   But check the
        [installation instructions](https://handbook.datalad.org/en/latest/intro/installation.html#install)
        for more details.

Other dependencies are listed in the pyproject.toml file.

## Installation

```bash
pip install cohort_creator
```

### Installation from source

```bash
git clone https://github.com/neurodatascience/cohort_creator.git
cd cohort_creator
pip install .
```

## Limitations

Cohorts can only be created by aggregating data from open BIDS datasets curated with datalad.

### Dataset types

Only possible to get data from:

-   raw
-   mriqc
-   fmriprep

Not yet possible to get freesurfer data via the cohort creator, though the data
is available in the sourcedata folder of the fmriprep datasets.

### Blind spots

It may be possible that that some metadata files (JSON, TSV) are not accessed
over correctly if they are not in the root of the dataset or the same folder as
the data file.

<!-- **FIX** use pybids / ancpbids for data indexing and querying. -->

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/michellewang"><img src="https://avatars.githubusercontent.com/u/29051929?v=4?s=100" width="100px;" alt="Michelle Wang"/><br /><sub><b>Michelle Wang</b></sub></a><br /><a href="https://github.com/neurodatascience/cohort_creator/issues?q=author%3Amichellewang" title="Bug reports">🐛</a> <a href="#ideas-michellewang" title="Ideas, Planning, & Feedback">🤔</a> <a href="#userTesting-michellewang" title="User Testing">📓</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://remi-gau.github.io/"><img src="https://avatars.githubusercontent.com/u/6961185?v=4?s=100" width="100px;" alt="Remi Gau"/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/neurodatascience/cohort_creator/commits?author=Remi-Gau" title="Tests">⚠️</a> <a href="#maintenance-Remi-Gau" title="Maintenance">🚧</a> <a href="https://github.com/neurodatascience/cohort_creator/commits?author=Remi-Gau" title="Documentation">📖</a> <a href="https://github.com/neurodatascience/cohort_creator/issues?q=author%3ARemi-Gau" title="Bug reports">🐛</a> <a href="https://github.com/neurodatascience/cohort_creator/commits?author=Remi-Gau" title="Code">💻</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!