Skip to content

Expand supported link types #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2025
Merged

Conversation

DavidStirling
Copy link
Member

This PR expands the object types permitted in the links argument to cover some annotation types. This will primarily help to associate results with the workflow data model.

We could potentially include some of the more obscure types like BooleanAnnotation but I've tried to limit it to what is likely to be useful within omero-web, at least in the first instance.

@DavidStirling DavidStirling requested a review from sbesson May 7, 2025 13:12
Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

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

👍 for the expansion of the library to allow tables to be linked to additional objects.

Looking at https://omero.readthedocs.io/en/stable/developers/Model/StructuredAnnotations.html#annotation-hierarchy, the concrete annotation classes that are not included here are

BooleanAnnotation
TimeStampAnnotation
TermAnnotation
DoubleAnnotation
LongAnnotation
CommentAnnotation

Even though we don't have workflows for these types currently, we might in the future and/or others in the community could benefit from it. My vote goes towards adding them to the list of annotatable objects.

@DavidStirling
Copy link
Member Author

Thanks @sbesson, have made that change

@DavidStirling DavidStirling requested review from mabruce and sbesson May 14, 2025 17:27
Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

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

Ran some a basic functional testing creating empty annotations of each type and importing a single table linked to every object

Python 3.10.12 (main, Feb  4 2025, 14:57:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import omero
>>> import omero2pandas
>>> import pandas
>>> my_data = pandas.read_csv("nuclei.csv")
>>> client = omero.client("localhost")
>>> client.createSession("import.user", password)
session-759e5066-69ac-471d-a2fe-ebda0636d7c4/b0e408fb-bf93-4e73-9793-7b4f8fe7a97e -t -e 1.1 @ BlitzAdapters
>>> ann_id = omero2pandas.upload_table(my_data, "test ann links", links=[("BooleanAnnotation", 3221), ("CommentAnnotation", 3222), ("DoubleAnnotation", 3223), ("FileAnnotation", 3224), ("ListAnnotation", 3225), ("LongAnnotation", 3226), ("MapAnnotation", 3227), ("TagAnnotation", 3228), ("TermAnnotation", 3229), ("TimestampAnnotation", 3230), ("XmlAnnotation", 3231)], omero_connector=client)
Inspecting table...:   0%|                                                                                                                                                                                                                     | 1/? rows, 00:00 WARNING:omero2pandas.upload:Limiting automatic chunk size to 50000 (was 285714)
Uploading table to OMERO: : 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 53/53 rows, 00:00 
>>> ann_id
3232

A dry-run deletion of the newly created FileAnnotation object confirms there are 11 associated AnnotationAnnotationLink:

$ omero delete --dry-run FileAnnotation:3232 --report
Using session for import.user@localhost:4064. Idle timeout: 10 min. Current group: Demo Group
omero.cmd.Delete2 FileAnnotation:3232 Dry run performed
ok
Steps: 4
Elapsed time: 0.104 secs.
Flags: []
Deleted objects
  AnnotationAnnotationLink:101-111
  FileAnnotation:3232
  OriginalFile:13162
  ExternalInfo:17033

@sbesson sbesson merged commit 0f8bf7a into glencoesoftware:main May 20, 2025
1 check passed
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.

3 participants