Skip to content

Instantly share code, notes, and snippets.

@joshmoore
joshmoore / 1_export.py
Created February 28, 2024 15:02
GBIF Occurrence Map Generation
from pyspark.sql import SQLContext
from pyspark.sql.functions import pow, lit
from pyspark.sql.types import LongType
from pyspark.sql.functions import col, SparkContext
# Primary argument: how much to truncate the long & lat
num_places = 1
# https://data-blog.gbif.org/post/aws-and-gbif/
# Download and unzip one of the files
@joshmoore
joshmoore / imagesc.py
Created November 2, 2022 13:30
Simple CLI for querying image.sc for certain tags
#!/usr/bin/env python
from argparse import (
ArgumentParser,
FileType,
)
from collections import (
defaultdict,
)
from datetime import (
@joshmoore
joshmoore / issues.md
Created January 26, 2022 11:35
Open zarr issues (2022-01-26)
#!/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),
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")
#!/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 April 1, 2019 15:46
OMERO DropBox Test
docker run -ti --rm --entrypoint=python -v $PWD:/dropbox openmicroscopy/omero-server /dropbox/test.py
@joshmoore
joshmoore / Dockerfile
Last active August 17, 2018 16:18
OMERO ubuntu/docker test
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 August 16, 2018 09:03
Simple search test
$ 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
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