Skip to content

Add year to cxgn time ontology#6100

Open
ktmeaton wants to merge 6 commits into
solgenomics:masterfrom
BFF-AFIRMS:topic/add-time-ontology-year
Open

Add year to cxgn time ontology#6100
ktmeaton wants to merge 6 commits into
solgenomics:masterfrom
BFF-AFIRMS:topic/add-time-ontology-year

Conversation

@ktmeaton
Copy link
Copy Markdown
Contributor

@ktmeaton ktmeaton commented May 11, 2026

Description

This pull requests adds time in years (year 1 to year 100) to the cxgn time ontology. In the config file, it can be enabled for compose traits and treatments by using the tiy config (time in years). I couldn't see any existing selenium tests for the compose interface, so I added some minimal tests under the tools category.

Checklist

  • Refactoring only
  • Documentation only
  • Fixture update only
  • Bug fix
    • The relevant issue has been closed.
    • Further work is required.
  • New feature
    • Relevant tests have been created and run.
    • Data was added to the fixture
      • Data was added via a patch in /t/data/fixture/patches/.
    • User-Facing Change
      • The user manual in /docs has been updated.
    • Any new Perl has been documented using perldoc.
    • Any new JavaScript has been documented using JSDoc.
    • Any new legacy JavaScript has been moved from /js to /js/source/legacy.

@ktmeaton
Copy link
Copy Markdown
Contributor Author

Failing test 44 of _BrAPIv2_phenotyping.t, related to brapi v2 traits. Possibly the new time components are throwing off a check of traits in the db.

@ktmeaton
Copy link
Copy Markdown
Contributor Author

ktmeaton commented May 12, 2026

Yes, that's exactly what the problem was. I've now added 101 new 'traits' to the db, so the brapi expected count needs to be updated.

@ktmeaton
Copy link
Copy Markdown
Contributor Author

CI passing, ready for review!

Comment thread db/00205/AddTimeOntologyYear.pm Outdated
Comment on lines +57 to +58
# next available dbxref accession in time ontology is '0000481'
my $dbxref_accession = 481;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little wary of hardcoding the next highest accession number in an ontology - I will need to fish around to see if other databases have messed with their time ontologies in such a way that it would break this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very good point, thank you. Initially I'd thought of using the autocreated: year 1 accession for the dbxref accession. But then I thought this might be inconsistent in a bad way, since all the other time ontology accessions have hard-coded numeric accessions. Another option might be to put it in its own ontology (ex. YEAR:000001). But that might also be consfusing if year is the only time unit to have its own ontology.

I'm curious to see what you find out in the other databases!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe putting year in it's own time ontology was a bad suggestion. I imagine that will over complicate things downstream to have time in multiple ontologies (ex. plotting post-composed time traits #6096).

Copy link
Copy Markdown
Contributor

@ryan-preble ryan-preble May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your general structure of placing a new root term in the TIME ontology and then assigning that root term to be a TIY composable ontology is the right approach. But I checked and it seems other breedbases have added additional time terms to their DB that throws off the accession numbers. I think the best approach would be to solve for the next highest accession number in the db patch and use that to form the root term, then start adding new accession numbers from that starting point. Changing sgn.conf to use 481 makes sense because sgn_local.conf can override that value for all the databases that have modified their TIME ontologies away from the default. We will just have to be careful to set the correct values in sgn_local.conf wherever relevant

Also, one more thing: I am pretty sure cvterm create_with() will ignore the definition parameter. When I wrote a dbpatch that created new ontologies, I had to manually update the definition after making it with create_with().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now changed the definition from inside create_with() to manual afterwards. Jumping over to Lukas' responses to discuss auto-detection of accession vs hard-coding a much larger root number.

@lukasmueller
Copy link
Copy Markdown
Member

lukasmueller commented May 15, 2026 via email

@lukasmueller
Copy link
Copy Markdown
Member

With hardcoding, I mean you predetermine what the IDs are, you don't let the script do it. That might lead to complications if the IDs are then not the same between systems.

@lukasmueller
Copy link
Copy Markdown
Member

Start at 0005000 for the year terms or something like that so that they are likely available on all sytems

@ktmeaton
Copy link
Copy Markdown
Contributor Author

Based on Lukas' comments, I've started the new time in years root to be at 0005000, with new entries going up to (and including 0005100) . @ryan-preble do you think this namespace is going to be compatible with most of the databases you've looked at so far?

@ryan-preble ryan-preble self-requested a review May 19, 2026 17:01
Comment thread sgn.conf Outdated
@@ -25,4 +25,4 @@
# image_analysis_services { "plantcv_citrus_app": { "server_endpoint": "http://fake-image-analysis-service/", "image_type_name": "image_analysis_contours", "description": "Citrus Image Analysis (Mocked)", "service_traits": { "Fruit Diameter|INV:0000118": "INV" } } }

composable_cvs trait,object,tod,toy,unit,method,experiment_treatment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure tiy shows on this line too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I missed that, thanks! Fixed in latest commit. I'm glad the CI tests correctly failed when I had that value set incorrectly.

Comment thread sgn.conf
# image_analysis_services { "plantcv_citrus_app": { "server_endpoint": "http://fake-image-analysis-service/", "image_type_name": "image_analysis_contours", "description": "Citrus Image Analysis (Mocked)", "service_traits": { "Fruit Diameter|INV:0000118": "INV" } } }

composable_cvs trait,object,tod,toy,unit,method,experiment_treatment
composable_cvs_allowed_combinations Agronomic|trait+toy,Metabolic|trait+object+tod+toy+unit+method
Copy link
Copy Markdown
Contributor

@ryan-preble ryan-preble May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question for @lukasmueller : do we want Time In Years to be available by default or suppressed until this line is overridden in sgn_local.conf?

Comment thread sgn.conf Outdated
composable_variables 1 #display only variable terms in the post composing tool
composable_tod_root_cvterm "time of day|TIME:0000001"
composable_toy_root_cvterm "time of year|TIME:0000005"
composable_tiy_root_cvterm "time in years|TIME:0000481"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to get bumped to 5000

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, just updated now.

@ktmeaton
Copy link
Copy Markdown
Contributor Author

Ah yes, CI is failing because the compose test is searching for specific time accession numbers to navigate the cvterm ontology tree in the UI. I will fix that test next.

@ryan-preble ryan-preble self-requested a review May 19, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding year to the cxgn time ontology

3 participants