[ome-users] issue and fix for MetaXpress multi-line descriptions
Mario Emmenlauer
mario at emmenlauer.de
Thu Mar 26 14:07:20 GMT 2015
Dear Bio-Formats developers,
I have a small issue with MetaXpress meta data, and a possible fix.
When I read the image (link below), there are several global metadata
entries that are not correct. I followed up where they come from, and
it turns out that MetaXpress has a free-text box where user can enter
a 'Description' for their screening experiment. Multi-line entry is
supported in MetaXpress, which leads to "wrong" interpretation of the
metadata in Bio-Formats.
Here the example from the image below. For the field 'Description'
our user had entered in MetaXpress:
siRNA transfection of HeLa cells
Entry 4h
extracellular: red
intracellular: red and green
DAPI staining (1:1000)
[...]
Of this Description, several lines are missing in Bio-Formats. For
the text that is not missing, I can find fields like:
'extracellular' 'red'
'intracellular' 'red and green'
'DAPI staining (1' '1000)'
This is not how I think the metadata should be reported :-)
The best solution I could think of is a defined vocabulary of keys
from MetaXpress, to separate them from the free-text entered by the
user. Attached is a patch that does exactly this, and works well
for me. The patch should apply smoothly to Bio-Formats 5.0.7 file
components/formats-gpl/src/loci/formats/in/MetamorphReader.java
For me, the patch achieves a second functionality: there are some
keys that do not have a colon, in other words they consist only of
a key and no value (an example is "Acquired from Photometrics"). For
me it makes sense to store them as both key and value, i.e. to have
it reported as:
'Acquired from Photometrics' = 'Acquired from Photometrics'
This is my personal preference, you can ignore this part of the patch
if you do not find it useful.
One last thing: I store the free-text in key 'Global Description'.
I think for you its more common to use the key 'Global Comment'? Feel
free to change this to your liking.
The image I used is here:
http://data.marssoft.de/bBZIX-021_wD13_s3_z0_t1_cCy5_u001.tif
All the best, and thanks for your great work,
Mario Emmenlauer
--
Mario Emmenlauer BioDataAnalysis Mobil: +49-(0)151-68108489
Balanstrasse 43 mailto: mario.emmenlauer * unibas.ch
D-81669 München http://www.marioemmenlauer.de/
-------------- next part --------------
diff --git a/components/formats-gpl/src/loci/formats/in/MetamorphHandler.java b/components/formats-gpl/src/loci/formats/in/MetamorphHandler.java
index c414150..57efb81 100644
--- a/components/formats-gpl/src/loci/formats/in/MetamorphHandler.java
+++ b/components/formats-gpl/src/loci/formats/in/MetamorphHandler.java
@@ -64,6 +64,15 @@ public class MetamorphHandler extends BaseHandler {
private String stageLabel;
private Double gain;
+ private String[] mDesciptionKeyList = {
+ "Plate Screen", "Acquired from Photometrics", "Barcode:",
+ "Experiment base name:", "Experiment set:", "Exposure:",
+ "Binning:", "Region:", "Subtract:", "Shading:", "Digitizer:",
+ "Gain:", "Camera Shutter:", "Clear Count:", "Clear Mode:",
+ "Frames to Average:", "Trigger Mode:", "Temperature:"
+ };
+
+
// -- Constructor --
public MetamorphHandler() {
@@ -130,6 +139,8 @@ public class MetamorphHandler extends BaseHandler {
String k = null, v = null;
if (value.indexOf(delim) != -1) {
+ String vDescription = null;
+
int currentIndex = -delim.length();
while (currentIndex != -1) {
currentIndex += delim.length();
@@ -144,14 +155,46 @@ public class MetamorphHandler extends BaseHandler {
}
currentIndex = nextIndex;
- int colon = line.indexOf(":");
- if (colon != -1) {
- k = line.substring(0, colon).trim();
- v = line.substring(colon + 1).trim();
- if (metadata != null) metadata.put(k, v);
- checkKey(k, v);
+ if (line.isEmpty()) {
+ continue;
+ }
+
+ // We use a dictionary to identify the standard MetaMorph keys:
+ boolean vLineIsMetaMorphStandard = false;
+ for (String vDescriptionKey : mDesciptionKeyList) {
+ if (line.startsWith(vDescriptionKey)) {
+ vLineIsMetaMorphStandard = true;
+ break;
+ }
+ }
+ if (vLineIsMetaMorphStandard) {
+ // The majority of tags can be split at the colon:
+ int colon = line.indexOf(":");
+ if (colon != -1) {
+ k = line.substring(0, colon).trim();
+ v = line.substring(colon + 1).trim();
+ if (metadata != null) metadata.put(k, v);
+ checkKey(k, v);
+ } else {
+ // There was no colon, so the key is a full line:
+ k = line.trim();
+ v = line.trim();
+ if (metadata != null) metadata.put(k, v);
+ checkKey(k, v);
+ }
+ } else {
+ // This is NOT a standard tag in the description field, so it
+ // must be a multi-line description from the user (i.e. from
+ // the MetaXpress free-text "Description" field in the screening
+ // application).
+ if (vDescription == null) {
+ vDescription = line;
+ } else {
+ vDescription = vDescription + "\n" + line;
+ }
}
}
+ if (metadata != null && vDescription != null) metadata.put("Description", vDescription);
}
else {
int colon = value.indexOf(":");
More information about the ome-users
mailing list