Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/biolink/ontobio into go-s…
Browse files Browse the repository at this point in the history
…ite-2246-gorule-0000001-rnac-rna-types-are-getting-mangled
  • Loading branch information
mugitty committed Jun 11, 2024
2 parents 610b113 + 38611d1 commit 1bb6f9c
Show file tree
Hide file tree
Showing 26 changed files with 10,690 additions and 2,068 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/make-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
python: [ "3.9", "3.10", "3.11" ]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ coverage.xml
*,cover
.hypothesis/
.pytest_cache/
tests/resources/mgi.gpi
tests/resources/mgi.gpi.gz

# Translations
*.mo
Expand Down
25 changes: 18 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,24 @@ foo:

# only run local tests
travis_test:
pytest tests/test_*local*.py tests/test_*parse*.py tests/test*writer*.py tests/test_qc.py \
tests/test_rdfgen.py tests/test_phenosim_engine.py tests/test_ontol.py \
tests/test_validation_rules.py tests/unit/test_annotation_scorer.py \
tests/test_goassociation_model.py tests/test_relations.py \
tests/unit/test_golr_search_query.py tests/unit/test_owlsim2_api.py \
tests/unit/test_clinical_mod.py tests/test_collections.py \
tests/test_gocamgen.py
@if [ -d ".venv" ] && [ -f "pyproject.toml" ]; then \
echo "Running tests in Poetry environment..."; \
poetry run pytest tests/test_*local*.py tests/test_*parse*.py tests/test*writer*.py tests/test_qc.py \
tests/test_rdfgen.py tests/test_phenosim_engine.py tests/test_ontol.py \
tests/test_validation_rules.py tests/unit/test_annotation_scorer.py \
tests/test_goassociation_model.py tests/test_relations.py \
tests/unit/test_golr_search_query.py tests/unit/test_owlsim2_api.py \
tests/test_collections.py \
tests/test_gocamgen.py; \
else \
pytest tests/test_*local*.py tests/test_*parse*.py tests/test*writer*.py tests/test_qc.py \
tests/test_rdfgen.py tests/test_phenosim_engine.py tests/test_ontol.py \
tests/test_validation_rules.py tests/unit/test_annotation_scorer.py \
tests/test_goassociation_model.py tests/test_relations.py \
tests/unit/test_golr_search_query.py tests/unit/test_owlsim2_api.py \
tests/test_collections.py \
tests/test_gocamgen.py; \
fi

cleandist:
rm dist/* || true
Expand Down
16 changes: 16 additions & 0 deletions bin/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
See [command line docs](http://ontobio.readthedocs.io/en/latest/commandline.html#commandline) on ReadTheDocs

To test validate.py "validate" command, the command that produces the final GPADs in the pipeline via the "mega make"
(aka: "produces GAFs, GPADs, ttl" stage), on a particular source:

```bash
poetry install
poetry run validate produce -m ../go-site/metadata --gpad -t . -o go-basic.json --base-download-url "http://skyhook.berkeleybop.org/[PIPELINE_BRANCH_NAME]/" --only-dataset mgi MGI
poetry run validate produce -m ../go-site/metadata --gpad -t . -o go-basic.json --base-download-url "http://skyhook.berkeleybop.org/[PIPELINE_BRANCH_NAME]/" --only-dataset goa_chicken goa
```


To test whether a GAF file is valid (passes all the GORules):
```bash
poetry install
poetry run python3 ontobio-parse-assocs.py --file [path_to_file.gaf] --format GAF -o mgi_valid.gaf --report-md mgi.report.md -r [path_to_go.json] -l all validate
```
17 changes: 15 additions & 2 deletions bin/ontobio-parse-assocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import sys
import json
import logging
from typing import Dict, List

def main():
"""
Expand Down Expand Up @@ -80,7 +81,9 @@ def main():
parser.add_argument("-g", "--gpi", type=str, required=False, default=None,
help="GPI file")
parser.add_argument("-m", "--metadata_dir", type=dir_path, required=False,
help="Path to metadata directory")
help="Path to metadata directory")
parser.add_argument("--retracted_pub_set", type=argparse.FileType('r'), required=False,
help="Path to retracted publications file")
parser.add_argument("-l", "--rule", action="append", required=None, default=[], dest="rule_set",
help="Set of rules to be run. Default is no rules to be run, with the exception \
of gorule-0000027 and gorule-0000020. See command line documentation in the \
Expand Down Expand Up @@ -143,9 +146,17 @@ def main():
rule_set = assocparser.RuleSet.ALL

goref_metadata = None
ref_species_metadata = None
if args.metadata_dir:
absolute_metadata = os.path.abspath(args.metadata_dir)
goref_metadata = metadata.yamldown_lookup(os.path.join(absolute_metadata, "gorefs"))
goref_metadata = metadata.yamldown_lookup(os.path.join(absolute_metadata, "gorefs"))
ref_species_metadata = metadata.yaml_set(absolute_metadata, "go-reference-species.yaml", "taxon_id")

retracted_pub_set = None
if args.retracted_pub_set:
retracted_pub_set = metadata.retracted_pub_set(args.retracted_pub_set.name)
elif args.metadata_dir:
retracted_pub_set = metadata.retracted_pub_set_from_meta(absolute_metadata)

# set configuration
filtered_evidence_file = open(args.filtered_file, "w") if args.filtered_file else None
Expand All @@ -161,6 +172,8 @@ def main():
allow_unmapped_eco=args.allow_unmapped_eco,
gpi_authority_path=args.gpi,
goref_metadata=goref_metadata,
ref_species_metadata=ref_species_metadata,
retracted_pub_set=retracted_pub_set,
rule_set=rule_set
)
p = None
Expand Down
Loading

0 comments on commit 1bb6f9c

Please sign in to comment.