-
-
Save joshmoore/6c7f22c367a077d08b83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -u | |
FILE=$1 | |
shift; | |
# Define environement variables | |
HOST=${HOST:-localhost} | |
PORT=${PORT:-4064} | |
ROOT_PASSWORD=${ROOT_PASSWORD:-omero} | |
GROUP=${GROUP:-formats} | |
FORMAT=${FORMAT:-ome-tiff} | |
USER_PASSWORD=${USER_PASSWORD:-ome} | |
TICKET=${TICKET:-1} | |
# Create group and user (named after format to import) | |
bin/omero login -s $HOST -p $PORT -u root -w $ROOT_PASSWORD | |
bin/omero group add $GROUP --ignore-existing | |
bin/omero user add $FORMAT $FORMAT $FORMAT $GROUP -P ome --ignore-existing | |
bin/omero logout | |
# Login as format user | |
bin/omero login -s $HOST -p $PORT -u $FORMAT -w $USER_PASSWORD | |
# Create dataset named after ticket number | |
dataset=$(bin/omero obj new Dataset name="#$TICKET" description="http://trac.openmicroscopy.org/ome/ticket/$TICKET") | |
# Import the file into the dataset via in-place import (ln_s) | |
handle() { | |
bin/omero import -d $dataset -u $FORMAT \ | |
---file $TICKET.out ---errs $TICKET.err "$1" -- \ | |
--transfer=ln_s --checksum_algorithm=File-Size-64 | |
} | |
while read i; do handle "$i"; done < $FILE | |
# Logout | |
bin/omero logout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment