Skip to content

Instantly share code, notes, and snippets.

@joshmoore
joshmoore / imagesc.py
Created Nov 2, 2022
Simple CLI for querying image.sc for certain tags
View imagesc.py
#!/usr/bin/env python
from argparse import (
ArgumentParser,
FileType,
)
from collections import (
defaultdict,
)
from datetime import (
@joshmoore
joshmoore / issues.md
Created Jan 26, 2022
Open zarr issues (2022-01-26)
View Register_in_iRODS.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import omero.scripts as scripts
client = scripts.client(
'Register_in_iRODS.py',
scripts.Long("Image_ID", optional=False),
scripts.String("Logical_Path", optional=False),
View test_collections.py
from pyshacl import validate
from rdflib import Graph
import pytest
import json
def assert_graph(shacl, graph, valid=True):
s = Graph().parse(data=shacl, format="turtle")
d = Graph().parse(data=graph, format="json-ld")
View test.py
#!/usr/bin/env python
"""
<Image ID="Image:0" Name="image_0000247585 (R0)">
<AcquisitionDate>2020-01-15T06:29:11.537</AcquisitionDate>
<Description>Collection ImageCollection__0000042467</Description>
<InstrumentRef ID="Instrument:0"/>
<ObjectiveSettings ID="Objective:0:0"/>
<Pixels BigEndian="false" DimensionOrder="XYCZT" ID="Pixels:0" Interleaved="false" PhysicalSizeX="16.438446163366336" PhysicalSizeXUnit="µm" PhysicalSizeY="16.438446015424162" PhysicalSizeYUnit="µm" SignificantBits="8" SizeC="3" SizeT="1" SizeX="1616" SizeY="4668" SizeZ="1" Type="uint8">
<Channel ID="Channel:0:0" IlluminationType="Transmitted" SamplesPerPixel="3">
@joshmoore
joshmoore / run.sh
Last active Apr 1, 2019
OMERO DropBox Test
View run.sh
docker run -ti --rm --entrypoint=python -v $PWD:/dropbox openmicroscopy/omero-server /dropbox/test.py
@joshmoore
joshmoore / Dockerfile
Last active Aug 17, 2018
OMERO ubuntu/docker test
View Dockerfile
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
env OMERO_OPT_DIR=/opt/omero
RUN apt-get update
@joshmoore
joshmoore / example.txt
Created Aug 16, 2018
Simple search test
View example.txt
$ NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
$ echo $NEW_UUID
rGS3QV3NpsCjT1Jei643raLebi3Io2S7
$ bin/omero -q obj new Dataset name=$NEW_UUID
Dataset:1
$ bin/omero search Dataset $NEW_UUID
Using session for root@localhost:4064. Idle timeout: 10 min. Current group: system
# | Class | Id | name | details
View get_idr_annotations.py
from fileinput import input
import requests
# cat image ids to this script to loop over annotations
# e.g.: cut -f2 image_ids.tsv | python get_idr_annotations.py
def connect():
import omero
from omero.gateway import BlitzGateway
from omero.sys import ParametersI
View query.py
import omero
compounds = unwrap(q.projection(("select distinct mv1.value, mv2.value from Image i "
"join i.annotationLinks l1 join l1.child as a1 join a1.mapValue as mv1 "
"join i.annotationLinks l2 join l2.child as a2 join a2.mapValue as mv2 "
"join i.wellSamples ws join ws.well w join w.plate p "
"where p.id = 4403 and mv1.name = 'Product Use Annotation' and mv2.name = 'Compound Name'"), None))