py-semtools 1.2.1__tar.gz → 1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {py_semtools-1.2.1 → py_semtools-1.3}/.gitignore +5 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/PKG-INFO +7 -2
- {py_semtools-1.2.1 → py_semtools-1.3}/setup.cfg +7 -1
- py_semtools-1.3/src/py_semtools/__init__.py +12 -0
- py_semtools-1.3/src/py_semtools/cli_manager.py +370 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/src/py_semtools/external_data/ontologies.txt +3 -1
- py_semtools-1.3/src/py_semtools/indexers/text_indexer.py +236 -0
- py_semtools-1.3/src/py_semtools/main_modules.py +841 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/src/py_semtools/ontology.py +392 -168
- py_semtools-1.3/src/py_semtools/parallelizer.py +124 -0
- {py_semtools-1.2.1/src/py_semtools → py_semtools-1.3/src/py_semtools/parsers/ont}/file_parser.py +2 -2
- {py_semtools-1.2.1/src/py_semtools → py_semtools-1.3/src/py_semtools/parsers/ont}/json_parser.py +1 -1
- {py_semtools-1.2.1/src/py_semtools → py_semtools-1.3/src/py_semtools/parsers/ont}/oboparser.py +74 -40
- py_semtools-1.3/src/py_semtools/parsers/text/text_basic_parser.py +77 -0
- py_semtools-1.3/src/py_semtools/parsers/text/text_pubmed_abstract_parser.py +64 -0
- py_semtools-1.3/src/py_semtools/parsers/text/text_pubmed_paper_parser.py +82 -0
- py_semtools-1.3/src/py_semtools/parsers/text/text_pubmed_parser.py +44 -0
- py_semtools-1.3/src/py_semtools/report_ont.py +268 -0
- py_semtools-1.3/src/py_semtools/sim_handler.py +172 -0
- py_semtools-1.3/src/py_semtools/stEngine.py +362 -0
- py_semtools-1.3/src/py_semtools/templates/comorb_sugg.txt +64 -0
- py_semtools-1.3/src/py_semtools/templates/makeTermFreqTable.txt +4 -0
- py_semtools-1.3/src/py_semtools/templates/ontoICdist.txt +8 -0
- py_semtools-1.3/src/py_semtools/templates/ontodist.txt +10 -0
- py_semtools-1.3/src/py_semtools/templates/ontoplot.txt +171 -0
- py_semtools-1.3/src/py_semtools/templates/plotClust.txt +10 -0
- py_semtools-1.3/src/py_semtools/templates/plotProfRed.txt +6 -0
- py_semtools-1.3/src/py_semtools/templates/report.txt +37 -0
- py_semtools-1.3/src/py_semtools/templates/similarity_heatmap.txt +1 -0
- py_semtools-1.3/src/py_semtools/templates/similarity_matrix.txt +9 -0
- py_semtools-1.3/src/py_semtools/templates/stEngine.txt +73 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/src/py_semtools.egg-info/PKG-INFO +7 -2
- py_semtools-1.3/src/py_semtools.egg-info/SOURCES.txt +164 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/src/py_semtools.egg-info/entry_points.txt +3 -1
- {py_semtools-1.2.1 → py_semtools-1.3}/src/py_semtools.egg-info/requires.txt +4 -0
- py_semtools-1.3/tests/cli_examples/Report.html +528 -0
- py_semtools-1.3/tests/cli_examples/example +2 -0
- py_semtools-1.3/tests/cli_examples/launch.sh +12 -0
- py_semtools-1.3/tests/cli_examples/template.txt +119 -0
- py_semtools-1.3/tests/data/branched.obo +37 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/enrichment_ontology3.obo +1 -0
- py_semtools-1.3/tests/data/get_sorted_profs/report.html +7218 -0
- py_semtools-1.3/tests/data/get_sorted_profs/report.txt +20 -0
- py_semtools-1.3/tests/data/hierarchical_alt_chain.obo +55 -0
- py_semtools-1.3/tests/data/only_header_sample.obo +2 -0
- py_semtools-1.3/tests/data/ref_output_scripts/terms_attr +5 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/abstracts/chunk1/22981088 +0 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/abstracts/chunk1/22981089 +1 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/abstracts/chunk1/22981091 +7 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/abstracts/chunk1/22981092 +7 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/abstracts/chunk1/None +3 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/abstracts/single_abs_text +7 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/papers/chunk1/18382669 +91 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/papers/chunk1/31356151 +251 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/papers/chunk1/35042469 +97 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/papers/chunk1/38108203 +0 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/papers/chunk1/None +73 -0
- py_semtools-1.3/tests/data/stEngine/expected/raw_indexes/papers/single_pap_text +195 -0
- py_semtools-1.3/tests/data/stEngine/expected/ready_indexes/abstracts/single_abs_index_nonsplit +7 -0
- py_semtools-1.3/tests/data/stEngine/expected/ready_indexes/abstracts/single_abs_index_split +1 -0
- py_semtools-1.3/tests/data/stEngine/expected/ready_indexes/papers/single_pap_index_nonsplit +195 -0
- py_semtools-1.3/tests/data/stEngine/expected/ready_indexes/papers/single_pap_index_split +1 -0
- py_semtools-1.3/tests/data/stEngine/inputs/abstracts/abs_chunk1.xml.gz +0 -0
- py_semtools-1.3/tests/data/stEngine/inputs/abstracts/abs_chunk2.xml.gz +0 -0
- py_semtools-1.3/tests/data/stEngine/inputs/abstracts/single_abstract.xml +172 -0
- py_semtools-1.3/tests/data/stEngine/inputs/abstracts/single_abstract.xml.gz +0 -0
- py_semtools-1.3/tests/data/stEngine/inputs/blacklisted_words1.txt +1 -0
- py_semtools-1.3/tests/data/stEngine/inputs/blacklisted_words2.txt +1 -0
- py_semtools-1.3/tests/data/stEngine/inputs/blacklisted_words3.txt +3 -0
- py_semtools-1.3/tests/data/stEngine/inputs/example.xml +1 -0
- py_semtools-1.3/tests/data/stEngine/inputs/example_zipped.xml.gz +0 -0
- py_semtools-1.3/tests/data/stEngine/inputs/papers/pap_chunk1.tar.gz +0 -0
- py_semtools-1.3/tests/data/stEngine/inputs/papers/pap_chunk2.tar.gz +0 -0
- py_semtools-1.3/tests/data/stEngine/inputs/papers/single_paper.tar.gz +0 -0
- py_semtools-1.3/tests/data/stEngine/inputs/papers/single_paper.xml +343 -0
- py_semtools-1.3/tests/data/stEngine/inputs/prepared_indexes/abstracts/example1.txt.gz +0 -0
- py_semtools-1.3/tests/data/stEngine/inputs/prepared_indexes/queries/hpo_list +3 -0
- py_semtools-1.3/tests/data/stEngine/inputs/prepared_indexes/queries/mondo_list +3 -0
- py_semtools-1.3/tests/data/st_engine_report/abs_profiles.txt +70 -0
- py_semtools-1.3/tests/data/st_engine_report/pmids_and_titles.txt +70 -0
- py_semtools-1.3/tests/demo_examples/data/profiles.txt +20 -0
- py_semtools-1.3/tests/demo_examples/data/ref_profile.txt +6 -0
- py_semtools-1.3/tests/demo_examples/launch.sh +12 -0
- py_semtools-1.3/tests/demo_examples/launch_plots.py +56 -0
- py_semtools-1.3/tests/demo_examples/profiles_freqs.html +9334 -0
- py_semtools-1.3/tests/demo_examples/template.txt +127 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/test_cli_manager.py +128 -29
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/test_oboparser.py +66 -49
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/test_ontology.py +228 -9
- py_semtools-1.3/tests/test_pubmed_abs_parser.py +78 -0
- py_semtools-1.3/tests/test_pubmed_pap_parser.py +76 -0
- py_semtools-1.3/tests/test_pubmed_text_parser.py +161 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/test_similitudes.py +4 -5
- py_semtools-1.3/tests/test_stengine.py +162 -0
- py_semtools-1.3/tests/test_text_indexer.py +254 -0
- py_semtools-1.2.1/src/py_semtools/__init__.py +0 -5
- py_semtools-1.2.1/src/py_semtools/cli_manager.py +0 -1355
- py_semtools-1.2.1/src/py_semtools/sim_handler.py +0 -90
- py_semtools-1.2.1/src/py_semtools/templates/ontoplot.txt +0 -37
- py_semtools-1.2.1/src/py_semtools.egg-info/SOURCES.txt +0 -92
- py_semtools-1.2.1/tests/data/only_header_sample.obo +0 -2
- py_semtools-1.2.1/tests/data/ref_output_scripts/terms_attr +0 -5
- {py_semtools-1.2.1 → py_semtools-1.3}/.coveragerc +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/.readthedocs.yml +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/AUTHORS.rst +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/CHANGELOG.rst +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/CONTRIBUTING.rst +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/LICENSE.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/MANIFEST.in +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/README.md +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/README.rst +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/docs/Makefile +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/docs/_static/.gitignore +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/docs/authors.rst +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/docs/changelog.rst +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/docs/conf.py +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/docs/contributing.rst +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/docs/index.rst +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/docs/license.rst +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/docs/readme.rst +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/docs/requirements.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/pyproject.toml +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/setup.py +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/src/py_semtools.egg-info/dependency_links.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/src/py_semtools.egg-info/not-zip-safe +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/src/py_semtools.egg-info/top_level.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/__init__.py +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/conftest.py +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/circular_sample.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/enrichment_ontology.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/enrichment_ontology2.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/get_sorted_suggestions/expected/filter_query_parentals.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/get_sorted_suggestions/expected/filter_target_and_query_parentals.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/get_sorted_suggestions/expected/filter_target_parentals.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/get_sorted_suggestions/expected/no_filter_limit_2.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/get_sorted_suggestions/expected/no_filter_no_limit.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/get_sorted_suggestions/input_data/enrichment_ontology3.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/get_sorted_suggestions/input_data/query_hps.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/get_sorted_suggestions/input_data/relations.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/go-basic_sample.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/go-onlyOne.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/hierarchical_compressed.obo.gz +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/hierarchical_sample.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/input_scripts/profiles +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/input_scripts/profiles_2cols +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/input_scripts/profiles_with_removedTerms +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/input_scripts/string_values +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/input_scripts/terms +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/input_scripts/terms_for_xref +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/input_scripts/terms_list +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/partial_go.json +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/partial_go.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/blacklisted.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/cleaned_profiles +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/cleaned_profiles_2cols +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/expanded_profiles +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/expected_IC_ont +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/parental_from_terms +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/profile_stats +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/profiles_IC_onto_freq +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/strsimnet +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/strsimnet_cutoff2 +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/translated_profiles_names +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/translated_terms_codes +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/white_and_blacklisted.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/ref_output_scripts/whitelisted.txt +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/short_hierarchical_sample.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/sparse2_sample.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/data/sparse_sample.obo +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/test_go.py +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tests/test_jsonparser.py +0 -0
- {py_semtools-1.2.1 → py_semtools-1.3}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: py_semtools
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3
|
|
4
4
|
Summary: Library to handle ontologies that allows queries and calculations such as information coefficients, semantic similarity, ontology representations, etc in a easy way. It can load any ontology that complies the obo format supported by OBO Foundry.
|
|
5
5
|
Home-page: https://github.com/seoanezonjic/py_semtools
|
|
6
6
|
Author: seoanezonjic
|
|
@@ -19,14 +19,19 @@ Requires-Dist: networkx
|
|
|
19
19
|
Requires-Dist: entrezpy
|
|
20
20
|
Requires-Dist: scipy
|
|
21
21
|
Requires-Dist: sentence_transformers
|
|
22
|
+
Requires-Dist: langchain
|
|
23
|
+
Requires-Dist: pynvml
|
|
22
24
|
Requires-Dist: requests
|
|
23
25
|
Requires-Dist: py_exp_calc
|
|
24
26
|
Requires-Dist: py_cmdtabs
|
|
25
27
|
Requires-Dist: py_report_html
|
|
28
|
+
Requires-Dist: loguru
|
|
29
|
+
Requires-Dist: loky
|
|
26
30
|
Provides-Extra: testing
|
|
27
31
|
Requires-Dist: setuptools; extra == "testing"
|
|
28
32
|
Requires-Dist: pytest; extra == "testing"
|
|
29
33
|
Requires-Dist: pytest-cov; extra == "testing"
|
|
34
|
+
Dynamic: license-file
|
|
30
35
|
|
|
31
36
|
.. These are examples of badges you might want to add to your README:
|
|
32
37
|
please update the URLs accordingly
|
|
@@ -29,10 +29,14 @@ install_requires =
|
|
|
29
29
|
entrezpy
|
|
30
30
|
scipy
|
|
31
31
|
sentence_transformers
|
|
32
|
+
langchain
|
|
33
|
+
pynvml
|
|
32
34
|
requests
|
|
33
35
|
py_exp_calc
|
|
34
36
|
py_cmdtabs
|
|
35
37
|
py_report_html
|
|
38
|
+
loguru
|
|
39
|
+
loky
|
|
36
40
|
|
|
37
41
|
[options.packages.find]
|
|
38
42
|
where = src
|
|
@@ -56,9 +60,11 @@ console_scripts =
|
|
|
56
60
|
semtools = py_semtools.cli_manager:semtools
|
|
57
61
|
strsimnet = py_semtools.cli_manager:strsimnet
|
|
58
62
|
get_sorted_suggestions = py_semtools.cli_manager:get_sorted_suggestions
|
|
63
|
+
get_sorted_profs = py_semtools.cli_manager:get_sorted_profs
|
|
59
64
|
remote_retriever = py_semtools.cli_manager:remote_retriever
|
|
60
65
|
stEngine = py_semtools.cli_manager:stEngine
|
|
61
|
-
|
|
66
|
+
stEngine_report = py_semtools.cli_manager:stEngine_report
|
|
67
|
+
get_corpus_index = py_semtools.cli_manager:get_corpus_index
|
|
62
68
|
|
|
63
69
|
[tool:pytest]
|
|
64
70
|
addopts =
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from py_semtools.parsers.ont.file_parser import FileParser
|
|
2
|
+
from py_semtools.parsers.ont.oboparser import OboParser
|
|
3
|
+
from py_semtools.parsers.ont.json_parser import JsonParser
|
|
4
|
+
from py_semtools.ontology import Ontology
|
|
5
|
+
from py_semtools.indexers.text_indexer import TextIndexer
|
|
6
|
+
from py_semtools.parsers.text.text_basic_parser import TextBasicParser
|
|
7
|
+
from py_semtools.parsers.text.text_pubmed_parser import TextPubmedParser
|
|
8
|
+
from py_semtools.parsers.text.text_pubmed_abstract_parser import TextPubmedAbstractParser
|
|
9
|
+
from py_semtools.parsers.text.text_pubmed_paper_parser import TextPubmedPaperParser
|
|
10
|
+
from py_semtools.stEngine import STengine
|
|
11
|
+
from py_semtools.cli_manager import *
|
|
12
|
+
from py_semtools.parallelizer import Parallelizer
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import argparse, re, sys, inspect
|
|
2
|
+
from py_semtools.main_modules import *
|
|
3
|
+
|
|
4
|
+
###########################################################################
|
|
5
|
+
## TYPES
|
|
6
|
+
###########################################################################
|
|
7
|
+
|
|
8
|
+
def one_column_file(file): return [line.strip() for line in open(file).readlines()]
|
|
9
|
+
|
|
10
|
+
def text_list(string): return string.split(',')
|
|
11
|
+
|
|
12
|
+
def filter_regex(string):
|
|
13
|
+
filters = []
|
|
14
|
+
pattern = re.compile(r"([pn])\(([A-Za-z:0-9,]*)\)")
|
|
15
|
+
for match in pattern.finditer(string):
|
|
16
|
+
operation, string_ids = match.groups()
|
|
17
|
+
filters.append([operation, string_ids.split(',')])
|
|
18
|
+
return filters
|
|
19
|
+
|
|
20
|
+
def childs(string):
|
|
21
|
+
if '/' in string:
|
|
22
|
+
modifiers, terms = string.split('/')
|
|
23
|
+
else:
|
|
24
|
+
modifiers = ''
|
|
25
|
+
terms = string
|
|
26
|
+
terms = terms.split(',')
|
|
27
|
+
return [terms, modifiers]
|
|
28
|
+
|
|
29
|
+
def split_keyword_and_fields(string):
|
|
30
|
+
keyword, fields = string.split('|')
|
|
31
|
+
fields = fields.split(',')
|
|
32
|
+
return [keyword, fields]
|
|
33
|
+
|
|
34
|
+
def split_column_numbers(string):
|
|
35
|
+
return [int(number) for number in string.split(",")]
|
|
36
|
+
|
|
37
|
+
#########################################################################
|
|
38
|
+
#CLI PARSERS
|
|
39
|
+
#########################################################################
|
|
40
|
+
def strsimnet(args = None):
|
|
41
|
+
if args == None: args = sys.argv[1:]
|
|
42
|
+
parser = argparse.ArgumentParser(description='Perform text similarity analysis')
|
|
43
|
+
parser.add_argument("-i", "--input_file", dest="input_file", default= None,
|
|
44
|
+
help="Input OMIM diseases file.")
|
|
45
|
+
parser.add_argument("-s", "--split_char", dest="split_char", default="\t",
|
|
46
|
+
help="Character for splitting input file. Default: tab.")
|
|
47
|
+
parser.add_argument("-c", "--columns", dest="cindex", default=[0], type=split_column_numbers,
|
|
48
|
+
help="Column(s) index(es) wich contains texts to be compared. If two columns are defined (e.g. 0,1), only items from column 0 vs 1 are compared. Default: 0.")
|
|
49
|
+
parser.add_argument("-C", "--filter_column", dest="findex", default=-1, type=int,
|
|
50
|
+
help="[OPTIONAL] Column index wich contains to be used as filters. Default: -1.")
|
|
51
|
+
parser.add_argument("-f", "--filter_value", dest="filter_value", default=None,
|
|
52
|
+
help="[OPTIONAL] Value to be used as filter.")
|
|
53
|
+
parser.add_argument("-r", "--remove_chars", dest="rm_char", default="",
|
|
54
|
+
help="Chars to be excluded from comparissons.")
|
|
55
|
+
parser.add_argument("-o", "--output_file", dest="output_file", default= None,
|
|
56
|
+
help="Output similitudes file.")
|
|
57
|
+
parser.add_argument("--sim_algorithm", dest="sim_algorithm", default= 'white',
|
|
58
|
+
help="Similarity algorithm")
|
|
59
|
+
|
|
60
|
+
opts = parser.parse_args(args)
|
|
61
|
+
main_strsimnet(opts)
|
|
62
|
+
|
|
63
|
+
def remote_retriever(args = None):
|
|
64
|
+
if args == None: args = sys.argv[1:]
|
|
65
|
+
parser = argparse.ArgumentParser(description='Retrieve data in remote server by keywords')
|
|
66
|
+
parser.add_argument("-i", "--input_file", dest="input_file", default= None,
|
|
67
|
+
help="Input file with keywords (one column with an ID, a second one with the keyword and last optional column with alternatives strings separated by ','')")
|
|
68
|
+
parser.add_argument("-s", "--source", dest="source", default= None,
|
|
69
|
+
help="Remote search engine source to perform search. options: pubmed ")
|
|
70
|
+
parser.add_argument("-o", "--output_file", dest="output_file", default= None,
|
|
71
|
+
help="Output matches by keyword file.")
|
|
72
|
+
opts = parser.parse_args(args)
|
|
73
|
+
main_remote_retriever(opts)
|
|
74
|
+
|
|
75
|
+
def semtools(args = None):
|
|
76
|
+
if args is None:
|
|
77
|
+
args = sys.argv[1:]
|
|
78
|
+
|
|
79
|
+
parser = argparse.ArgumentParser(description='Perform Ontology driven analysis ')
|
|
80
|
+
parser.add_argument("--return_all_terms_with_user_defined_attributes", dest="return_all_terms_with_user_defined_attributes", default=None,
|
|
81
|
+
help="Returns a table with all the terms in the ontology with the desired fields given by user in CSV style, like: 'id,name,xref'", type=text_list)
|
|
82
|
+
parser.add_argument('-p', "--processes", dest="processes", default=2, type=int,
|
|
83
|
+
help="Number of processes to parallelize calculations. Applied to: semantic similarity.")
|
|
84
|
+
parser.add_argument("-d", "--download", dest="download", default=None,
|
|
85
|
+
help="Download obo file from an official resource. MONDO, GO, HPO, EFO, DO, CL and UBERON are possible values. Use 'all' to download all. Use 'list' to list available ontologies.")
|
|
86
|
+
parser.add_argument("-i", "--input_file", dest="input_file", default=None,
|
|
87
|
+
help="Filepath of profile data")
|
|
88
|
+
parser.add_argument("--load_hard_cleaned_profiles", dest="load_hard_cleaned_profiles", default=False, action='store_true',
|
|
89
|
+
help="When loading profiles for similarities calculation or other purposes, set if you want to perform a hard cleaning of the profiles or not (default: False)")
|
|
90
|
+
parser.add_argument("-o", "--output_file", dest="output_file", default=None,
|
|
91
|
+
help="Output filepath")
|
|
92
|
+
parser.add_argument("-I", "--IC", dest="ic", default=None,
|
|
93
|
+
help="Get the information content (IC) values: 'prof' for stored profiles or 'ont' for terms in ontology")
|
|
94
|
+
parser.add_argument("-O", "--ontology_file", dest="ontology_file", default= None,
|
|
95
|
+
help="Path to ontology file")
|
|
96
|
+
parser.add_argument("-T", "--term_filter", dest="term_filter", default= None,
|
|
97
|
+
help="If specified, only terms that are descendants of the specified term will be kept on a profile when cleaned")
|
|
98
|
+
parser.add_argument("-t", "--translate", dest="translate", default= None,
|
|
99
|
+
help="Translate to 'names' or to 'codes'")
|
|
100
|
+
parser.add_argument("-s", "--similarity_method", dest="similarity", default= None,
|
|
101
|
+
help="Calculate similarity between profile IDs computed by 'resnik', 'lin' or 'jiang_conrath' methods.")
|
|
102
|
+
parser.add_argument("--reference_profiles", dest="reference_profiles", default= None,
|
|
103
|
+
help="Path to file tabulated file with first column as id profile and second column with ontology terms separated by separator.")
|
|
104
|
+
parser.add_argument('-c', "--clean_profiles", dest="clean_profiles", default= False, action='store_true',
|
|
105
|
+
help="Removes ancestors, descendants and obsolete terms from profiles.")
|
|
106
|
+
parser.add_argument('-r', "--removed_path", dest="removed_path", default= 'rejected_profs',
|
|
107
|
+
help="Desired path to write removed profiles file.")
|
|
108
|
+
parser.add_argument('-u', "--untranslated_path", dest="untranslated_path", default= None,
|
|
109
|
+
help="Desired path to write untranslated profiles file.")
|
|
110
|
+
parser.add_argument('-k', "--keyword", dest="keyword", default= None,
|
|
111
|
+
help="regex used to get xref terms in the ontology file.")
|
|
112
|
+
parser.add_argument('-e', "--expand_profiles", dest="expand_profiles", default= None,
|
|
113
|
+
help="Expand profiles adding ancestors if 'parental', adding new profiles if 'propagate'.")
|
|
114
|
+
parser.add_argument('-U', "--unwanted_terms", dest="unwanted_terms", default= [], type=text_list,
|
|
115
|
+
help="Comma separated terms not wanted to be included in profile expansion.")
|
|
116
|
+
parser.add_argument('-S', "--separator", dest="separator", default= ';',
|
|
117
|
+
help="Separator used for the terms profile.")
|
|
118
|
+
parser.add_argument('-E', "--external_separator", dest="external_separator", default= None,
|
|
119
|
+
help="External separator used for the terms profile.")
|
|
120
|
+
parser.add_argument('-n', "--statistics", dest="statistics", default= False, action='store_true',
|
|
121
|
+
help="To obtain main statistical descriptors of the profiles file.")
|
|
122
|
+
parser.add_argument('-l', "--list_translate", dest="list_translate", default= None,
|
|
123
|
+
help="Translate to 'names' or to 'codes' input list.")
|
|
124
|
+
parser.add_argument('-F', "--filter_list", dest="filter_list", default= None, type=filter_regex,
|
|
125
|
+
help="Take a term list and filter given a expresion that indicates which terms keep based on the defined parentals. Expresion: p(id:1,id:2)n(id:3,id:4), p for white list and n for blacklist")
|
|
126
|
+
parser.add_argument('-q', "--query_ncbi", dest="query_ncbi", default= None,
|
|
127
|
+
help="Get specified item for each term in loaded ontology.")
|
|
128
|
+
parser.add_argument('-f', "--subject_column", dest="subject_column", default= 0, type=int,
|
|
129
|
+
help="The number of the column for the subject id.")
|
|
130
|
+
parser.add_argument('-a', "--annotations_column", dest="annotations_column", default= 1, type=int,
|
|
131
|
+
help="The number of the column for the annotation ids.")
|
|
132
|
+
parser.add_argument("--list_term_attributes", dest="list_term_attributes", default= False, action='store_true',
|
|
133
|
+
help="Set to give a list of term attributes: term, translation, level and synonymns, for all terms of an ontology.")
|
|
134
|
+
parser.add_argument('-R', "--root", dest="root", default= None,
|
|
135
|
+
help="Term id to be considered the new root of the ontology.")
|
|
136
|
+
parser.add_argument("--xref_sense", dest="xref_sense", default= 'byValue', action='store_const', const='byTerm',
|
|
137
|
+
help="Ontology-xref or xref-ontology. By default xref-ontology if set, ontology-xref")
|
|
138
|
+
parser.add_argument('-C', "--childs", dest="childs", default= [[], ''], type=childs,
|
|
139
|
+
help="Term code list (comma separated) to generate child list")
|
|
140
|
+
parser.add_argument("--keyword_search", dest="keyword_search", default= None, type=split_keyword_and_fields,
|
|
141
|
+
help="Retrieve HP codes that match a regex against the given keyword in one of the specified term attribute fields")
|
|
142
|
+
parser.add_argument("--translate_keyword_search", dest="translate_keyword_search", default= False, action='store_true',
|
|
143
|
+
help="Print the matches from --keyword_seach as terms names instead of codes")
|
|
144
|
+
parser.add_argument("--list", dest="simple_list", default= False, action='store_true',
|
|
145
|
+
help="Input file is a simple list with one term/word/code per line. Use to get a dictionaire with -k of filtered list with -F.")
|
|
146
|
+
parser.add_argument("--2cols", dest="2cols", default= False, action='store_true',
|
|
147
|
+
help="Input file is a two column table, first is an id and the second is a simgle ontology term.")
|
|
148
|
+
parser.add_argument("--out2cols", dest="out2cols", default= False, action='store_true',
|
|
149
|
+
help="Output file will be a two column table")
|
|
150
|
+
parser.add_argument("--profiles_self_similarities", dest="profiles_self_similarities", default= None,
|
|
151
|
+
help="Use to get the self-similarities of the profiles in the input file (resnik', 'lin' or 'jiang_conrath)")
|
|
152
|
+
parser.add_argument("--profiles_self_similarities_output", dest="profiles_self_similarities_output", default= 'profiles_self_similarities.txt',
|
|
153
|
+
help="Use to save the self-similarities of the profiles in the input file (of --profiles_self_similarities) to a file")
|
|
154
|
+
parser.add_argument("--output_report", dest="output_report", default=None,
|
|
155
|
+
help="Use to create a short quality report with the chosen ontology and input profiles, to be saved at the path given")
|
|
156
|
+
parser.add_argument("--root_term", dest="root_term", default=None,
|
|
157
|
+
help="For the output report, it sets the root term to show in center of ontoplot")
|
|
158
|
+
parser.add_argument("--ref_term", dest="ref_term", default=None,
|
|
159
|
+
help="For the output report, it sets the term whose childs will be in the color legend to indicate the branches of descendants")
|
|
160
|
+
parser.add_argument("--similarity_cluster_plot", dest="similarity_cluster_plot", default=None,
|
|
161
|
+
help="For output report, use to activate profiles clustering and clustermap plot with a similarity method (resnik', 'lin' or 'jiang_conrath). Not active by default")
|
|
162
|
+
parser.add_argument("--cl_size_factor", dest="cl_size_factor", default=1.0, type=float,
|
|
163
|
+
help="When using dinamyc clustering weigths the contribution of the cluster size in tree cut. For smaller clusters use values > 1 for greater clusters use values < 1.")
|
|
164
|
+
parser.add_argument("--ontoplot_mode", dest="ontoplot_mode", default='static',
|
|
165
|
+
help="For the semtools report, it is used to set the mode of the ontoplot. Options: 'static','dynamic' or 'canvas'. Default is 'static'.")
|
|
166
|
+
parser.add_argument("--skip_count_parentals", dest="count_parentals", default=True, action='store_false',
|
|
167
|
+
help="For the ontoplot, use it to deactivate propagating frequency to parentals terms")
|
|
168
|
+
parser.add_argument("--onto_min_freq", dest="onto_min_freq", default=0.005, type=float,
|
|
169
|
+
help="For the ontoplot, it sets the minimum frequency of terms to be shown in the plot. Default is 0.5 percent. Set to 0 to show all terms.")
|
|
170
|
+
opts = parser.parse_args(args)
|
|
171
|
+
main_semtools(opts)
|
|
172
|
+
|
|
173
|
+
def get_sorted_suggestions(args = None):
|
|
174
|
+
if args is None:
|
|
175
|
+
args = sys.argv[1:]
|
|
176
|
+
|
|
177
|
+
parser = argparse.ArgumentParser(description='Perform Ontology driven analysis with a network of relationships between terms')
|
|
178
|
+
|
|
179
|
+
parser.add_argument('-q', "--query_terms", dest="query_terms", default= None,
|
|
180
|
+
help="Path to the input file with 1 column format (each term in a new row) to be used as the query")
|
|
181
|
+
parser.add_argument("-O", "--ontology_file", dest="ontology_file", default= None,
|
|
182
|
+
help="Path to ontology file")
|
|
183
|
+
parser.add_argument('-r', "--term_relations", dest="term_relations", default= None,
|
|
184
|
+
help="Path to the term-term pairs file. Expected three files (1º term, 2º term, relationship value)")
|
|
185
|
+
parser.add_argument("-o", "--output_file", dest="output_file", default= None,
|
|
186
|
+
help="Path to the output table")
|
|
187
|
+
|
|
188
|
+
parser.add_argument("-m", "--max_targets", dest="max_targets", default= 0, type = int,
|
|
189
|
+
help="Parameter to set the limit of targets terms to retrieve")
|
|
190
|
+
parser.add_argument("-t", "--translate", dest="translate", default="c",
|
|
191
|
+
help="Use if you want to be returned human readable names (use n), codes (use c), or both (use cn or nc depending on the order you want them to be returned)")
|
|
192
|
+
parser.add_argument("-b", "--black_list", dest="black_list", default= None,
|
|
193
|
+
help="Path to a file with a list of target terms to be excluded from the analysis (one column format)")
|
|
194
|
+
parser.add_argument("-d", "--deleted_terms", dest="deleted_terms", default= None,
|
|
195
|
+
help="Path to the folder to write the different deleted term files")
|
|
196
|
+
|
|
197
|
+
parser.add_argument("-f", "--filter_parental_targets", dest="filter_parental_targets", default=False, action="store_true",
|
|
198
|
+
help="Use if you want to filter out parental terms of the query terms present in the targets")
|
|
199
|
+
parser.add_argument("-c", "--clean_query_terms", dest="clean_query_terms", default=False, action="store_true",
|
|
200
|
+
help="Use if you want to filter out parental terms of the query terms present in the queries")
|
|
201
|
+
|
|
202
|
+
parser.add_argument("-T", "--transform_rel_values", dest="transform_rel_values", default= "no",
|
|
203
|
+
help="Use to apply a transformation to relation values. Currently accepted arguments: no (no transformation), log10 (-log10 transformation), exp (log-inverse exponential transformation, 10^(-x))")
|
|
204
|
+
|
|
205
|
+
parser.add_argument("--output_report", dest="output_report", default= None,
|
|
206
|
+
help="Path to the output report file. If not used, no report will be generated")
|
|
207
|
+
parser.add_argument("--heatmap_color_preset", dest="heatmap_color_preset", default= "1",
|
|
208
|
+
help="Use to set the color preset for the heatmap. Options: '1' (default) or '2'. Each preset has a different color scheme.")
|
|
209
|
+
|
|
210
|
+
opts = parser.parse_args(args)
|
|
211
|
+
main_get_sorted_suggestions(opts)
|
|
212
|
+
|
|
213
|
+
def stEngine(args = None):
|
|
214
|
+
if args is None:
|
|
215
|
+
args = sys.argv[1:]
|
|
216
|
+
|
|
217
|
+
parser = argparse.ArgumentParser(description='Perform Ontology driven analysis with Sentence Transformer')
|
|
218
|
+
|
|
219
|
+
parser.add_argument('-m', "--model_name", dest="model_name", default= None,
|
|
220
|
+
help="Name of the model to be used")
|
|
221
|
+
parser.add_argument('-p', "--model_path", dest="model_path", default= None,
|
|
222
|
+
help="Path where the model is cached or where it will be stored")
|
|
223
|
+
parser.add_argument('-q', "--query", dest="query", default= None,
|
|
224
|
+
help="Path to the query file. Wildcards are accepted to process multiple files")
|
|
225
|
+
parser.add_argument('-c', "--corpus", dest="corpus", default= None,
|
|
226
|
+
help="Path to the corpus file. Wildcards are accepted to process multiple files")
|
|
227
|
+
parser.add_argument('-Q', "--query_embedded", dest="query_embedded", default= None,
|
|
228
|
+
help="Path to save/load the embedded query file. Wildcards are accepted to LOAD multiple files")
|
|
229
|
+
parser.add_argument('-C', "--corpus_embedded", dest="corpus_embedded", default= None,
|
|
230
|
+
help="Path to save/load the embedded corpus file. Wildcards are accepted to LOAD multiple files")
|
|
231
|
+
parser.add_argument('-o', "--output_file", dest="output_file", default= None,
|
|
232
|
+
help="Path to save the output file with semantic scores")
|
|
233
|
+
parser.add_argument('-k', "--top_k", dest="top_k", default= 20, type = int,
|
|
234
|
+
help="Get top scores per keyword")
|
|
235
|
+
parser.add_argument('-t', "--threshold", dest="threshold", default= 0, type = float,
|
|
236
|
+
help="Similarity threshold to filter results to write")
|
|
237
|
+
parser.add_argument('-v', "--verbose", dest="verbose", default= False, action='store_true',
|
|
238
|
+
help="Toogle on to get verbose output")
|
|
239
|
+
parser.add_argument('-g', "--gpu_device", dest="gpu_device", default= [], type=text_list,
|
|
240
|
+
help="Use to specify the GPU device to be used for speed-up (if available). The format is like: 'cuda:0' or 'cuda:0,cuda:1' to use multiple GPUs or cpu,cpu to use multiple CPUs")
|
|
241
|
+
parser.add_argument("-b", "--batch_size", dest="batch_size", default= 32, type=int,
|
|
242
|
+
help="Use to specify batch size for multi-GPU embedding step")
|
|
243
|
+
parser.add_argument("--use_gpu_for_sim_calculation", dest="use_gpu_for_sim_calculation", default= False, action='store_true',
|
|
244
|
+
help="Toogle on if you want to use GPU not only for the embedding process, but also for calculating query-corpus similarities (then dot score if used instead of cosine similarity)")
|
|
245
|
+
parser.add_argument('-s', "--split", dest="split", default= False, action='store_true',
|
|
246
|
+
help="Use it if your corpus comes splitted in smaller parts as list of lists (embedded in a json)")
|
|
247
|
+
parser.add_argument("--order", dest="order", default= "corpus-query",
|
|
248
|
+
help="Order of the semantic search. Options: 'corpus-query' or 'query-corpus'")
|
|
249
|
+
parser.add_argument("--chunk_size", dest="chunk_size", default=10000, type=int,
|
|
250
|
+
help="Size to be accumulating corpora until a threshold is reached before proceeding to embedd")
|
|
251
|
+
parser.add_argument("--print_relevant_pairs", dest="print_relevant_pairs", default= False, action='store_true',
|
|
252
|
+
help="Use it to print the relevant pairs of query-corpus with their scores")
|
|
253
|
+
opts = parser.parse_args(args)
|
|
254
|
+
main_stEngine(opts)
|
|
255
|
+
|
|
256
|
+
def stEngine_report(args = None):
|
|
257
|
+
if args is None:
|
|
258
|
+
args = sys.argv[1:]
|
|
259
|
+
|
|
260
|
+
parser = argparse.ArgumentParser(description='Perform Ontology driven analysis with Sentence Transformer')
|
|
261
|
+
parser.add_argument("-O", "--ontology", dest="ontology", default= None,
|
|
262
|
+
help="Path to ontology file")
|
|
263
|
+
parser.add_argument("-r", "--ref_profile", dest="ref_prof", default= None,
|
|
264
|
+
type = lambda file: [line.strip() for line in open(file).readlines()],
|
|
265
|
+
help="Path to reference profile. One term code per line")
|
|
266
|
+
parser.add_argument("-i", "--input_file", dest="input_file", default= None,
|
|
267
|
+
help="Input file with ids and profiles to compare with the reference profile")
|
|
268
|
+
parser.add_argument("-d", "--id_col", dest="id_col", default= 0, type=int,
|
|
269
|
+
help="0-based position of the column with the id")
|
|
270
|
+
parser.add_argument("-p", "--profiles_col", dest="ont_col", default= 1, type=int,
|
|
271
|
+
help="0-based position of the column with the Ontology terms")
|
|
272
|
+
parser.add_argument("-S", "--separator", dest="separator", default='|',
|
|
273
|
+
help="Set which character must be used to split the terms profile. Default '|'")
|
|
274
|
+
parser.add_argument("-o", "--output_file", dest="output_file", default= 'report.html',
|
|
275
|
+
help="Output report")
|
|
276
|
+
parser.add_argument("-L", "--matrix_limits", dest="matrix_limits", default= [20, 40], type= lambda data: [int(i) for i in data.split(",")],
|
|
277
|
+
help="Number of rows and columns to show in heatmap defined as 'Nrows,Ncols'. Default 20,40")
|
|
278
|
+
parser.add_argument("-N", "--neg_matrix_limits", dest="neg_matrix_limits", default= [20, 40], type= lambda data: [int(i) for i in data.split(",")],
|
|
279
|
+
help="Number of rows and columns to show in the negative heatmap defined as 'Nrows,Ncols'. Default 20,40")
|
|
280
|
+
parser.add_argument("--hard_check", dest="hard_check", default= True, action="store_false",
|
|
281
|
+
help="Set to disable hard check cleaning. Default true")
|
|
282
|
+
parser.add_argument("--pubmed_ids_and_titles", dest="pubmed_ids_and_titles", default= None,
|
|
283
|
+
help="Path to pubmed_ids_and_titles file")
|
|
284
|
+
parser.add_argument("--sim", dest="sim", default= None,
|
|
285
|
+
help="Similarity method to use")
|
|
286
|
+
parser.add_argument("--use_pickle", dest="use_pickle", default= False, action="store_true",
|
|
287
|
+
help="Use it if you want to save (if first time)/use the cached version (if executed before) and just launch the report")
|
|
288
|
+
parser.add_argument("--get_full_sim_sorted_list", dest="get_full_sim_sorted_list", default= False, action="store_true",
|
|
289
|
+
help="Use it to get the full sorted list of similarities between the reference profile and the input profiles")
|
|
290
|
+
opts = parser.parse_args(args)
|
|
291
|
+
main_stEngine_report(opts)
|
|
292
|
+
|
|
293
|
+
def get_corpus_index(args = None):
|
|
294
|
+
if args is None:
|
|
295
|
+
args = sys.argv[1:]
|
|
296
|
+
|
|
297
|
+
parser = argparse.ArgumentParser(description='Extract abstracts from pubmed xml files')
|
|
298
|
+
|
|
299
|
+
parser.add_argument('-i', "--input", dest="input", default= None,
|
|
300
|
+
help="Path to the pubmed input file in xml format (gzip compressed) to extract. Wildcards are accepted to process multiple files")
|
|
301
|
+
parser.add_argument('-o', "--output", dest="output", default= None,
|
|
302
|
+
help="Output path to save the extracted data (gzip compressed).")
|
|
303
|
+
parser.add_argument('-k', "--items_per_file", dest="items_per_file", default= 0, type = int,
|
|
304
|
+
help="Number of abstracts to be accumulated and saved in a file. If not used, the same input-output files will be used")
|
|
305
|
+
parser.add_argument('-t', "--tag", dest="tag", default= "file_",
|
|
306
|
+
help="If a items_per_file is used, this tag will be used to name the output files")
|
|
307
|
+
parser.add_argument('-c', "--n_cpus", dest="n_cpus", default= 1, type = int,
|
|
308
|
+
help="Number of cpus to be used for parallel processing")
|
|
309
|
+
parser.add_argument('-z', "--chunk_size", dest="chunk_size", default= 0, type = int,
|
|
310
|
+
help="Number of files to be processed be each cpu")
|
|
311
|
+
parser.add_argument('-b', "--text_balancing_size", dest="text_balancing_size", default= 0, type = int,
|
|
312
|
+
help="When white texts to disk, sort by text length and distribute them in packages of the given size. These packages are writed to the same file.")
|
|
313
|
+
parser.add_argument('-d', '--debugging_mode', dest="debugging_mode", default=False, action='store_true',
|
|
314
|
+
help="Activate to output stats about the content of the xml as warnings")
|
|
315
|
+
parser.add_argument('-s', "--split", dest="split", default= False, action='store_true',
|
|
316
|
+
help="Use it to split your text into smaller text units (then returned as a json)")
|
|
317
|
+
parser.add_argument("--split_output_files", dest="split_output_files", default= False, action='store_true',
|
|
318
|
+
help="Use this option to split output files with 'text_balancing_size' texts per file")
|
|
319
|
+
parser.add_argument('-p', "--parse", dest="parse", default = None,
|
|
320
|
+
help="'Basic' for raw text files. 'PubmedAbstract' for pubmed files with abstracs. 'PubmedPaper' for full paper Pubmed(PMC) files ")
|
|
321
|
+
parser.add_argument('-e', "--equivalences_file", dest="equivalences_file", default= None,
|
|
322
|
+
help="Path to a 2 columns file with PMC-PMID equivalences to use when a parsed papers only finds the PMC ID inside its content.")
|
|
323
|
+
parser.add_argument('-f', "--filter_by_blacklist", dest="filter_by_blacklist", default= None,
|
|
324
|
+
help="Path to a single column file with blacklisted words to filter out documents whose titles contains these words")
|
|
325
|
+
parser.add_argument("--blacklisted_mode", dest="blacklisted_mode", default= 'partial',
|
|
326
|
+
help="When using 'filter_by_blacklist' use this option to choose between 'exact' or 'partial' match. Default is 'partial'")
|
|
327
|
+
parser.add_argument("--clean_type", dest="clean_type", default= 'hard',
|
|
328
|
+
help="Use to set the type of cleaning to be performed on the text. Options: basic (do not clean at all), soft or hard (default).")
|
|
329
|
+
parser.add_argument("--split_type", dest="split_type", default= 'classic',
|
|
330
|
+
help="Use to set the type of splitting to be performed on the text. Options: classic (default, splitting by '\n\n', \n', '.', ';', ',') or space_overlap ('\n\n', '\n', ' ', '' with overlap to avoid losing information).")
|
|
331
|
+
opts = parser.parse_args(args)
|
|
332
|
+
main_get_corpus_index(opts)
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def get_sorted_profs(args=None):
|
|
336
|
+
"""
|
|
337
|
+
Parses command-line arguments and calls the main function to get sorted profiles based on ontology term similarities.
|
|
338
|
+
|
|
339
|
+
:param args: List of command-line arguments. If None, sys.argv[1:] is used.
|
|
340
|
+
:type args: list or None
|
|
341
|
+
|
|
342
|
+
:returns: None
|
|
343
|
+
"""
|
|
344
|
+
if args == None: args = sys.argv[1:]
|
|
345
|
+
parser = argparse.ArgumentParser(description=f'Usage: {inspect.stack()[0][3]} [options]')
|
|
346
|
+
parser.add_argument("-i", "--input_file", dest="input_file", default= None,
|
|
347
|
+
help="Input file with ids and profiles")
|
|
348
|
+
parser.add_argument("-d", "--pat_id_col", dest="subject_column", default= 0, type=int,
|
|
349
|
+
help="0-based position of the column with the subject id")
|
|
350
|
+
parser.add_argument("-p", "--term_col", dest="annotations_column", default= 1, type=int,
|
|
351
|
+
help="0-based position of the column with the ontology terms")
|
|
352
|
+
parser.add_argument("-S", "--terms_separator", dest="separator", default='|',
|
|
353
|
+
help="Set which character must be used to split the terms profile. Default '|'")
|
|
354
|
+
parser.add_argument("-r", "--ref_profile", dest="ref_prof", default= None, type = one_column_file,
|
|
355
|
+
help="Path to reference profile. One term code per line. If not used, a general one will be made from the union of all external profiles")
|
|
356
|
+
parser.add_argument("-O", "--ontology_file", dest="ontology_file", default= None,
|
|
357
|
+
help="Path to ontology file or Ontology name to use")
|
|
358
|
+
parser.add_argument("-X", "--excluded_terms", dest="excluded_terms", default= [], type = one_column_file,
|
|
359
|
+
help="File with excluded terms. One term code per line.")
|
|
360
|
+
parser.add_argument("--hard_check", dest="hard_check", default= True, action="store_false",
|
|
361
|
+
help="Set to disable hard check cleaning. Default true")
|
|
362
|
+
parser.add_argument("-o", "--output_file", dest="output_file", default= 'report.html',
|
|
363
|
+
help="Output report file")
|
|
364
|
+
parser.add_argument("-f", "--general_prof_freq", dest="term_freq", default= 0, type= float,
|
|
365
|
+
help="When reference profile is not given, a general ine is computed with all profiles. If a freq is defined (0-1), all terms with freq minor than limit are removed")
|
|
366
|
+
parser.add_argument("-L", "--matrix_limits", dest="matrix_limits", default= [20, 40], type= lambda data: [int(i) for i in data.split(",")],
|
|
367
|
+
help="Number of rows and columns to show in heatmap defined as 'Nrows,Ncols'. Default 20,40")
|
|
368
|
+
parser.add_argument("--header_id", dest="header_id", default="HP", help="Header ID to use in plotted heatmaps")
|
|
369
|
+
opts = parser.parse_args(args)
|
|
370
|
+
main_get_sorted_profs(opts)
|
|
@@ -2,4 +2,6 @@ GO http://purl.obolibrary.org/obo/go/go-basic.obo
|
|
|
2
2
|
HPO http://purl.obolibrary.org/obo/hp.obo
|
|
3
3
|
MONDO http://purl.obolibrary.org/obo/mondo.obo
|
|
4
4
|
EFO http://www.ebi.ac.uk/efo/efo.obo
|
|
5
|
-
DO https://
|
|
5
|
+
DO https://purl.obolibrary.org/obo/doid.obo
|
|
6
|
+
CL https://purl.obolibrary.org/obo/cl/cl-basic.obo
|
|
7
|
+
UBERON https://purl.obolibrary.org/obo/uberon/uberon-basic.obo
|