Skip to content

Commit f21aacd

Browse files
authored
Merge pull request #393 from obophenotype/set_up_AI_agent
Set up AI agent
2 parents a5b0be8 + d06edda commit f21aacd

3 files changed

Lines changed: 236 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# Ontology of Biological Attributes (OBA) Project Guide
2+
3+
This includes instructions for editing the OBA ontology.
4+
5+
## Project Layout
6+
- Main development file is `src/patterns/definitions.owl` (functional syntax)
7+
- ODK and ontology documentation can be found in `/docs/`
8+
9+
## Querying ontology
10+
11+
- Use grep/rg to find terms. To look at a specific term if you know the ID:
12+
- `grep 'id: OBA_2040177' src/patterns/definitions.owl`
13+
- All mentions of an ID
14+
- `obo-grep.pl -r 'OBA_2040177' src/patterns/definitions.owl`
15+
- Search over `src/patterns/definitions.owl`,`src/patterns/dosdp-patterns/*.yaml` and `src/patterns/data/default`.
16+
- DO NOT bother doing your own greps over the files, or looking for other files, unless otherwise asked, you will just waste time.
17+
- ONLY use the methods above for searching the ontology
18+
19+
## Before making edits
20+
- Read the request carefully and make a plan, especially if there is nuance
21+
- If related issues are mentioned read them: `gh issue view GITHUB-ISSUE-NUMBER`
22+
- If a PMID is mentioned in the issue, ALWAYS try and read it
23+
- ALWAYS check proposed parent terms for consistency
24+
25+
## Editors guide
26+
27+
### How to create new terms in OBA
28+
29+
#### Overview
30+
- OBA terms are compositional, check DOSDP design patterns: `src/patterns/dosdp-patterns/*.yaml`
31+
- Design pattern templates are found in `src/patterns/data/default`
32+
33+
#### Steps
34+
35+
1- Read the issue carefully to identify the most appropriate design pattern and filler terms. Use the following examples as a general guide.
36+
37+
Example 1: The amount or level of cholesterol when measured in blood serum. Use the design pattern template `entity_attribute_location.tsv` and the filler terms: cholesterol, amount and blood serum.
38+
39+
Example 2: The age at which asthma manifestations first appear. Use the design pattern template `disease_onset.tsv` and the filler term: asthma.
40+
41+
Example 3: A trait that affects the response to prednisolone. Use the design pattern template `response_to_chemical_stimulus_trait.tsv` and the filler term: prednisolone.
42+
43+
2- Check whether design pattern fillers have been imported to OBA. `grep - i src/ontology/imports/merged_import.owl`
44+
45+
3- If they have been imported, please proceed to creating the new OBA term using the appropriate DOSDP pattern template.
46+
47+
4- Add the term to the template, then in `src/ontology` run
48+
`make IMP=false MIR=false ../patterns/definitions.owl`
49+
50+
5- Refresh OBA imports by running
51+
`make refresh-merged`
52+
53+
6 - Run `make IMP=false MIR=false ../patterns/definitions.owl` again.
54+
55+
7- When creating new OBA terms using DOSDP patterns, it may be necessary to import terms from other ontologies like ChEBI, the Chemical Entities of Biological Interest or PRO, the PRotein Ontology. However, they are too large to be managed as standard imports so are managed as slims. They are located here:
56+
PRO: https://github.com/obophenotype/pro_obo_slim
57+
CHEBI: https://github.com/obophenotype/chebi_obo_slim
58+
59+
When a new term you are using in a DOSDP pattern is not yet in a slim, make a comment in the issue requesting the terms to be added manually.
60+
61+
## OBO Format Guidelines
62+
- Term ID format: OBA:NNNNNNN (7-digit number)
63+
- Handling New Term Requests (NTRs):
64+
- New terms start OBA:210xxxx
65+
- Do `grep id: OBA:210 src/patterns/definitions.owl` to check for clashes
66+
- Each term requires: id, name, definition with references
67+
- Never guess OBA IDs, or ontology term IDs, use search tools above to determine actual term
68+
- Never guess PMIDs for references, do a web search if needed
69+
- Use standard relationship types: `is_a`, `part_of`, `characteristic_of`, `characteristic_of_part_of`, `subclass_of` and `has_role`.
70+
- Follow existing term patterns for consistency
71+
72+
## Publications
73+
- Run the command `aurelian fulltext <PMID:nnn>` to fetch full text for a publication. A doi or URL can also be used
74+
- You should cite publications appropriately, e.g. `def: "...." [PMID:nnnn, doi:mmmm]
75+
76+
## GitHub Contribution Process
77+
- Most requests from users should follow one of two patterns:
78+
- You are not confident how to proceed, in which case end with asking a clarifying question (via `gh`)
79+
- You are confident how to proceed, you make changes, commit on a branch, and open a PR for the user to review
80+
- Check existing terms before adding new ones
81+
- For new terms: provide name, definition, place in hierarchy, and references
82+
- Include PMIDs for all assertions
83+
- Follow naming conventions from parent terms
84+
- Always commit in a branch, e.g. issue-NNN
85+
- If there is an existing PR which you started then checkout that branch and continue, rather than starting a new PR (unless you explicitly want to abandon the original PR, e.g. it was on completely the wrong tracks)
86+
- Always make clear detailed commit messages, saying what you did and why
87+
- Always sign your commits `@AI agent`
88+
- Create PRs using `gh pr create ...`
89+
- File PRs with clear descriptions, and sign your PR
90+
91+
## Handling GitHub issues and requests
92+
- Use `gh` to read and write issues/PRs
93+
- Sign all commits and PRs as `@AI agent`
94+
95+
## Obsoleting terms originating from DOS-DP templates
96+
97+
- Delete the row with the targeted term from the appropriate data table (tsv file) in folder: `src/patterns/data/default/`
98+
- Fill in the IRI of the term to be obsoleted in `src/templates/obsoletes.tsv` along with other relevant information. It is useful to add a comment with an explanation for the obsoletion. Start the comment with 'Reason for obsoletion: '.
99+
100+
Example:
101+
102+
```
103+
104+
Ontology ID: http://purl.obolibrary.org/obo/OBA_2050081
105+
Type: owl:Class
106+
Obsolete: true
107+
Replacement Term: http://purl.obolibrary.org/obo/OBA_2045319
108+
label of replaced class: serum gamma-glutamyl transferase level
109+
Comment: Reason for obsoletion: a term with the same intended meaning already exists.
110+
111+
```
112+
113+
- Re-create the DOS-DP axioms by running
114+
115+
`cd src/ontology #If you are not in the ontology folder`
116+
`make ../patterns/definitions.owl`
117+
`make components/obsoletes.owl`
118+
119+
## Other metadata
120+
121+
- Link back to the issue you are dealing with using the `term_tracker_item`
122+
- All terms should have definitions, with at least one definition xref, ideally a PMID
123+
- You can sign terms as `created_by: AI agent`
124+
125+
## Relationships
126+
127+
All terms should have at least one `is_a` (this can be implicit by a logical definition, see below).
128+
The four main relationships used in OBA are `part_of`, `characteristic_of`, `characteristic_of_part_of`, and `subclass_of`. In addition, the relationship `has_role` is used in cases where the definition of a biological attribute requires a reference to a chemical role.
129+
130+
## Logical definitions
131+
132+
These should follow genus-differentia form, and depend on the pattern used.
133+
134+
Example:
135+
136+
```
137+
138+
[Term]
139+
id: OBA:2040177
140+
name: level of ceramide
141+
def: "The amount of a ceramide when measured in anatomical entity." [AUTO:patterns/patterns/entity_attribute_location]
142+
synonym: "anatomical entity ceramide amount" EXACT [AUTO:patterns/patterns/entity_attribute_location]
143+
synonym: "ceramide amount" EXACT []
144+
is_a: OBA:1000965 ! sphingolipid level
145+
property_value: terms:contributor "https://orcid.org/0000-0001-8314-2140" xsd:string
146+
147+
```
148+
149+
The reasoner can find the most specific `is_a`, so it's OK to leave this off.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
pull_request:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
14+
jobs:
15+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
16+
copilot-setup-steps:
17+
runs-on: ubuntu-latest
18+
19+
# Set the permissions to the lowest permissions possible needed for your steps.
20+
# Copilot will be given its own token for its operations.
21+
permissions:
22+
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
23+
contents: read
24+
25+
# You can define any steps you want, and they will run before the agent starts.
26+
# If you do not check out your code, Copilot will do this for you.
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Create tools directory
32+
run: mkdir -p ${{ github.workspace }}/tools
33+
shell: bash
34+
35+
- name: Cache ROBOT JAR files
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.jar-cache
39+
key: ${{ runner.os }}-robot-v1.9.8
40+
restore-keys: ${{ runner.os }}-robot-
41+
42+
- name: Download ROBOT JAR if not cached
43+
run: |
44+
mkdir -p ~/.jar-cache
45+
if [ ! -f ~/.jar-cache/robot.jar ]; then
46+
curl -L https://github.com/ontodev/robot/releases/download/v1.9.8/robot.jar -o ~/.jar-cache/robot.jar
47+
fi
48+
shell: bash
49+
50+
- name: Setup ROBOT tools
51+
run: |
52+
cp ~/.jar-cache/robot.jar ${{ github.workspace }}/tools/robot.jar
53+
curl -L https://raw.githubusercontent.com/ontodev/robot/v1.9.8/bin/robot -o ${{ github.workspace }}/tools/robot
54+
chmod +x ${{ github.workspace }}/tools/robot
55+
${{ github.workspace }}/tools/robot --help
56+
shell: bash
57+
58+
- name: Add tools to PATH
59+
run: |
60+
echo "${{ github.workspace }}/tools" >> $GITHUB_PATH
61+
ls -alt ${{ github.workspace }}
62+
ls -alt ${{ github.workspace }}/tools
63+
shell: bash
64+
65+
- name: Add obo-scripts to PATH
66+
run: |
67+
git clone https://github.com/cmungall/obo-scripts.git ${{ github.workspace }}/tools/obo-scripts
68+
echo "${{ github.workspace }}/tools/obo-scripts" >> $GITHUB_PATH
69+
shell: bash
70+
71+
- name: Install uv
72+
uses: astral-sh/setup-uv@v5
73+
74+
- name: Install Python tools
75+
run: |
76+
uv venv
77+
source .venv/bin/activate
78+
uv pip install aurelian jinja2-cli "wrapt>=1.17.2"
79+
shell: bash

src/ontology/oba-idranges.owl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,13 @@ Datatype: idrange:12
127127
EquivalentTo:
128128
xsd:integer[>= 2090000 , <= 2099999]
129129

130+
Datatype: idrange:13
131+
132+
Annotations:
133+
allocatedto: "AI Agent"
134+
135+
EquivalentTo:
136+
xsd:integer[>= 2100000 , <= 2109999]
137+
130138
Datatype: xsd:integer
131139
Datatype: rdf:PlainLiteral

0 commit comments

Comments
 (0)