Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import omero
  2. from omero.rtypes import *
  3.  
  4.  
  5. host = "localhost"
  6. port = 4064
  7. userpass = "ome"
  8. user = "demo"
  9.  
  10. c = omero.client(host=host, port=port)
  11. s = c.createSession(user, userpass)
  12.  
  13. expId = 2 #s.getAdminService().getEventContext().userId
  14.  
  15. sql = """
  16. select count( distinct mv.value) as childCount
  17. from ImageAnnotationLink ial join ial.child a join a.mapValue mv
  18. join ial.parent i join i.datasetLinks dsl
  19. join dsl.parent ds join ds.projectLinks pl join pl.parent p
  20. where mv.name in (:filter) and a.ns in (:ns) and mv.value = :value
  21. """
  22.  
  23. p = omero.sys.ParametersI()
  24. p.addString("ns", "openmicroscopy.org/omero/bulk_annotations")
  25. p.addId(expId)
  26. p.add("filter", rlist([rstring("Gene Symbol")]))
  27. p.addString("value", "KIF11")
  28.  
  29. query = s.getQueryService()
  30. rv = query.projection(sql, p)
  31. rv = unwrap(rv)
  32. print rv[0][0]
  33.  
  34.  
  35. s.closeOnDestroy()
  36. c.closeSession()
  37. c.__del__()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement