Skip to content

Instantly share code, notes, and snippets.

View atarkowska's full-sized avatar

Ola Tarkowska atarkowska

  • Cambridge, UK
View GitHub Profile
@atarkowska
atarkowska / rest_api.py
Last active September 15, 2016 14:09
Example of REST API usage. Load data from IDR
import requests
# put here project/screen ids
containers = (101,)
list_datasets_url = "http://idr-demo.openmicroscopy.org/webclient/api/datasets/?id={container_id}&page=0"
list_images_url = "http://idr-demo.openmicroscopy.org/webclient/api/images/?id={id}&page=1"
image_link = "http://idr-demo.openmicroscopy.org/webclient/?show=image-{id}"
image_viewer_link = "http://idr-demo.openmicroscopy.org/webclient/img_detail/{id}/"
thumbnail_url = "http://idr-demo.openmicroscopy.org/webclient/render_thumbnail/size/96/{id}/"
(dev_tools) MacBookPro:ansible ola$ ansible-playbook -i ../../management_tools/ansible/ci/ci-test-hosts -l 10.0.51.148 -vv -u centos ci-deployment.yml
Using /Users/ola/OMERO/SYSADMIN/infrastructure/ansible/ansible.cfg as config file
PLAYBOOK: ci-deployment.yml ****************************************************
4 plays in ci-deployment.yml
PLAY [ci-jenkins-linux] ********************************************************
TASK [setup] *******************************************************************
ok: [10.0.51.148]
bin/omero metadata populate --context deletemap Screen:3
bin/omero metadata populate --context deletemap Screen:102
bin/omero metadata populate --context deletemap Screen:51
bin/omero metadata populate --context deletemap Screen:202
bin/omero metadata populate --context deletemap Screen:597
bin/omero metadata populate --context deletemap Screen:751
bin/omero metadata populate --context deletemap Screen:253
bin/omero metadata populate --context deletemap Screen:201
bin/omero metadata populate --context deletemap Screen:154
bin/omero metadata populate --context deletemap Screen:206
@atarkowska
atarkowska / pre-commit
Created September 14, 2016 09:15
pre-commit hooks
#!/bin/sh
# automatically configured by git-annex
FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -e '\.py$')
if [ -n "$FILES" ]; then
if output=$(flake8 $FILES) && [ -z "$output" ]; then
echo 'Flake8 pass. Ready to commit.'
else
echo 'Flake8 errors.'
echo "$output"
@atarkowska
atarkowska / basic_python
Created October 27, 2016 06:07
bin/omero shell
(omero-virtualenv)bash-4.2$ bin/omero shell
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
Type "copyright", "credits" or "license" for more information.
IPython 1.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
select map.value, a.ns, count(i.id) from annotation as a
join annotation_mapvalue as map on a.id=map.annotation_id
join imageannotationlink as ial on ial.child=a.id
join image as i on i.id=ial.parent
where
map.name in ('Gene Symbol', 'Gene Identifier', 'Phenotype', 'siRNA Identifier', 'siRNA Pool Identifier', 'Organism')
and a.ns like 'openmicroscopy.org/mapr/%'
group by map.value, a.ns
order by 3 DESC
limit 100
@atarkowska
atarkowska / gist:23a59883416ff7cc0d1a79e8e9db2a38
Last active November 17, 2016 11:38
populate thumbnails
import requests
COOKIE_NAME = "sessionid_demo3c"
HOST = "http://idr-clone.openmicroscopy.org"
INDEX_PAGE = "{host}/webclient".format(**{'host': HOST})
THUMBNAIL_URL = "{host}/webgateway/render_thumbnail/{image_id}/"
MAP_IMAGE_URL = "{host}/webclient/api/annotations/?type=map&image={image_id}"
def prepare_url(url, params={}):
+ docker-compose -f test/docker-compose.yml up --build --abort-on-container-exit
WARNING: The SKIP_UPGRADE_CHECK variable is not set. Defaulting to a blank string.
WARNING: The OMEROBUILD variable is not set. Defaulting to a blank string.
Building omeroserver
Step 1 : FROM openmicroscopy/omero-ssh-daemon-c7:0.1.1
---> 02e6d0e5628d
Step 2 : MAINTAINER [email protected]
---> Using cache
---> 4408ec196df0
Step 3 : RUN yum install -y epel-release && yum clean all
SELECT
count (distinct mv.value), mv.name, (substring(mv.value from '(https?://([^/]*){1})')) as url
FROM
annotation_mapvalue as mv
WHERE
(substring(mv.value from '(https?://([^/]*){1})')) is not null
GROUP BY mv.name, url
ORDER BY 2;
@atarkowska
atarkowska / gist:2b32e36ff1c03a2d86dc6c20703a9ed2
Created February 1, 2017 16:37
review populate metadata based on event log
select el.*, ev.* from eventlog as el
inner join event as ev on (el.event=ev.id)
inner join wellannotationlink as wal on (wal.id = el.entityid)
inner join well as w on (wal.parent=w.id)
inner join plate as p on (w.plate=p.id)
inner join screenplatelink as spl on (spl.child=p.id)
where ev."time" > '2017-01-31 16:00:00.000'
and spl.parent = 1203
and el.action != 'REINDEX'
and el.entitytype = 'ome.model.annotations.WellAnnotationLink'