Wednesday, August 20, 2008

MetWare screenshot: spectrum support

Not visually attractive, but that will be solved when Steffen gets his hands on it. For now, I'm happy with a table formatting. Reason: it uses XML Schema to define a dataType, which is recognized by our code generators in MetWare (see also this presentation), and used to create a easy to use Java API, which, in turn, can be used in this JSF snippet:
<h:dataTable value="#{metobservCharacterizationMassspectrum.spectralPoints.points}" var="specpoint">
<f:facet name="header"><h:outputText value="m/z's"/></f:facet>
<h:outputText value="#{}"/>
<f:facet name="header"><h:outputText value="Intensities"/></f:facet>
<h:outputText value="#{specpoint.intensity}"/>
The <dataTable> @value point (via the faces-config.xml) to the MetobservCharacterizationMassspectrumBean, which has a getSpectralPoints() method (autocreated from the <skos:Concept> SpectralPoints, which has a convenience method List<SpectralPoint> getPoints().

SpectralPoint in turn has the methods getIntensity() and getMz() also used in the above JSF snippet. For convenience, SpectralPointArray also has two other methods: double[] getIntensities() and double[] getMzs() (which I'll have to rename to reuse the code for NMR support :).

So, here's the outcome:

Final note, given the dataType, the MetWare bean also has the logic to convert the data back and forth into a SQL serialization, which may eventually use base64 encoding, but currently looks like 61.0,100.0;62.0,1.1, as defined by the regular expression of the XSD dataType for spectralPointArray.