GithubHelp home page GithubHelp logo

remi-gau / bidsgnostic Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.55 MB

BIDS app to view a dataset content and the events file content

Home Page: http://bidsgnostic.rtfd.io/

License: Other

Python 94.30% Makefile 1.27% Dockerfile 0.76% Shell 3.66%
bids bids-apps eeg fnirs ieeg meg mri pet quality-control visualization

bidsgnostic's Introduction

license GPL3 precommit status Documentation status black sourcery circle ci

bidsgnostic

BIDS app to view:

  • the dataset content
  • events file content

Install from github with pip

pip install -e git+https://github.com/Remi-Gau/bidsgnostic#egg=bidsgnostic

Note: you can re-run this command to re-install with the latest version

Usage

short form

participant level
bidsgnostic /path/to/bids/dir /path/to/output/dir participant --cores all

example particicant output

See here for participant level interactive figure as html.

Figures will not be generated if your events have more than 14 type of events. If that is the case use the include argument to select which events you want to see.

group level
bidsgnostic_layout /path/to/bids/dir /path/to/output/dir group

example group output

See here for group level interactive figure as html.

all the gory details of the API

subject Level
usage: bidsgnostic [-h]
                [--pybidsdb-dir PYBIDSDB_DIR]
                [--reset-db]
                [--force-output]
                [--help-snakemake]
                [--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]]
                [--exclude_participant_label EXCLUDE_PARTICIPANT_LABEL [EXCLUDE_PARTICIPANT_LABEL ...]]
                [--derivatives DERIVATIVES [DERIVATIVES ...]]
                [--log_level LOG_LEVEL]
                [--filter-events FILTER_EVENTS [FILTER_EVENTS ...]]
                [--wildcards-events WILDCARDS_EVENTS [WILDCARDS_EVENTS ...]]
                [--path-events PATH_EVENTS]
                bids_dir output_dir {participant}

Snakebids helps build BIDS Apps with Snakemake

optional arguments:
-h, --help              show this help message and exit

STANDARD:
Standard options for all snakebids apps

--pybidsdb-dir PYBIDSDB_DIR,
                        Optional path to directory of SQLite databasefile for PyBIDS.
                        If directory is passed and folder exists, indexing is skipped.
                        If reset_db is called, indexing will persist
--reset-db,
                        Reindex existing PyBIDS SQLite database
--force-output,
                        Force output in a new directory that already has contents
--help-snakemake,
                        Options to Snakemake can also be passed directly at the command-line,
                        use this to print Snakemake usage

SNAKEBIDS:
Options for snakebids app

bids_dir                The directory with the input dataset formatted according to the BIDS standard.

output_dir              The directory where the output files should be stored.
                        If you are running group level analysis this folder should be prepopulated
                        with the results of the participant level analysis.

{participant}           Level of the analysis that will be performed.

--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...],
                        The label(s) of the participant(s) that should be analyzed.
                        The label corresponds to sub-<participant_label>
                        from the BIDS spec (so it does not include "sub-").
                        If this parameter is not provided all subjects should be analyzed.
                        Multiple participants can be specified with a space separated list.

--exclude_participant_label EXCLUDE_PARTICIPANT_LABEL [EXCLUDE_PARTICIPANT_LABEL ...],
                        The label(s) of the participant(s) that should be excluded.
                        The label corresponds to sub-<participant_label> from the BIDS spec
                        (so it does not include "sub-").
                        If this parameter is not provided all subjects should be analyzed.
                        Multiple participants can be specified with a space separated list.
--derivatives DERIVATIVES [DERIVATIVES ...]
                        Path(s) to a derivatives dataset, for folder(s)
                        that contains multiple derivatives datasets (default: False)
--log_level LOG_LEVEL,
                        The log_level level of the reporting
                        that will be printed to the console.
                        The default is "0", which means that
                        only warnings and errors will be reported.
                        If set to "1", all warnings, errors,
                        and informational messages will be reported.
                        If set to "2", all warnings, errors,
                        informational and debug messages will be reported.
--include-events INCLUDE_EVENTS [INCLUDE_EVENTS ...],
                    A list of events name to include in the plot.
                    If none is passed then all events will be included.
                    Must be less than 15 events.
--event_column EVENT_COLUMN,
                    Name of the column containing the events.

BIDS FILTERS:
Filters to customize PyBIDS get() as key=value pairs

--filter-events FILTER_EVENTS [FILTER_EVENTS ...],
                        (default: suffix=events extension=.tsv)

INPUT WILDCARDS:
File path entities to use as wildcards in snakemake

--wildcards-events WILDCARDS_EVENTS [WILDCARDS_EVENTS ...],
                        (default: subject session acquisition task run)

PATH OVERRIDE:
Options for overriding BIDS by specifying absolute paths that include wildcards,
e.g.: /path/to/my_data/{subject}/t1.nii.gz

--path-events PATH_EVENTS, --path_events PATH_EVENTS
group Level
usage: bidsgnostic_layout [-h]
                          [--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]]
                          [--plot_by PLOT_BY [PLOT_BY ...]]
                          [--log_level {0,1,2}]
                        bids_dir output_dir {group}

Group level diagnostic tool for BIDS datasets.
Plots the number of files per participant / session per:
    - datatype,
    - datatype / task,
    - datatype / task and split by any other BIDS entity.

positional arguments:

bids_dir
output_dir
{group}

options:

-h, --help
--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]
--log_level {0,1,2}
--plot_by PLOT_BY [PLOT_BY ...]
                        BIDS entity to split plots by.

bidsgnostic's People

Contributors

pre-commit-ci[bot] avatar remi-gau avatar

Watchers

 avatar  avatar

bidsgnostic's Issues

bids example - ds114 - group level

  • Only events in the subject folder are analyzed and the ones in the root folder are ignored.

  • Also the app fails when not passing a participant label.

 bidsgnostic github/bids/examples/ds114 ~/tmp participant  -c24 --verbose
Config file /home/remi/.cache/snakemake/snakemake/source-cache/runtime-cache/tmpy8uusbo7/file/home/remi/github/bidsgnostic/workflow/../config/snakebids.yml is extended by additional config specified via the command line.
Full Traceback (most recent call last):
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakebids/core/input_generation.py", line 965, in _get_lists_from_bids
    path = itx.one(paths)
  File "/home/remi/miniconda3/lib/python3.9/site-packages/more_itertools/more.py", line 592, in one
    raise too_long or ValueError(msg)
ValueError: Expected exactly one item in iterable, but got '/home/remi/github/bids/examples/ds114/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_task-{task}_events.tsv', '/home/remi/github/bids/examples/ds114/task-{task}_events.tsv', and perhaps more.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakemake/__init__.py", line 639, in snakemake
    workflow.include(
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakemake/workflow.py", line 1225, in include
    exec(compile(code, snakefile.get_path_or_uri(), "exec"), self.globals)
  File "/home/remi/github/bidsgnostic/workflow/Snakefile", line 16, in <module>
    bids_dir=config["bids_dir"],
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakebids/core/input_generation.py", line 614, in generate_inputs
    return BidsDataset.from_iterable(bids_inputs)
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakebids/core/input_generation.py", line 344, in from_iterable
    return cls({bidsinput.name: bidsinput for bidsinput in iterable})
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakebids/core/input_generation.py", line 344, in <dictcomp>
    return cls({bidsinput.name: bidsinput for bidsinput in iterable})
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakebids/core/input_generation.py", line 967, in _get_lists_from_bids
    raise ConfigError(  # pylint: disable=raise-missing-from
snakebids.exceptions.ConfigError: More than one snakemake filename for events, taking the first. To correct this, use the --filter_events option to narrow the search. Found filenames: {'/home/remi/github/bids/examples/ds114/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_task-{task}_events.tsv', '/home/remi/github/bids/examples/ds114/task-{task}_events.tsv'}

ConfigError in file /home/remi/github/bidsgnostic/workflow/Snakefile, line 15:
More than one snakemake filename for events, taking the first. To correct this, use the --filter_events option to narrow the search. Found filenames: {'/home/remi/github/bids/examples/ds114/sub-{subject}/ses-{session}/func/sub-{subject}_ses-{session}_task-{task}_events.tsv', '/home/remi/github/bids/examples/ds114/task-{task}_events.tsv'}
  File "/home/remi/github/bidsgnostic/workflow/Snakefile", line 15, in <module>
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakebids/core/input_generation.py", line 614, in generate_inputs
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakebids/core/input_generation.py", line 344, in from_iterable
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakebids/core/input_generation.py", line 344, in <dictcomp>
  File "/home/remi/miniconda3/lib/python3.9/site-packages/snakebids/core/input_generation.py", line 967, in _get_lists_from_bids

same run and taks required for all subjects?

missing sub-07/ses-pre run-04

MissingInputException in rule plot_events in file /home/remi/github/bidsgnostic/workflow/Snakefile, line 43:
Missing input files for rule plot_events:
    output: bidsgnostic/sub-07/ses-pre/sub-07_ses-pre_task-livingnonlivingdecisionwithplainormirrorreversedtext_run-04_events.html
    wildcards: subject=07, session=pre, task=livingnonlivingdecisionwithplainormirrorreversedtext, run=04
    affected files:
        /home/remi/github/bidsgnostic/tests/data/bids-examples/ds006/sub-07/ses-pre/func/sub-07_ses-pre_task-livingnonlivingdecisionwithplainormirrorreversedtext_run-04_events.tsv

does snakebids expect all participants to have the same runs?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.