diff --git a/neurondm/README.md b/neurondm/README.md index 5f9d0d65..1e9476d6 100644 --- a/neurondm/README.md +++ b/neurondm/README.md @@ -37,19 +37,6 @@ config.write() config.write_python() ``` -### NIF-Ontology -To work with the NIF-Ontology and build existing models -you need to clone the ontology repository and set your -SciGraph API key or set up a local SciGraph instance. - -```bash -git clone https://github.com/SciCrunch/NIF-Ontology.git -ontutils set ontology-local-repo ./NIF-Ontology -pushd ./NIF-Ontology -git checkout neurons -popd -``` - ### SciGraph API Set the API key in a separate terminal to avoid losing additional history after setting the api key. @@ -63,6 +50,19 @@ Once that is done you should be able to run the following. python -m neurondm.models.huang2017 ``` +### NIF-Ontology +To work with the NIF-Ontology and build existing models +you need to clone the ontology repository and set your +SciGraph API key or set up a local SciGraph instance. + +```bash +git clone https://github.com/SciCrunch/NIF-Ontology.git +ontutils set ontology-local-repo ./NIF-Ontology +pushd ./NIF-Ontology +git checkout neurons +popd +``` + ### Further configuration If you need more details on configuration see the pyontutils [configuration](https://github.com/tgbugs/pyontutils/#configuration) section. diff --git a/neurondm/setup.py b/neurondm/setup.py index 85c68b2e..b4197902 100644 --- a/neurondm/setup.py +++ b/neurondm/setup.py @@ -27,8 +27,6 @@ def _ontology_data_files(): 'ttl/phenotype-indicators.ttl', 'ttl/phenotypes.ttl', 'ttl/generated/part-of-self.ttl',] - respaths = ['26451489 table 1.csv', - 'common-usage-types.csv',] if RELEASE: from augpathlib import RepoPath as Path ### KILL IT WITH FIRE @@ -56,16 +54,14 @@ def _ontology_data_files(): resources = Path(resources) resources.mkdir() # if we add resources to git, this will error before we delete by accident - _resources_path = Path(auth.get_path('resources')) - paths = ([olr / rp for rp in relpaths] + - [_resources_path / rp for rp in respaths]) + paths = [olr / rp for rp in relpaths] for p in paths: p.copy_to(resources / p.name) else: from pathlib import Path resources = Path(resources) - paths = [Path(rp) for rp in relpaths + respaths] + paths = [Path(rp) for rp in relpaths] return resources.absolute(), [(resources / p.name).as_posix() for p in paths] @@ -73,7 +69,8 @@ def _ontology_data_files(): resources, ontology_data_files = _ontology_data_files() print('ontology_data_files:\n\t' + '\n\t'.join(ontology_data_files)) -tests_require = ['pytest'] +models_require = ['nifstd-tools>=0.0.6'] +tests_require = ['pytest'] + models_require try: setup( name='neurondm', @@ -104,6 +101,7 @@ def _ontology_data_files(): ], extras_require={'dev': ['pytest-cov', 'wheel'], 'test': tests_require, + 'models': models_require, 'notebook': ['jupyter'], }, entry_points={ diff --git a/nifstd/MANIFEST.in b/nifstd/MANIFEST.in index 5daa1c30..5567049b 100644 --- a/nifstd/MANIFEST.in +++ b/nifstd/MANIFEST.in @@ -13,7 +13,19 @@ recursive-exclude scigraph * recursive-exclude * *.pyc recursive-exclude * *.swp recursive-exclude * *.swo +recursive-exclude * *.rpm recursive-include resources *.confd recursive-include resources *.rc +recursive-include resources *.socket +recursive-include resources *.service +recursive-include resources *.spec recursive-include resources *.el +recursive-include resources *.yaml recursive-include resources/sparc_term_versions * +include resources/ontree.tmp +include resources/neuron_phenotype.csv +include resources/26451489* +include resources/neuron_phenotype.csv +include resources/common-usage-types.csv +include resources/neuron_phenotype_edges.csv +recursive-exclude resources/rpmbuild/BUILD * \ No newline at end of file diff --git a/nifstd/resources/nifstd-tools.spec b/nifstd/resources/nifstd-tools.spec new file mode 100644 index 00000000..c9f27747 --- /dev/null +++ b/nifstd/resources/nifstd-tools.spec @@ -0,0 +1,91 @@ +# you must build this with --nodeps if you are not on a RHEL alike +%define _unitdir /lib/systemd/system +%define _etcdir /etc/systemd/system + +# building on gentoo makes this /var/lib for some reason :/ +%define _localstatedir /var + +%define nt_user nifstd-tools +%define nt_group %{nifstd-tools} +%define nt_home %{_localstatedir}/lib/nifstd-tools +%define nt_log %{_localstatedir}/log/nifstd-tools + +%define name nifstd-tools +%define version 9999 +Name: %{name} +Version: %{version} +Release: 0 +Summary: utilities for working with the NIF ontology +License: MIT +Url: https://github.com/tgbugs/pyontutils/tree/nifstd +BuildArch: noarch +BuildRequires: systemd +BuildRequires: git +Requires: gcc +Requires: bash +Requires: nginx +Requires: python3 +Requires: python3-devel +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +Source1: ontree.socket +Source2: ontree.service +Source3: ontree.confd +Source4: ontree.tmp + +%description +curation workflow automation and coordination + +%prep + +if [[ ! -d %{buildroot} ]]; then + mkdir %{buildroot}; +fi + +%define gitroot pyontutils +if [[ ! -d %{gitroot} ]]; then + git clone https://github.com/tgbugs/pyontutils.git +fi + +%build +#pushd %{gitroot} +#python3 setup.py bdist_wheel +#%py3_build + +%install +install -p -D -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}/ontree.socket +install -p -D -m 644 %{SOURCE2} %{buildroot}/%{_unitdir}/ontree.service +install -p -D -m 600 %{SOURCE3} %{buildroot}/%{_etcdir}/ontree.service.d/env.conf +install -p -D -m 644 %{SOURCE4} %{buildroot}/etc/tmpfiles.d/ontree.conf +#%py3_install + +%pre +getent group %{nt_group} > /dev/null || groupadd -r %{nt_group} +getent passwd %{nt_user} > /dev/null || \ + useradd -r -m -d %{nt_home} -g %{nt_group} \ + -s /bin/bash -c "nifstd-tools services" %{nt_user} +if [[ ! -d %{ontree_log} ]]; then + mkdir %{ontree_log} # owner? + chown %{nt_user}:%{nt_group} %{ontree_log} +fi + +%post +systemd-tmpfiles --create +systemctl enable ontree +#systemctl enable nginx + +%clean +rm -rf %{buildroot} + +%files +%{_unitdir}/ontree.socket +%{_unitdir}/ontree.service +%{_etcdir}/ontree.service.d/env.conf +/etc/tmpfiles.d/ontree.conf +#/etc/nginx/nginx.conf +#/etc/nginx/scibot.conf + +%changelog +# skip this for now diff --git a/nifstd/resources/rpmbuild/SOURCES/ontree.confd b/nifstd/resources/rpmbuild/SOURCES/ontree.confd new file mode 120000 index 00000000..b4ad3264 --- /dev/null +++ b/nifstd/resources/rpmbuild/SOURCES/ontree.confd @@ -0,0 +1 @@ +../../ontree.confd \ No newline at end of file diff --git a/nifstd/resources/rpmbuild/SOURCES/ontree.service b/nifstd/resources/rpmbuild/SOURCES/ontree.service new file mode 120000 index 00000000..f42d6ea2 --- /dev/null +++ b/nifstd/resources/rpmbuild/SOURCES/ontree.service @@ -0,0 +1 @@ +../../ontree.service \ No newline at end of file diff --git a/nifstd/resources/rpmbuild/SOURCES/ontree.socket b/nifstd/resources/rpmbuild/SOURCES/ontree.socket new file mode 120000 index 00000000..aca1ffba --- /dev/null +++ b/nifstd/resources/rpmbuild/SOURCES/ontree.socket @@ -0,0 +1 @@ +../../ontree.socket \ No newline at end of file diff --git a/nifstd/resources/rpmbuild/SOURCES/ontree.tmp b/nifstd/resources/rpmbuild/SOURCES/ontree.tmp new file mode 120000 index 00000000..8af74a2d --- /dev/null +++ b/nifstd/resources/rpmbuild/SOURCES/ontree.tmp @@ -0,0 +1 @@ +../../ontree.tmp \ No newline at end of file diff --git a/nifstd/resources/rpmbuild/SPECS/nifstd-tools.spec b/nifstd/resources/rpmbuild/SPECS/nifstd-tools.spec deleted file mode 100644 index c9f27747..00000000 --- a/nifstd/resources/rpmbuild/SPECS/nifstd-tools.spec +++ /dev/null @@ -1,91 +0,0 @@ -# you must build this with --nodeps if you are not on a RHEL alike -%define _unitdir /lib/systemd/system -%define _etcdir /etc/systemd/system - -# building on gentoo makes this /var/lib for some reason :/ -%define _localstatedir /var - -%define nt_user nifstd-tools -%define nt_group %{nifstd-tools} -%define nt_home %{_localstatedir}/lib/nifstd-tools -%define nt_log %{_localstatedir}/log/nifstd-tools - -%define name nifstd-tools -%define version 9999 -Name: %{name} -Version: %{version} -Release: 0 -Summary: utilities for working with the NIF ontology -License: MIT -Url: https://github.com/tgbugs/pyontutils/tree/nifstd -BuildArch: noarch -BuildRequires: systemd -BuildRequires: git -Requires: gcc -Requires: bash -Requires: nginx -Requires: python3 -Requires: python3-devel -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd - -Source1: ontree.socket -Source2: ontree.service -Source3: ontree.confd -Source4: ontree.tmp - -%description -curation workflow automation and coordination - -%prep - -if [[ ! -d %{buildroot} ]]; then - mkdir %{buildroot}; -fi - -%define gitroot pyontutils -if [[ ! -d %{gitroot} ]]; then - git clone https://github.com/tgbugs/pyontutils.git -fi - -%build -#pushd %{gitroot} -#python3 setup.py bdist_wheel -#%py3_build - -%install -install -p -D -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}/ontree.socket -install -p -D -m 644 %{SOURCE2} %{buildroot}/%{_unitdir}/ontree.service -install -p -D -m 600 %{SOURCE3} %{buildroot}/%{_etcdir}/ontree.service.d/env.conf -install -p -D -m 644 %{SOURCE4} %{buildroot}/etc/tmpfiles.d/ontree.conf -#%py3_install - -%pre -getent group %{nt_group} > /dev/null || groupadd -r %{nt_group} -getent passwd %{nt_user} > /dev/null || \ - useradd -r -m -d %{nt_home} -g %{nt_group} \ - -s /bin/bash -c "nifstd-tools services" %{nt_user} -if [[ ! -d %{ontree_log} ]]; then - mkdir %{ontree_log} # owner? - chown %{nt_user}:%{nt_group} %{ontree_log} -fi - -%post -systemd-tmpfiles --create -systemctl enable ontree -#systemctl enable nginx - -%clean -rm -rf %{buildroot} - -%files -%{_unitdir}/ontree.socket -%{_unitdir}/ontree.service -%{_etcdir}/ontree.service.d/env.conf -/etc/tmpfiles.d/ontree.conf -#/etc/nginx/nginx.conf -#/etc/nginx/scibot.conf - -%changelog -# skip this for now diff --git a/nifstd/resources/rpmbuild/SPECS/nifstd-tools.spec b/nifstd/resources/rpmbuild/SPECS/nifstd-tools.spec new file mode 120000 index 00000000..1af6a3f0 --- /dev/null +++ b/nifstd/resources/rpmbuild/SPECS/nifstd-tools.spec @@ -0,0 +1 @@ +../../nifstd-tools.spec \ No newline at end of file diff --git a/nifstd/setup.py b/nifstd/setup.py index 00e37b32..3c88d434 100644 --- a/nifstd/setup.py +++ b/nifstd/setup.py @@ -1,4 +1,5 @@ import re +from pathlib import Path from setuptools import setup @@ -46,7 +47,7 @@ def find_version(filename): 'networkx', 'psutil', 'pymysql', - 'pyontutils>=0.1.25', + 'pyontutils>=0.1.26', 'sqlalchemy', ], extras_require={'dev': ['mysql-connector', @@ -67,5 +68,8 @@ def find_version(filename): ], }, data_files=[('share/nifstd/resources/sparc_term_versions/', - ['resources/sparc_term_versions/sparc_terms2-mod.txt'])] -) + ['resources/sparc_term_versions/sparc_terms2-mod.txt']), + ('share/nifstd/resources/', + [p.as_posix() for p in Path('resources').iterdir() + if p.is_file() and p.suffix[1:] not in + ('confd', 'rc', 'service', 'socket', 'tmp', 'spec')],)])