Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
Updates the READMEs to change the examples to MONDO links instead of EFO links, since those often contain bugs
  • Loading branch information
paynejason committed May 2, 2024
1 parent 1727e80 commit 5fd3481
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README-UI.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The following information pertains to the text2term UI, which is written [here](
- npm >= 8.0.0
- Python >= 3.9.0
- pip >= 21.0.0
- text2term >= 1.1.0
- text2term >= 4.1.2

**\*** These are the versions I have that work; while I know Python 3.9 or higher is necessary, the others may not strictly require the listed versions.

Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,40 @@ pip install text2term
import text2term
import pandas

df1 = text2term.map_terms("test/unstruct_terms.txt", "http://www.ebi.ac.uk/efo/efo.owl")
df2 = text2term.map_terms(["asthma", "acute bronchitis"], "http://www.ebi.ac.uk/efo/efo.owl")
df3 = text2term.map_terms({"asthma":"disease", "acute bronchitis":["disease", "lungs"]}, "http://www.ebi.ac.uk/efo/efo.owl")
df1 = text2term.map_terms("test/unstruct_terms.txt", "http://purl.obolibrary.org/obo/mondo.owl")
df2 = text2term.map_terms(["asthma", "acute bronchitis"], "http://purl.obolibrary.org/obo/mondo.owl")
df3 = text2term.map_terms({"asthma":"disease", "acute bronchitis":["disease", "lungs"]}, "http://purl.obolibrary.org/obo/mondo.owl")
```
Below is an example of caching, assuming the same imports as above:
```python
text2term.cache_ontology("http://www.ebi.ac.uk/efo/efo.owl", "EFO")
df1 = text2term.map_terms("test/unstruct_terms.txt", "EFO", use_cache=True)
df2 = text2term.map_terms(["asthma", "acute bronchitis"], "EFO", use_cache=True)
text2term.clear_cache("EFO")
text2term.cache_ontology("http://purl.obolibrary.org/obo/mondo.owl", "MONDO")
df1 = text2term.map_terms("test/unstruct_terms.txt", "MONDO", use_cache=True)
df2 = text2term.map_terms(["asthma", "acute bronchitis"], "MONDO", use_cache=True)
text2term.clear_cache("MONDO")
```

### Command Line
The basic use of the tool requires a `source` file containing a list of terms to map to the given `target` ontology:
`python text2term -s test/unstruct_terms.txt -t http://www.ebi.ac.uk/efo/efo.owl`
`python text2term -s test/unstruct_terms.txt -t http://purl.obolibrary.org/obo/mondo.owl`

Specify an output file where the mappings should be saved using `-o`:
`python text2term -s test/unstruct_terms.txt -t efo.owl -o /Documents/my-mappings.csv`
`python text2term -s test/unstruct_terms.txt -t mondo.owl -o /Documents/my-mappings.csv`

Set the minimum acceptable similarity score for mapping each given term to an ontology term using `-min`:
`python text2term -s test/unstruct_terms.txt -t efo.owl -min 0.8`
`python text2term -s test/unstruct_terms.txt -t mondo.owl -min 0.8`
The mapped terms returned will have been determined to be 0.8 similar to their source terms in a 0-1 scale.

Exclude deprecated ontology terms (declared as such via *owl:deprecated true*) using `-d`:
`python text2term -s test/unstruct_terms.txt -t efo.owl -d`
`python text2term -s test/unstruct_terms.txt -t mondo.owl -d`

Limit search to only terms whose IRIs start with any IRI given in a list specified using `-iris`:
`python text2term.py -s test/unstruct_terms.txt -t efo.owl -iris http://www.ebi.ac.uk/efo/EFO,http://purl.obolibrary.org/obo/HP`
`python text2term.py -s test/unstruct_terms.txt -t mondo.owl -iris http://purl.obolibrary.org/obo/mondo.owl,http://purl.obolibrary.org/obo/HP`
Here, because EFO reuses terms from other ontologies such as HP and GO, the HP terms would be included but the GO terms would be excluded.

Use the cache on the command line, first by flagging it, then in the future using the acronym:
`python text2term -s test/unstruct_terms.txt -t http://www.ebi.ac.uk/efo/efo.owl -c EFO`
`python text2term -s test/unstruct_terms.txt -t http://purl.obolibrary.org/obo/mondo.owl -c MONDO`
Then, after running this, the following command is equivalent:
`python text2term -s test/unstruct_terms.txt -t EFO`
`python text2term -s test/unstruct_terms.txt -t MONDO`

## Programmatic Usage
The tool can be executed in Python with the `map_terms` function:
Expand Down

0 comments on commit 5fd3481

Please sign in to comment.