Examples of RecordModel


Examples of pedro.model.RecordModel

            // This is a bit tricky as this branch of the tree has already been partially
            // populated by the GAL file loader

            // Put the raw MDB file as a child of the current node.
            // First get a complete copy of the current node
            final RecordModel array = node.getRecordModel();
            array.setValue( "equipment_file_name", file.getAbsolutePath(), false ); //$NON-NLS-1$

            // Go through the stored model and find the appropriate recording for each spot node at this scope is an Assay
            final NodeUtils nodeUtils = new NodeUtils();

            // Need the microscope recording object here in order to add a microscope:
          MicroscopeRecording recording =null;
         
          String lensNA =""; //$NON-NLS-1$
          String mag=""; //$NON-NLS-1$
          String lensName=""; //$NON-NLS-1$
            // Need to precompute the total number of spots on each dish and cache this   
            final int numberOfDishes = nodeUtils.getIntegerFieldValue( node, "numberOfDishes" ); //$NON-NLS-1$

            for( int i = 0; i < numberOfDishes; i++ )
            {
              final String dishDisplayName = "DISH:-" + ( i + 1 ); //$NON-NLS-1$

              RecordModel microscopeRecordModel = recordModelFactory.createRecordModel( "Microscope" ); //$NON-NLS-1$
              for( Enumeration assayChildren = node.children(); assayChildren.hasMoreElements(); )
              {
                NavigationTreeNode dishNode = (NavigationTreeNode)assayChildren.nextElement();

                if( dishNode.getDisplayName().trim().equals( dishDisplayName ) )
                {     
                  // should have got the appropriate dish by here
                  // Get number of rows/columns from this dish, as each dish could be different :-(
                  final int rows = nodeUtils.getIntegerFieldValue( dishNode, "numberOfRows" ); //$NON-NLS-1$
                  final int columns = nodeUtils.getIntegerFieldValue( dishNode, "numberOfColumns" ); //$NON-NLS-1$

                  final List selectedSpots = new ArrayList();
                  final Collection deselectedSpots = new ArrayList();

                  for( Enumeration spotNodes = dishNode.children(); spotNodes.hasMoreElements(); )
                  {
                    final NavigationTreeNode spotNode = (NavigationTreeNode)spotNodes.nextElement();
                    final int rowNumber = nodeUtils.getIntegerFieldValue( spotNode, "row" ); //$NON-NLS-1$
                    final int columnNumber = nodeUtils.getIntegerFieldValue( spotNode, "column" ); //$NON-NLS-1$

                    final Collection plasmids = new ArrayList();
                    final Spot spot = new Spot( new SpotReading( plasmids, plasmids ) );
                    spot.setRow( rowNumber );
                    spot.setColumn( columnNumber );

                    selectedSpots.add( spot );
                  }

                  // Ask the user about which spots they asked the microscope to track
                  getTrackedSpots( rows, columns, recordings.size(), selectedSpots, deselectedSpots );

                  final boolean deleteNonTrackedSpots = ( deselectedSpots.size() > 0 ) ? deleteNonTrackedSpots() : false;

                  for( Enumeration spotNodes = dishNode.children(); spotNodes.hasMoreElements(); )
                  {
                    final NavigationTreeNode spotNode = (NavigationTreeNode)spotNodes.nextElement();

                    if( spotNode.getDisplayName().trim().startsWith( "SPOTREADING" ) ) //$NON-NLS-1$
                    {
                      final int rowNumber = nodeUtils.getIntegerFieldValue( spotNode, "row" ); //$NON-NLS-1$
                      final int columnNumber = nodeUtils.getIntegerFieldValue( spotNode, "column" ); //$NON-NLS-1$

                      // Now get the appropriate Microscope model and add it to this spot:
                      recording = getRecording( recordings, selectedSpots, rowNumber, columnNumber );
                      final RecordModel spotRecordModel = spotNode.getRecordModel();         

                      if( recording != null )
                      {         
                        //$NON-NLS-1$   

                        lensNA=recording.getLensNA();
                        lensName=recording.getLensName();
                        mag=recording.getMagnification();

                        for( Iterator iterator = recording.getTracks().iterator(); iterator.hasNext(); )
                        {
                          addTrack( (UniqueObject)iterator.next(), recordModelFactory, spotRecordModel );
                        }

                        for( Iterator iterator = recording.getLasers().iterator(); iterator.hasNext(); )
                        {
                          addLaser( (Laser)iterator.next(), recordModelFactory, spotRecordModel );
                        }

                        spotRecordModel.setValue( "acquisition_time", recording.getAquisitionTime(), false ); //$NON-NLS-1$
                        spotRecordModel.updateDisplayName();

                        for( Iterator iterator = spotRecordModel.getFields().iterator(); iterator.hasNext(); )
                        {
                          final DataFieldModel dataFieldModel = (DataFieldModel)iterator.next();

                          if( dataFieldModel.getName().trim().equals( "Microscope" ) ) //$NON-NLS-1$
                          {
                            spotRecordModel.removeField( dataFieldModel )
                          }
                        }

                        // TODO: Work out why Microscope cannot be added.
                        // spotRecordModel.addChild( "Microscope", microscopeRecordModel, false ); //$NON-NLS-1$

                        // Add Results stub to this spot reading
                        final RecordModel resultRecordModel = recordModelFactory.createRecordModel( "Result" ); //$NON-NLS-1$

                        resultRecordModel.setValue( "results_file", recording.getName(), false ); //$NON-NLS-1$
                        resultRecordModel.updateDisplayName();

                        spotRecordModel.addChild( "Result", resultRecordModel, false ); //$NON-NLS-1$
                        spotRecordModel.updateDisplayName();         
                      }
                      else if( deleteNonTrackedSpots )
                      {
                        final NavigationTreeNode parentNode = (NavigationTreeNode)spotNode.getParent();
                        final RecordModel parentRecordModel = parentNode.getRecordModel();

                        for( Iterator iterator = parentRecordModel.getFields().iterator(); iterator.hasNext(); )
                        {
                          final DataFieldModel dataFieldModel = (DataFieldModel)iterator.next();

                          if( dataFieldModel.getName().trim().equals( "SpotReading" ) ) //$NON-NLS-1$
                          {
                            if( dataFieldModel instanceof ListFieldModel )
                            {
                              final ListFieldModel listFieldModel = (ListFieldModel)dataFieldModel;
                              listFieldModel.removeChild( spotRecordModel );
                            }
                          }
                        }
                      }
                    }
                    dishNode.updateDisplayName( (DefaultTreeModel)navigationTree.getModel() );
                  }
                }
                RecordModel dishRecordModel = dishNode.getRecordModel();
                addObjectiveDetails( lensName, lensNA, mag, recordModelFactory, microscopeRecordModel );
                dishRecordModel.addChild("Microscope", microscopeRecordModel, false); //$NON-NLS-1$
                dishNode.updateDisplayName( (DefaultTreeModel)navigationTree.getModel() );
              }

            }
            array.updateDisplayName();
View Full Code Here

Examples of pedro.model.RecordModel

     * @param recordModelFactory
     * @param microscopeRecordModel
     */
    public void addObjectiveDetails( String n, String l, String m, final RecordModelFactory recordModelFactory, RecordModel microscopeRecordModel )
    {
      final RecordModel objectiveRecordModel = recordModelFactory.createRecordModel( "Objective_Details" ); //$NON-NLS-1$
      objectiveRecordModel.setValue( "name", n, false ); //$NON-NLS-1$
      objectiveRecordModel.setValue( "lensNA", l, false ); //$NON-NLS-1$
      objectiveRecordModel.setValue( "magnification", m, false ); //$NON-NLS-1$
      objectiveRecordModel.updateDisplayName();
     
      microscopeRecordModel.addChild( "Objective_Details", objectiveRecordModel, false ); //$NON-NLS-1$
    }
View Full Code Here

Examples of pedro.model.RecordModel

     * @param recordModelFactory
     * @param spotRecordModel
     */
    private void addTrack( final UniqueObject track, final RecordModelFactory recordModelFactory, RecordModel spotRecordModel )
    {
      final RecordModel trackRecordModel = recordModelFactory.createRecordModel( "Track" ); //$NON-NLS-1$
    trackRecordModel.setValue( "id",  track.getId(), false ); //$NON-NLS-1$
    trackRecordModel.setValue( "name",  track.getId(), false ); //$NON-NLS-1$
    trackRecordModel.updateDisplayName();
   
    spotRecordModel.addChild( "Track", trackRecordModel, false ); //$NON-NLS-1$
    spotRecordModel.updateDisplayName();
    }
View Full Code Here

Examples of pedro.model.RecordModel

     * @param recordModelFactory
     * @param spotRecordModel
     */
    private void addLaser( final Laser laser, final RecordModelFactory recordModelFactory, RecordModel spotRecordModel )
    {
      final RecordModel excitationMeasurementRecordModel = recordModelFactory.createRecordModel("Excitation_Measurement"); //$NON-NLS-1$
    excitationMeasurementRecordModel.setValue( "value", String.valueOf( laser.getPower() ), false ); //$NON-NLS-1$
    excitationMeasurementRecordModel.setValue( "unit", String.valueOf( "nM "), false ); //$NON-NLS-1$ //$NON-NLS-2$
    excitationMeasurementRecordModel.updateDisplayName();
   
    final RecordModel laserRecordModel = recordModelFactory.createRecordModel( "Laser" ); //$NON-NLS-1$
    laserRecordModel.setValue( "id",  laser.getId(), false ); //$NON-NLS-1$
    laserRecordModel.addChild( "Excitation_Measurement", excitationMeasurementRecordModel, false ); //$NON-NLS-1$
    laserRecordModel.updateDisplayName();
   
    final RecordModel excitationRecordModel = recordModelFactory.createRecordModel( "Excitation" ); //$NON-NLS-1$
    excitationRecordModel.addChild("Excitation_choices", laserRecordModel, false); //$NON-NLS-1$
    excitationRecordModel.updateDisplayName();
   
    spotRecordModel.addChild( "Excitation", excitationRecordModel, false ); //$NON-NLS-1$
    spotRecordModel.updateDisplayName();
    }
View Full Code Here

Examples of pedro.model.RecordModel

   * (non-Javadoc)
   * @see org.mcisb.pedro.beacon.ResultsParser#getFileInfoRecordModel()
   */
  protected RecordModel getFileInfoRecordModel()
  {
    final RecordModel fileInfoRecordModel = recordModelFactory.createRecordModel( "File_Info" ); //$NON-NLS-1$
   
    // Get the FileInfo
    final Element fileInfoElement = XmlUtils.getFirstElement( root, "File_Info" ); //$NON-NLS-1$

    if( fileInfoElement != null )
View Full Code Here

Examples of pedro.model.RecordModel

   * (non-Javadoc)
   * @see org.mcisb.pedro.beacon.ResultsParser#getTimeSeriesRecordModel()
   */
  protected RecordModel getTimeSeriesRecordModel()
  {
    final RecordModel timeSeriesRecordModel = recordModelFactory.createRecordModel( "ResultTimeSeries" ); //$NON-NLS-1$

    // Get the actual results timeseries
    final Element timeSeriesElement = XmlUtils.getFirstElement( root, "ResultTimeSeries" ); //$NON-NLS-1$
   
    if( timeSeriesElement != null )
    {
      final NodeList resultStates = timeSeriesElement.getElementsByTagName( "ResultState" ); //$NON-NLS-1$
       
        for( int i = 0; i < resultStates.getLength(); i++ )
        {
        final Element resultStateElement = (Element)resultStates.item( i );
        final RecordModel resultStateRecordModel = recordModelFactory.createRecordModel("ResultState"); //$NON-NLS-1$
       
        pedroUtils.addElement( resultStateElement, resultStateRecordModel, "TimeStamp" ); //$NON-NLS-1$
 
        // Cells at this Timestamp
        final NodeList cells = resultStateElement.getElementsByTagName( "Cell" ); //$NON-NLS-1$
       
        for( int j = 0; j < cells.getLength(); j++ )
        {
            final Element cellElement = (Element)cells.item( j );
            final RecordModel cellRecordModel = recordModelFactory.createRecordModel( "Cell" ); //$NON-NLS-1$
 
            pedroUtils.addElement( cellElement, cellRecordModel, "name" ); //$NON-NLS-1$
 
            // Cellular compartments
            final NodeList cellularCompartments = cellElement.getElementsByTagName( "CellularCompartment" ); //$NON-NLS-1$
           
            for( int k = 0; k < cellularCompartments.getLength(); k++ )
            {
            final Element cellularCompartmentElement = (Element)cellularCompartments.item( k );
            final RecordModel cellularCompartmentRecordModel = recordModelFactory.createRecordModel( "CellularCompartment" ); //$NON-NLS-1$
         
            pedroUtils.addElement( cellularCompartmentElement, cellularCompartmentRecordModel, "name" ); //$NON-NLS-1$
            pedroUtils.addElement( cellularCompartmentElement, cellularCompartmentRecordModel, "Centroid" ); //$NON-NLS-1$
   
            // Cell Properties
            final NodeList cellProperties = cellElement.getElementsByTagName( "CellProperty" ); //$NON-NLS-1$
           
            if( cellProperties != null )
            {
                for( int l = 0; l < cellProperties.getLength(); l++ )
                {
                final Element cellPropertyElement = (Element)cellProperties.item(l);
                final RecordModel cellPropertyRecordModel = recordModelFactory.createRecordModel( "CellProperty" ); //$NON-NLS-1$
               
                pedroUtils.addElement( cellPropertyElement, cellPropertyRecordModel, "property_name" ); //$NON-NLS-1$
                pedroUtils.addElements( cellPropertyElement, cellPropertyRecordModel, recordModelFactory, "Channel", Arrays.asList( new String[] { "channel_name", "channel_intensity" } ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     
                cellularCompartmentRecordModel.addChild( "CellProperty", cellPropertyRecordModel, false ); //$NON-NLS-1$
                cellularCompartmentRecordModel.updateDisplayName()
                }
            }
   
            // Polygon
            final Element polygon = XmlUtils.getFirstElement( cellularCompartmentElement, "Polygon" ); //$NON-NLS-1$
           
            if( polygon != null )
            {
              final Element exteriorElement = XmlUtils.getFirstElement( polygon, "exterior" ); //$NON-NLS-1$
              final Element linearRingElement = XmlUtils.getFirstElement( exteriorElement, "LinearRing" ); //$NON-NLS-1$
                final RecordModel linearRingRecordModel = recordModelFactory.createRecordModel( "LinearRing" ); //$NON-NLS-1$
               
                pedroUtils.addElement( linearRingElement, linearRingRecordModel, "coordinates" ); //$NON-NLS-1$
             
                final RecordModel exteriorRecordModel = recordModelFactory.createRecordModel( "exterior" ); //$NON-NLS-1$
                exteriorRecordModel.addChild( "LinearRing", linearRingRecordModel, false ); //$NON-NLS-1$
               
                final RecordModel polygonRecordModel = recordModelFactory.createRecordModel( "Polygon" ); //$NON-NLS-1$
                polygonRecordModel.addChild( "exterior", exteriorRecordModel, false ); //$NON-NLS-1$
               
                cellularCompartmentRecordModel.addChild( "Polygon", polygonRecordModel, false ); //$NON-NLS-1$
           
   
            cellRecordModel.addChild( "CellularCompartment", cellularCompartmentRecordModel, false ); //$NON-NLS-1$
View Full Code Here

Examples of pedro.model.RecordModel

    }
    PlasmidChannelMatchDialog pcmd = new PlasmidChannelMatchDialog();
    String[] channelNames = (String[])cnames.toArray(new String[cnames.size()]);
    String[] plasmidOrder = pcmd.getPlasmidOrder(channelNames, plasmidNames);

    final RecordModel analysisResultsRecordModel = recordModelFactory.createRecordModel("AnalysisResults");
    for (int i=0; i<ar.getAnalysedCell().size(); i++) {
      //for each analysed cell...
      AnalysedCell ac = ar.getAnalysedCell().get(i);
      RecordModel analysedCellRecordModel = recordModelFactory.createRecordModel("AnalysedCell");
      analysedCellRecordModel.setValue("CellName", ac.getCellName(), false);
      if (ac.getPreStimPeriod()!=null) {
        analysedCellRecordModel.setValue("PreStimPeriod", ac.getPreStimPeriod().toString(),false);
      }
      for (int j=0; j<ac.getAnalysedChannel().size(); j++) {
        //for each analysed channel...
        AnalysedChannel aCh = ac.getAnalysedChannel().get(j);
        RecordModel analysedChannelRecordModel = recordModelFactory.createRecordModel("AnalysedChannel");
        analysedChannelRecordModel.setValue("ChannelName", aCh.getChannelName(), false);
        analysedChannelRecordModel.setValue("PlasmidName", plasmidOrder[j], false);
        for (int k=0; k<aCh.getPeak().size(); k++) {
          //For each peak...
          org.mcisb.beacon.model.Peak peak =aCh.getPeak().get(k);
          RecordModel peakRecordModel = recordModelFactory.createRecordModel("Peak");
          peakRecordModel.setValue("time", Double.toString(peak.getTime()), false);
          peakRecordModel.setValue("value", Double.toString(peak.getValue()), false);
          peakRecordModel.updateDisplayName();
          analysedChannelRecordModel.addChild("Peak", peakRecordModel, false);
          analysedChannelRecordModel.updateDisplayName();
        }
        if (aCh.getMaxPeak()!=null) {
          analysedChannelRecordModel.setValue("MaxPeak", aCh.getMaxPeak().toString(), false);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.