Skip to content
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

List image magnification in IDR API #149

Open
gwaybio opened this issue Nov 22, 2021 · 2 comments
Open

List image magnification in IDR API #149

gwaybio opened this issue Nov 22, 2021 · 2 comments

Comments

@gwaybio
Copy link

gwaybio commented Nov 22, 2021

Thanks for your helpful pointers in #147, I have another API-related question :)

Is there a way for me to pull microscopy image magnification from the API?

I imagine this info would have been in the image annotations endpoint (see example below), but I am not readily seeing it. I also did not see this mentioned in the API docs. Maybe magnification exists in another API section?

Thanks!
Greg

MAP_URL = f"https://idr.openmicroscopy.org/webclient/api/annotations/?type=map&image={rand_image}"

annotations = session.get(MAP_URL).json()["annotations"]

print(annotations)

[{'id': 6625160,
  'ns': 'openmicroscopy.org/mapr/gene',
  'description': None,
  'owner': {'id': 2},
  'date': '2016-12-13T23:05:19+00:00',
  'permissions': {'canDelete': False,
   'canAnnotate': False,
   'canLink': False,
   'canEdit': False},
  'link': {'id': 22801231,
   'owner': {'id': 2},
   'parent': {'id': 14529,
    'class': 'ImageI',
    'name': 'DTT p1 [Well 77, Field 1 (Spot 229)]'},
   'date': '2016-12-13T23:05:19+00:00',
   'permissions': {'canDelete': False,
    'canAnnotate': False,
    'canLink': False,
    'canEdit': False}},
  'class': 'MapAnnotationI',
  'values': [['Gene Identifier', 'YNL106C'],
   ['Gene Identifier URL', 'https://www.yeastgenome.org/locus/YNL106C'],
   ['Gene Symbol', 'INP52']]},
 {'id': 6625787,
  'ns': 'openmicroscopy.org/mapr/organism',
  'description': None,
  'owner': {'id': 2},
  'date': '2016-12-13T23:06:04+00:00',
  'permissions': {'canDelete': False,
   'canAnnotate': False,
   'canLink': False,
   'canEdit': False},
  'link': {'id': 22834937,
   'owner': {'id': 2},
   'parent': {'id': 14529,
    'class': 'ImageI',
    'name': 'DTT p1 [Well 77, Field 1 (Spot 229)]'},
   'date': '2016-12-13T23:06:35+00:00',
   'permissions': {'canDelete': False,
    'canAnnotate': False,
    'canLink': False,
    'canEdit': False}},
  'class': 'MapAnnotationI',
  'values': [['Organism', 'Saccharomyces cerevisiae']]},
 {'id': 6626243,
  'ns': 'openmicroscopy.org/mapr/phenotype',
  'description': None,
  'owner': {'id': 2},
  'date': '2016-12-13T23:09:03+00:00',
  'permissions': {'canDelete': False,
   'canAnnotate': False,
   'canLink': False,
   'canEdit': False},
  'link': {'id': 22918669,
   'owner': {'id': 2},
   'parent': {'id': 14529,
    'class': 'ImageI',
    'name': 'DTT p1 [Well 77, Field 1 (Spot 229)]'},
   'date': '2016-12-13T23:09:04+00:00',
   'permissions': {'canDelete': False,
    'canAnnotate': False,
    'canLink': False,
    'canEdit': False}},
  'class': 'MapAnnotationI',
  'values': [['Phenotype', 'GFP localization: punctate'],
   ['Phenotype Term Name', 'protein localized in punctate foci phenotype'],
   ['Phenotype Term Accession', 'CMPO_0000400'],
   ['Phenotype Term Accession URL',
    'http://www.ebi.ac.uk/cmpo/CMPO_0000400']]},
 {'id': 6631107,
  'ns': 'openmicroscopy.org/omero/bulk_annotations',
  'description': None,
  'owner': {'id': 2},
  'date': '2016-12-13T23:14:34+00:00',
  'permissions': {'canDelete': False,
   'canAnnotate': False,
   'canLink': False,
   'canEdit': False},
  'link': {'id': 23067151,
   'owner': {'id': 2},
   'parent': {'id': 14529,
    'class': 'ImageI',
    'name': 'DTT p1 [Well 77, Field 1 (Spot 229)]'},
   'date': '2016-12-13T23:14:34+00:00',
   'permissions': {'canDelete': False,
    'canAnnotate': False,
    'canLink': False,
    'canEdit': False}},
  'class': 'MapAnnotationI',
  'values': [['Strain', 'Y6545'],
   ['Environmental Stress', 'dithiothreitol'],
   ['Channels',
    'H2B-mCherry:cytosol;GFP:tagged protein;bright field/transmitted:cell'],
   ['Has Phenotype', 'yes'],
   ['Phenotype Annotation Level', 'experimental condition and gene']]}]
@will-moore
Copy link
Member

Hi Greg,
I'm afraid this data isn't available via any JSON api currently.
The webclient code that loads Image acquisition metadata is some of the older code there, and all the html is rendered on the server.
E.g. https://idr.openmicroscopy.org/webclient/metadata_acquisition/image/11514301/

The code that loads the data from OMERO and renders that page is at https://github.com/ome/omero-web/blob/394e75170f5d6e9997edf12f6906c489186d5f22/omeroweb/webclient/views.py#L1834
It creates a context dict, but unfortunately we can't simply dump that to JSON as it includes a bunch of objects (Django forms etc) that aren't JSON serializable.

But please create an issue on omero-web repo for supporting acquisition metadata as JSON.
Regards,
Will.

@will-moore
Copy link
Member

It occurred to me that another way you could get the data from IDR, while you're waiting on ome/omero-web#336 is to use the OMERO python api (see https://docs.openmicroscopy.org/omero/5.6.3/developers/Python.html) with the code samples I added to that PR. If that seems viable for you I can give you some more pointers as the PR is unlikely to be available on IDR for a while.

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

No branches or pull requests

2 participants