No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Latest commit b69c248 Aug 28, 2018
Permalink
Failed to load latest commit information.
bin fixing bin scripts, adding all required libraries Aug 8, 2018
docs changed docs theme Aug 13, 2018
nidm Merge pull request #95 from djarecka/owl_files Aug 28, 2018
.gitignore
.travis.yml removing py3.4, asking for py37 from xenial Aug 8, 2018
LICENSE changing the text of LICENSE; editing classifiers, authors etc. in ve… Jul 1, 2017
README.rst working on README Aug 13, 2018
setup.py

README.rst

PyNIDM: Neuroimaging Data Model in Python

A Python library to manipulate the [Neuroimaging Data Model](http://nidm.nidash.org).

Build status of the master branch

1   Dependencies

  • Graphviz <http://graphviz.org> (native package):
  • Fedora: dnf install graphviz
  • OS-X: brew install graphviz

2   Creating a conda environment and installing the library (tested with OSX)

2.1   macOS

$ conda create -n pynidm_py3 python=3
$ source activate pynidm_py3
$ cd PyNIDM
$ pip install -e .

You can try to run a test: pytest

3   NIDM-Experiment Tools

3.1   Query

$ pynidm query [OPTIONS]
Options:
-nl, --nidm_file_list TEXT
 A comma separated list of NIDM files with full path [required]
-q, --query_file PATH
 Text file containing a SPARQL query to execute [required]
-o, --output_file TEXT
 Optional output file (CSV) to store results of query
--help Show this message and exit.

3.2   BIDS MRI Conversion to NIDM

This program will convert a BIDS MRI dataset to a NIDM-Experiment RDF document. It will parse phenotype information and simply store variables/values and link to the associated json data dictionary file.

While we're migrating to using 'click', this tools is still buried in the tools directory of the repo

$ ./nidm/experiment/tools/BIDSMRI2NIDM.py -d [ROOT BIDS DIRECT] -bidsignore

Example 1:No variable->term mapping, simple BIDS dataset conversion which will add nidm.ttl file to BIDS dataset and .bidsignore file:

$ ./nidm/experiment/tools/BIDSMRI2NIDM.py -d [root directory of BIDS dataset] -o [PATH/nidm.ttl]

Example 2:No variable->term mapping, simple BIDS dataset conversion but storing nidm file somewhere else:

$ ./nidm/experiment/tools/BIDSMRI2NIDM.py -d [root directory of BIDS dataset] -ilxkey [Your Interlex key] -github [username token] -bidsignore

Example 3:BIDS conversion with variable->term mappings, no existing mappings available, uses Interlex for terms and github for defining terms you can't find in Interlex (note, for now these two need to be used together)! To get an Interlex API key you visit [SciCrunch](http://scicrunch.org), register for an account, then click on "MyAccount" and "API Keys" to add a new API key for your account. Use this API Key for the -ilxkey parameter below. This example adds a nidm.ttl file BIDS dataset and .bidsignore file and it will by default create you a JSON mapping file which contains the variable->term mappings you defined during the interactive, iterative activity of using this tool to map your variables to terms. The default JSON mapping file will be called nidm_json_map.json but you can also specify this explictly using the -json_map parameter (see Example 5 below):

$ ./nidm/experiment/tools/BIDSMRI2NIDM.py -d [root directory of BIDS dataset] -ilxkey [Your Interlex key] -github [username token] -owl -bidsignore

Example 4: BIDS conversion with variable->term mappings, no existing mappings available, uses Interlex + NIDM OWL file for terms and github, adds nidm.ttl file BIDS dataset and .bidsignore file:

$ ./nidm/experiment/tools/BIDSMRI2NIDM.py -d [root directory of BIDS dataset] -json_map [Your JSON file] -ilxkey [Your Interlex key] -github [username token] -owl -bidsignore

Example 5 (FULL MONTY): BIDS conversion with variable->term mappings, uses JSON mapping file first then uses Interlex + NIDM OWL file for terms and github, adds nidm.ttl file BIDS dataset and .bidsignore file:

json mapping file has entries for each variable with mappings to formal terms. Example:

{

"site": {

"definition": "Number assigned to site",

"label": "site_id (UC Provider Care)",

"url": "http://uri.interlex.org/NDA/uris/datadictionary/elements/2031448"

},

"gender": {

"definition": "ndar:gender",

"label": "ndar:gender",

"url": "https://ndar.nih.gov/api/datadictionary/v2/dataelement/gender"

}

}

optional arguments:
-h, --help show this help message and exit
-d DIRECTORY Path to BIDS dataset directory
-jsonld, --jsonld
 If flag set, output is json-ld not TURTLE
-png, --png If flag set, tool will output PNG file of NIDM graph
-bidsignore, --bidsignore
 If flag set, tool will add NIDM-related files to .bidsignore file
-o OUTPUTFILE Outputs turtle file called nidm.ttl in BIDS directory by default

map variables to terms arguments:

-json_map JSON_MAP, --json_map JSON_MAP

Optional user-suppled JSON file containing variable-term mappings.

-ilxkey KEY, --ilxkey KEY

Interlex/SciCrunch API key to use for query

-github [GITHUB [GITHUB ...]], --github [GITHUB [GITHUB ...]]

Use -github flag with list username token(or pw) for storing locally-defined terms in a nidm-local-terms repository in GitHub. If user doesn''t supply a token then user will be prompted for username/password.

Example: -github username token

-owl Optional flag to query nidm-experiment OWL files

3.3   CSV File to NIDM Conversion

This program will load in a CSV file and iterate over the header variable names performing an elastic search of https://scicrunch.org/ for NIDM-ReproNim tagged terms that fuzzy match the variable names. The user will then interactively pick a term to associate with the variable name. The resulting annotated CSV data will then be written to a NIDM data file.

While we're migrating to using 'click', this tools is still buried in the tools directory of the repo

$ ./nidm/experiment/tools/CSV2NIDM.py  [OPTIONS]
optional arguments:
-h, --help show this help message and exit

-csv CSV_FILE Path to CSV file to convert

-ilxkey KEY Interlex/SciCrunch API key to use for query

-json_map JSON_MAP User-suppled JSON file containing variable-term mappings.

-nidm NIDM_FILE Optional NIDM file to add CSV->NIDM converted graph to

-github [GITHUB [GITHUB ...]]
Use -github flag with username token(or pw) for storing locally-defined terms in a "nidm-local-terms" repository in GitHub. If user doesnt supply a token then user will be prompted for username/password. Example: -github username token
-owl Optionally searches NIDM OWL files...internet connection required

-out OUTPUT_FILE Filename to save NIDM file