/bids2cite

Create a citation file for a BIDS dataset.

Primary LanguagePythonOtherNOASSERTION

Python tests codecov License https://github.com/psf/black pre-commit.ci status Documentation Status https://github.com/psf/black PyPI version PyPI - Python Version

bids2cite

Create a citation file for a BIDS dataset based on its dataset_description.json file.

Can also be used to interactively update references, authors and add a license to a dataset.

You can add references using their DOI or PMID, and add authors by using their ORCID.

This will also update the dataset_description.json by creating in a new file in a derivatives/bids2cite folder.

Visual demo

demo

Installation

pip install bids2cite

For developers

Fork the repo and clone your fork.

pip install .[dev]

Basic tests can be run with:

make test
make test-cli

Usage

Do not forget to check the online doc for more details.

Command line

The most basic usage is:

bids2cite path_to_bids_dataset

An example of call with all the options:

bids2cite "tests/bids" \
    --keywords "foo, bar, me" \
    --description "this is the description of my dataset" \
    --authors_file "inputs/authors.tsv" \
    --license "CC0-1.0" \
    --verbose

--keywords, --license and --description allow you to pass keywords, license and description to add to the citation file.

With --skip-prompt you will skip the prompt to add information manually to the citation file.

--authors_file points to a TSV file containing potential authors to add citation file. This can be useful if you need to have a single file to keep track of several lab members and only pick the relevant ones to add to a given dataset.

This TSV file must at least have first_name and last_name columns, but can also include ORCID and affiliation columns.

Example

first_name last_name ORCID affiliation
Rémi Gau 0000-0002-1535-9767 UCLouvain
Mohamed Rezk 0000-0002-1866-8645 UCLouvain

There is a sample TSV in the inputs folder.

Type the following for more info on how to run it:

bids2cite --help

Python

If you need to incorporate this into a python script you can do like this:

from bids2cite.bids2cite import bids2cite
from pathlib import Path

path_to_bids_dataset = Path("path/to/bids/dataset")

bids2cite(
    bids_dir=path_to_bids_dataset,
    description="add something",
    keywords=["foo", "bar"],
    skip_prompt=True,
)

More info in the doc

See also...