Package: omero-metadata
OMERO metadata pluginPlugin for use in the OMERO CLI. Provides tools for bulk
management of annotations on objects in OMERO.RequirementsOMERO 5.6.0 or newerPython 3.6 or newerInstalling from PyPIThis section assumes that an OMERO.py is already installed.Install the command-line tool usingpip:$ pip install -U omero-metadataNote the original version of this code is still available as deprecated code in
version 5.4.x of OMERO.py. When using the CLI metadata plugin, theOMERO_DEV_PLUGINSenvironment variable should not be set to prevent
conflicts when importing the Python module.UsageThe plugin is called from the command-line using theomero metadatacommand:$ omero metadata <subcommand>Help for each command can be shown using the-hflag.
Objects can be specified as arguments in the formatClass:ID, such
asProject:123.Bulk-annotations are HDF-based tables with the NSBULKANNOTATION
namespace, sometimes referred to as OMERO.tables.Available subcommands are:allanns: Provide a list of all annotations linked to the given objectbulkanns: Provide a list of the NSBULKANNOTATION tables linked to the given objectmapanns: Provide a list of all MapAnnotations linked to the given objectmeasures: Provide a list of the NSMEASUREMENT tables linked to the given objectoriginal: Print the original metadata in ini formatpixelsize: Set physical pixel sizepopulate: Add metadata (bulk-annotations) to an object (see below)rois: Manage ROIssummary: Provide a general summary of available metadatatesttables: Tests whether tables can be created and initializedpopulateThis command creates anOMERO.table(bulk annotation) from aCSVfile and links
the table as aFile Annotationto a parent container such as Screen, Plate, Project,
Dataset or Image. It also attempts to convert Image, Well or ROI names from theCSVinto
object IDs in theOMERO.table.TheCSVfile must be provided as local file with--filepath/to/file.csv.OMERO.tables have defined column types to specify the data-type such asdoubleorlongand special object-types of each column for storing OMERO object IDs such asImageColumnorWellColumn.The default behaviour of the script is to automatically detect the column types from an inputCSV. This behaviour works as follows:Columns named with a supported object-type (e.g.plate,well,image,dataset, orroi), with<object> idor<object> namewill generate the corresponding column type in the OMERO.table. See table below for full list of supported column names.Column NameColumn typeDetected Header TypeNotesImageImageColumnimageAccepts image IDs. Appends new ‘Image Name’ column with image names.Image NameStringColumnsAccepts image names. Appends new ‘Image’ column with image IDs.Image IDImageColumnimageAccepts image IDs. Appends new ‘Image Name’ column with image names.DatasetDatasetColumndatasetAccepts dataset IDs.Dataset NameStringColumnsAccepts dataset names.Dataset IDDatasetColumndatasetAccepts dataset IDs.PlatePlateColumnplateAccepts plate names. Adds new ‘Plate’ column with plate IDs.Plate NamePlateColumnplateAccepts plate names. Adds new ‘Plate’ column with plate IDs.Plate IDLongColumnlAccepts plate IDs.WellWellColumnwellAccepts well names. Adds new ‘Well’ column with well IDs.Well NameWellColumnwellAccepts well names. Adds new ‘Well’ column with well IDs.Well IDLongColumnlAccepts well IDs.ROIRoiColumnroiAccepts ROI IDs. Appends new ‘ROI Name’ column with ROI names.ROI NameStringColumnsAccepts ROI names. Appends new ‘ROI’ column with ROI IDs.ROI IDRoiColumnroiAccepts ROI IDs. Appends new ‘ROI Name’ column with ROI names.Note: Column names are case insensitive. Space, no space, and underscore are all accepted as separators for column names (i.e.<object> name/<object> id`,<object>name/<object>id,<object>_name/<object>_idare all accepted)NB: Column names should not contain spaces if you want to be able to query by these columns.All other column types will be detected based on the column’s data using the pandas library. See table below.Column NameColumn typeDetected Header TypeExample StringStringColumnsExample LongLongColumnlExample FloatDoubleColumndExample booleanBoolColumnbIn the case of missing values, the column will be detected asStringColumnby default. If--allow-nanis passed to theomero metadata populatecommands, missing values in floating-point columns will be detected asDoubleColumnand the
missing values will be stored as NaN.However, it is possible to manually define the header types, ignoring the automatic header detection, if aCSVwith a# headerrow is passed. The# headerrow should be the first row of the CSV and defines columns according to the following list (see examples below):d:DoubleColumn, for floating point numbersl:LongColumn, for integer numberss:StringColumn, for textb:BoolColumn, for true/falseplate,well,image,dataset,roito specify objectsAutomatic header detection can also be ignored if using the--manual_headersflag. If the# headeris not present and this flag is used, column types will default toString(unless the column names correspond to OMERO objects such asimageorplate).ExamplesThe examples below will use the default automatic column types detection behaviour. It is possible to achieve the same results (or a different desired result) by manually adding a custom# headerrow at the top of the CSV.Project / DatasetTo add a table to a Project, theCSVfile needs to specifyDataset NameorDataset IDandImage NameorImage ID:$ omero metadata populate Project:1 --file path/to/project.csvUsingImage NameandDataset Name:project.csv:Image Name,Dataset Name,ROI_Area,Channel_Index,Channel_Name
img-01.png,dataset01,0.0469,1,DAPI
img-02.png,dataset01,0.142,2,GFP
img-03.png,dataset01,0.093,3,TRITC
img-04.png,dataset01,0.429,4,Cy5The previous example will create an OMERO.table linked to the Project as follows with
a newImagecolumn with IDs:Image NameDataset NameROI_AreaChannel_IndexChannel_NameImageimg-01.pngdataset010.04691DAPI36638img-02.pngdataset010.1422GFP36639img-03.pngdataset010.0933TRITC36640img-04.pngdataset010.4294Cy536641Note: equivalent to adding# header s,s,d,l,srow to the top of theproject.csvfor manual definition.UsingImage IDandDataset ID:project.csv:image id,Dataset ID,ROI_Area,Channel_Index,Channel_Name
36638,101,0.0469,1,DAPI
36639,101,0.142,2,GFP
36640,101,0.093,3,TRITC
36641,101,0.429,4,Cy5The previous example will create an OMERO.table linked to the Project as follows with
a newImage Namecolumn with Names:ImageDatasetROI_AreaChannel_IndexChannel_NameImage Name366381010.04691DAPIimg-01.png366391010.1422GFPimg-02.png366401010.0933TRITCimg-03.png366411010.4294Cy5img-04.pngNote: equivalent to adding# header image,dataset,d,l,srow to the top of theproject.csvfor manual definition.For both examples above, alternatively, if the target is a Dataset instead of a Project, theDatasetorDataset Namecolumn is not needed.Screen / PlateTo add a table to a Screen, theCSVfile needs to specifyPlatename andWell.
If a# headeris specified, column types must bewellandplate:$ omero metadata populate Screen:1 --file path/to/screen.csvscreen.csv:Well,Plate,Drug,Concentration,Cell_Count,Percent_Mitotic
A1,plate01,DMSO,10.1,10,25.4
A2,plate01,DMSO,0.1,1000,2.54
A3,plate01,DMSO,5.5,550,4
B1,plate01,DrugX,12.3,50,44.43This will create an OMERO.table linked to the Screen, with theWell NameandPlate Namecolumns added and theWellandPlatecolumns used for IDs:WellPlateDrugConcentrationCell_CountPercent_MitoticWell NamePlate Name91543855DMSO10.11025.4a1plate0191553855DMSO0.110002.54a2plate0191563855DMSO5.55504.0a3plate0191573855DrugX12.35044.43b1plate01If the target is a Plate instead of a Screen, thePlatecolumn is not needed.Note: equivalent to adding# header well,plate,s,d,l,drow to the top of thescreen.csvfor manual definition.ROIsIf the target is an Image or a Dataset, aCSVwith ROI-level or Shape-level data can be used to create anOMERO.table(bulk annotation) as aFile Annotationlinked to the target object.
If there is anroicolumn (header typeroi) containing ROI IDs, anRoi Namecolumn will be appended automatically (see example below). If a column of Shape IDs namedshapeof typelis included, the Shape IDs will be validated (and set to -1 if invalid).
Also if animagecolumn of Image IDs is included, anImage Namecolumn will be added.
NB: Columns of typeshapearen’t yet supported on the OMERO.server:$ omero metadata populate Image:1 --file path/to/image.csvimage.csv:Roi,shape,object,probability,area
501,1066,1,0.8,250
502,1067,2,0.9,500
503,1068,3,0.2,25
503,1069,4,0.8,400
503,1070,5,0.5,200This will create an OMERO.table linked to the Image like this:RoishapeobjectprobabilityareaRoi Name501106610.8250Sample1502106720.9500Sample2503106830.225Sample3503106940.8400Sample3503107050.5200Sample3Note: equivalent to adding# header roi,l,l,d,lrow to the top of theimage.csvfor manual definition.Alternatively, if the target is an Image, the ROI input column can beRoi Name(with types), and anroitype column will be appended containing ROI IDs.
In this case, it is required that ROIs on the Image in OMERO have theNameattribute set.Note that the ROI-level data from anOMERO.tableis not visible
in the OMERO.web UI right-hand panel under theTablestab,
but the table can be visualized by clicking the “eye” on the bulk annotation attachment on the Image.Developer installThis plugin can be installed from the source code with:$ cd omero-metadata
$ pip install .LicenseThis project, similar to many Open Microscopy Environment (OME) projects, is
licensed under the terms of the GNU General Public License (GPL) v2 or later.Copyright2018-2022, The Open Microscopy Environment and Glencoe Software, Inc