diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-termite-toolkit.spec | 354 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 356 insertions, 0 deletions
@@ -0,0 +1 @@ +/termite_toolkit-0.5.6.tar.gz diff --git a/python-termite-toolkit.spec b/python-termite-toolkit.spec new file mode 100644 index 0000000..74923f4 --- /dev/null +++ b/python-termite-toolkit.spec @@ -0,0 +1,354 @@ +%global _empty_manifest_terminate_build 0 +Name: python-termite-toolkit +Version: 0.5.6 +Release: 1 +Summary: scibite-toolkit - python library for calling TERMite, TExpress and other tools, and processing results +License: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License +URL: https://github.com/elsevier-health/scibite-toolkit +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/87/b8/1f98f9adc77bc6fc0c66e1af2974b289d9d49c06342aaab34f33d75d1f3b/termite_toolkit-0.5.6.tar.gz +BuildArch: noarch + +Requires: python3-requests +Requires: python3-pandas +Requires: python3-nltk + +%description +### Project Description + +scibite-toolkit - Python library for making calls to [SciBite](https://www.scibite.com/)'s TERMite, TExpress and DOCstore. +The library also enables post-processing of the JSON returned from such requests. + +## Install + +``` +$ pip3 install termite_toolkit +``` +Versions listed on [PyPi](https://pypi.org/project/termite-toolkit/)! + +## Example call to TERMite + +```python +from termite_toolkit import termite +from pprint import pprint + + +# specify termite API endpoint +termite_home = "http://localhost:9090/termite" + +# specify entities to annotate +entities = "DRUG" + +# initialise a request builder +t = termite.TermiteRequestBuilder() +# individually add items to your TERMite request +t.set_url(termite_home) +t.set_fuzzy(True) +t.set_text("citrate macrophage colony sildenafil stimulating factor influenza hedgehog") +t.set_entities(entities) +t.set_subsume(True) +t.set_input_format("txt") +t.set_output_format("doc.jsonx") +t.set_reject_ambiguous(False) +t.set_options({'fragmentSize': 20}) + +# execute the request +termite_response = t.execute(display_request=True) + +pprint(termite_response) +``` + +## Example call to TExpress + +```python +from pprint import pprint +from termite_toolkit import texpress + +# specify termite API endpoint +termite_home = "http://localhost:9090/termite" +# specify the pattern you wish to search for- this can created in the TERMite UI +pattern = ":(INDICATION):{0,5}:(GENE)" + +t = texpress.TexpressRequestBuilder() + +# individually add items to your TERMite request +t.set_url(termite_home) +t.set_text("breast cancer brca1") +t.set_subsume(True) +t.set_input_format("txt") +t.set_output_format("json") +t.set_allow_ambiguous(False) +t.set_pattern(pattern) + +# execute the request +texpress_response = t.execute(display_request=True) +pprint(texpress_response) +``` + +## Example call to DOCstore + +```python +from termite_toolkit import docstore + +# Document co-occurrence of a list of entities +docs = docstore.DocStoreRequestBuilder() +# specify docstore API endpoint and add authentication if necessary +docs.set_url('docstore_address') +docs.set_basic_auth(username='user', password='pw') +# make call to DOCStore +docs_json = docs.get_dcc_docs(['id:GENE$HTT', 'id:GENE$EGFR'], '*', {}) +# convert json to df +df = docstore.get_docstore_dcc_df(docs_json) +# print titles of hits +print(df['title']) +``` + +## License + +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. + + + +%package -n python3-termite-toolkit +Summary: scibite-toolkit - python library for calling TERMite, TExpress and other tools, and processing results +Provides: python-termite-toolkit +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-termite-toolkit +### Project Description + +scibite-toolkit - Python library for making calls to [SciBite](https://www.scibite.com/)'s TERMite, TExpress and DOCstore. +The library also enables post-processing of the JSON returned from such requests. + +## Install + +``` +$ pip3 install termite_toolkit +``` +Versions listed on [PyPi](https://pypi.org/project/termite-toolkit/)! + +## Example call to TERMite + +```python +from termite_toolkit import termite +from pprint import pprint + + +# specify termite API endpoint +termite_home = "http://localhost:9090/termite" + +# specify entities to annotate +entities = "DRUG" + +# initialise a request builder +t = termite.TermiteRequestBuilder() +# individually add items to your TERMite request +t.set_url(termite_home) +t.set_fuzzy(True) +t.set_text("citrate macrophage colony sildenafil stimulating factor influenza hedgehog") +t.set_entities(entities) +t.set_subsume(True) +t.set_input_format("txt") +t.set_output_format("doc.jsonx") +t.set_reject_ambiguous(False) +t.set_options({'fragmentSize': 20}) + +# execute the request +termite_response = t.execute(display_request=True) + +pprint(termite_response) +``` + +## Example call to TExpress + +```python +from pprint import pprint +from termite_toolkit import texpress + +# specify termite API endpoint +termite_home = "http://localhost:9090/termite" +# specify the pattern you wish to search for- this can created in the TERMite UI +pattern = ":(INDICATION):{0,5}:(GENE)" + +t = texpress.TexpressRequestBuilder() + +# individually add items to your TERMite request +t.set_url(termite_home) +t.set_text("breast cancer brca1") +t.set_subsume(True) +t.set_input_format("txt") +t.set_output_format("json") +t.set_allow_ambiguous(False) +t.set_pattern(pattern) + +# execute the request +texpress_response = t.execute(display_request=True) +pprint(texpress_response) +``` + +## Example call to DOCstore + +```python +from termite_toolkit import docstore + +# Document co-occurrence of a list of entities +docs = docstore.DocStoreRequestBuilder() +# specify docstore API endpoint and add authentication if necessary +docs.set_url('docstore_address') +docs.set_basic_auth(username='user', password='pw') +# make call to DOCStore +docs_json = docs.get_dcc_docs(['id:GENE$HTT', 'id:GENE$EGFR'], '*', {}) +# convert json to df +df = docstore.get_docstore_dcc_df(docs_json) +# print titles of hits +print(df['title']) +``` + +## License + +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. + + + +%package help +Summary: Development documents and examples for termite-toolkit +Provides: python3-termite-toolkit-doc +%description help +### Project Description + +scibite-toolkit - Python library for making calls to [SciBite](https://www.scibite.com/)'s TERMite, TExpress and DOCstore. +The library also enables post-processing of the JSON returned from such requests. + +## Install + +``` +$ pip3 install termite_toolkit +``` +Versions listed on [PyPi](https://pypi.org/project/termite-toolkit/)! + +## Example call to TERMite + +```python +from termite_toolkit import termite +from pprint import pprint + + +# specify termite API endpoint +termite_home = "http://localhost:9090/termite" + +# specify entities to annotate +entities = "DRUG" + +# initialise a request builder +t = termite.TermiteRequestBuilder() +# individually add items to your TERMite request +t.set_url(termite_home) +t.set_fuzzy(True) +t.set_text("citrate macrophage colony sildenafil stimulating factor influenza hedgehog") +t.set_entities(entities) +t.set_subsume(True) +t.set_input_format("txt") +t.set_output_format("doc.jsonx") +t.set_reject_ambiguous(False) +t.set_options({'fragmentSize': 20}) + +# execute the request +termite_response = t.execute(display_request=True) + +pprint(termite_response) +``` + +## Example call to TExpress + +```python +from pprint import pprint +from termite_toolkit import texpress + +# specify termite API endpoint +termite_home = "http://localhost:9090/termite" +# specify the pattern you wish to search for- this can created in the TERMite UI +pattern = ":(INDICATION):{0,5}:(GENE)" + +t = texpress.TexpressRequestBuilder() + +# individually add items to your TERMite request +t.set_url(termite_home) +t.set_text("breast cancer brca1") +t.set_subsume(True) +t.set_input_format("txt") +t.set_output_format("json") +t.set_allow_ambiguous(False) +t.set_pattern(pattern) + +# execute the request +texpress_response = t.execute(display_request=True) +pprint(texpress_response) +``` + +## Example call to DOCstore + +```python +from termite_toolkit import docstore + +# Document co-occurrence of a list of entities +docs = docstore.DocStoreRequestBuilder() +# specify docstore API endpoint and add authentication if necessary +docs.set_url('docstore_address') +docs.set_basic_auth(username='user', password='pw') +# make call to DOCStore +docs_json = docs.get_dcc_docs(['id:GENE$HTT', 'id:GENE$EGFR'], '*', {}) +# convert json to df +df = docstore.get_docstore_dcc_df(docs_json) +# print titles of hits +print(df['title']) +``` + +## License + +Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. + + + +%prep +%autosetup -n termite-toolkit-0.5.6 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-termite-toolkit -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.6-1 +- Package Spec generated @@ -0,0 +1 @@ +0058bcb19b9c1ecee3f1460916e1e817 termite_toolkit-0.5.6.tar.gz |
