Skip to main content

Print partial datasets.

Project description

print_partial_datasets

https://img.shields.io/pypi/v/print_partial_datasets.svg https://gitlab.com/evan.edmond/print_partial_datasets/badges/master/pipeline.svg Documentation Status

Command-line tool to scan a dataset organised in structured directories and print a table to highlight gaps. This is useful for spotting missing data or broken analyses. It relies on the wonderful fsl.utils.filetree tool from fslpy. For example:

Complete datasets
    participant    session    raw_T1    raw_bold    raw_fmap_mag    raw_fmap_ph
───────────────────────────────────────────────────────────────────────────────
            01         01         x           x               x              x
───────────────────────────────────────────────────────────────────────────────
            01         02         x           x               x              x
───────────────────────────────────────────────────────────────────────────────
Partial datasets
    participant    session    raw_T1    raw_bold    raw_fmap_mag    raw_fmap_ph
───────────────────────────────────────────────────────────────────────────────
            04         02                     x               x              x
───────────────────────────────────────────────────────────────────────────────
            07         02         x                           x              x
───────────────────────────────────────────────────────────────────────────────
            10         02         x                           x              x
───────────────────────────────────────────────────────────────────────────────

Installation

pip install print-partial-datasets

Usage

Specify your own file tree in a text file as shown in the fsl.utils.filetree documentation. This can be as simple as the example below. If your dataset is already organised in a structure such as BIDS, you may be able to use one of the preset trees:

sub-{participant}
  ses-{session}
    anat (anat_dir)
      sub-{participant}_ses-{session}_T1w.nii.gz (anat_image)
      sub-{participant}_ses-{session}_T1w_brain.nii.gz (brain_extracted)
    dwi (dwi_dir)
      sub-{participant}_ses-{session}_dwi.nii.gz (dwi_image)

You can either call the script from the command line, or programmatically from a python console or script.

Command line

print_partial_datasets -d /data/directory -f /path/to/file.tree -s anat_image brain_extracted dwi_image -v participant session

Python

Example python usage:

from print_partial_datasets import print_partial_datasets

datadir = "/data/directory"
filetree = "/path/to/file.tree"
short_name = ["anat_image", "brain_extracted", "dwi_image"]
variables = ["participant", "session"]

print_partial_datasets(datadir, filetree, short_name, variables)

This should produce a nice printed summary of your data, with complete datasets followed by partial ones.

Credits

This is little more than a user-friendly wrapper around code written by Michiel Cottaar and Paul McCarthy.

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2021-03-17)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

print_partial_datasets-0.2.2-py2.py3-none-any.whl (9.4 kB view details)

Uploaded Python 2Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page