Skip to content

Commit 03159fe

Browse files
authored
Merge pull request #100 from dbkeator/master
Created new reStructuredText README + sphinx documentation
2 parents 84d660f + 002d8fa commit 03159fe

30 files changed

+15734
-156
lines changed

README.md

Lines changed: 0 additions & 156 deletions
This file was deleted.

README.rst

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
PyNIDM: Neuroimaging Data Model in Python
2+
##########################################
3+
A Python library to manipulate the [Neuroimaging Data Model](http://nidm.nidash.org).
4+
5+
|Build Status|
6+
7+
.. contents::
8+
.. section-numbering::
9+
10+
11+
Dependencies
12+
============
13+
14+
* Graphviz <http://graphviz.org> (native package):
15+
* Fedora: `dnf install graphviz`
16+
* OS-X: `brew install graphviz`
17+
18+
Creating a conda environment and installing the library (tested with OSX)
19+
=========================================================================
20+
21+
macOS
22+
-----
23+
.. code-block:: bash
24+
25+
$ conda create -n pynidm_py3 python=3
26+
$ source activate pynidm_py3
27+
$ cd PyNIDM
28+
$ pip install -e .
29+
30+
You can try to run a test: `pytest`
31+
32+
NIDM-Experiment Tools
33+
=====================
34+
35+
Query
36+
-----
37+
38+
.. code-block:: bash
39+
40+
$ pynidm query [OPTIONS]
41+
42+
Options:
43+
-nl, --nidm_file_list TEXT A comma separated list of NIDM files with full
44+
path [required]
45+
-q, --query_file PATH Text file containing a SPARQL query to execute
46+
[required]
47+
-o, --output_file TEXT Optional output file (CSV) to store results of
48+
query
49+
--help Show this message and exit.
50+
51+
52+
BIDS MRI Conversion to NIDM
53+
---------------------------
54+
55+
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.
56+
57+
While we're migrating to using 'click', this tools is still buried in the tools directory of the repo
58+
59+
.. code-block:: bash
60+
61+
$ ./nidm/experiment/tools/BIDSMRI2NIDM.py -d [ROOT BIDS DIRECT] -bidsignore
62+
63+
Example 1:No variable->term mapping, simple BIDS dataset conversion which will add nidm.ttl file to BIDS dataset and .bidsignore file:
64+
65+
.. code-block:: bash
66+
67+
$ ./nidm/experiment/tools/BIDSMRI2NIDM.py -d [root directory of BIDS dataset] -o [PATH/nidm.ttl]
68+
69+
Example 2:No variable->term mapping, simple BIDS dataset conversion but storing nidm file somewhere else:
70+
71+
.. code-block:: bash
72+
73+
$ ./nidm/experiment/tools/BIDSMRI2NIDM.py -d [root directory of BIDS dataset] -ilxkey [Your Interlex key] -github [username token] -bidsignore
74+
75+
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):
76+
77+
.. code-block:: bash
78+
79+
$ ./nidm/experiment/tools/BIDSMRI2NIDM.py -d [root directory of BIDS dataset] -ilxkey [Your Interlex key] -github [username token] -owl -bidsignore
80+
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:
81+
82+
.. code-block:: bash
83+
84+
$ ./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
85+
86+
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:
87+
88+
json mapping file has entries for each variable with mappings to formal terms. Example:
89+
90+
{
91+
92+
"site": {
93+
94+
"definition": "Number assigned to site",
95+
96+
"label": "site_id (UC Provider Care)",
97+
98+
"url": "http://uri.interlex.org/NDA/uris/datadictionary/elements/2031448"
99+
100+
},
101+
102+
"gender": {
103+
104+
"definition": "ndar:gender",
105+
106+
"label": "ndar:gender",
107+
108+
"url": "https://ndar.nih.gov/api/datadictionary/v2/dataelement/gender"
109+
110+
}
111+
112+
}
113+
114+
optional arguments:
115+
-h, --help show this help message and exit
116+
117+
-d DIRECTORY Path to BIDS dataset directory
118+
119+
-jsonld, --jsonld If flag set, output is json-ld not TURTLE
120+
121+
-png, --png If flag set, tool will output PNG file of NIDM graph
122+
123+
-bidsignore, --bidsignore
124+
125+
If flag set, tool will add NIDM-related files to .bidsignore file
126+
127+
-o OUTPUTFILE Outputs turtle file called nidm.ttl in BIDS directory by default
128+
129+
map variables to terms arguments:
130+
131+
-json_map JSON_MAP, --json_map JSON_MAP
132+
133+
Optional user-suppled JSON file containing variable-term mappings.
134+
135+
-ilxkey KEY, --ilxkey KEY
136+
137+
Interlex/SciCrunch API key to use for query
138+
139+
-github [GITHUB [GITHUB ...]], --github [GITHUB [GITHUB ...]]
140+
141+
Use -github flag with list username token(or pw) for storing locally-defined terms in a
142+
nidm-local-terms repository in GitHub. If user doesn''t supply a token then user will be prompted for username/password.
143+
144+
Example: -github username token
145+
146+
-owl Optional flag to query nidm-experiment OWL files
147+
148+
CSV File to NIDM Conversion
149+
---------------------------
150+
This program will load in a CSV file and iterate over the header variable
151+
names performing an elastic search of https://scicrunch.org/ for NIDM-ReproNim
152+
tagged terms that fuzzy match the variable names. The user will then
153+
interactively pick a term to associate with the variable name. The resulting
154+
annotated CSV data will then be written to a NIDM data file.
155+
156+
While we're migrating to using 'click', this tools is still buried in the tools directory of the repo
157+
158+
.. code-block:: bash
159+
160+
$ ./nidm/experiment/tools/CSV2NIDM.py [OPTIONS]
161+
162+
optional arguments:
163+
-h, --help show this help message and exit
164+
165+
-csv CSV_FILE Path to CSV file to convert
166+
167+
-ilxkey KEY Interlex/SciCrunch API key to use for query
168+
169+
-json_map JSON_MAP User-suppled JSON file containing variable-term mappings.
170+
171+
-nidm NIDM_FILE Optional NIDM file to add CSV->NIDM converted graph to
172+
173+
-github [GITHUB [GITHUB ...]]
174+
Use -github flag with username token(or pw) for
175+
storing locally-defined terms in a "nidm-local-terms"
176+
repository in GitHub. If user doesnt supply a token
177+
then user will be prompted for username/password.
178+
Example: -github username token
179+
180+
-owl Optionally searches NIDM OWL files...internet
181+
connection required
182+
183+
-out OUTPUT_FILE Filename to save NIDM file
184+
185+
186+
.. |Build Status| image:: https://travis-ci.org/incf-nidash/PyNIDM.svg?branch=master
187+
:target: https://travis-ci.org/incf-nidash/PyNIDM
188+
:alt: Build status of the master branch
189+

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = PyNIDM
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/README.md

Whitespace-only changes.
1.39 MB
Binary file not shown.

docs/build/doctrees/index.doctree

45.9 KB
Binary file not shown.

docs/build/html/.buildinfo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 421630fdfa936e7b49e402238a485cb0
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

0 commit comments

Comments
 (0)