Changeset 2392


Ignore:
Timestamp:
Jun 16, 2006, 4:09:02 PM (16 years ago)
Author:
Nicklas Nordborg
Message:

References #150: Affymetrix support
Changes to RawDataType? to allow types which stores data in files => Lots of downstream
changes to plot functions, filter functions, etc.
Allow CEL files to be connected to RawBioAssay?

Location:
trunk
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/DynamicUtil.java

    r2304 r2392  
    6868  public static void addRawDataColumns(List<TableColumn> columns, RawDataType rawDataType, String idPrefix, String propertyPrefix, String titlePrefix)
    6969  {
    70     columns.add(new TableColumn(idPrefix + "position", propertyPrefix+"position", "raw('position')", Type.INT, titlePrefix+"Position", "Raw spot position"));
    71     columns.add(new TableColumn(idPrefix + "block", propertyPrefix+"block", "raw('block')", Type.INT, titlePrefix+"Block", "Block number"));
    72     columns.add(new TableColumn(idPrefix + "metaGridX", propertyPrefix+"metaGridX", "raw('metaGridX')", Type.INT, titlePrefix+"Meta grid X", "Meta X coordinate"));
    73     columns.add(new TableColumn(idPrefix + "metaGridY", propertyPrefix+"metaGridY", "raw('metaGridY')", Type.INT, titlePrefix+"Meta grid Y", "Meta Y coordinate"));
    74     columns.add(new TableColumn(idPrefix + "row", propertyPrefix+"row", "raw('row')", Type.INT, titlePrefix+"Row", "Row number"));
    75     columns.add(new TableColumn(idPrefix + "column", propertyPrefix+"column", "raw('column')", Type.INT, titlePrefix+"Column", "Column number"));
    76     columns.add(new TableColumn(idPrefix + "x", propertyPrefix+"x", "raw('x')", Type.INT, titlePrefix+"X", "X coordinate"));
    77     columns.add(new TableColumn(idPrefix + "y", propertyPrefix+"y", "raw('y')", Type.INT, titlePrefix+"Y", "Y coordinate"));
    78 
    79     List<RawDataProperty> rdpList = rawDataType.getProperties();
    80     for(RawDataProperty rdp : rdpList)
     70    if (rawDataType.isStoredInDb())
    8171    {
    82       String rdpName = rdp.getName();
    83       columns.add(new TableColumn(idPrefix+rdpName, propertyPrefix+rdpName, "raw('"+rdpName+"')", rdp.getType(),
    84           titlePrefix + rdp.getTitle(), rdp.getDescription()));
     72      columns.add(new TableColumn(idPrefix + "position", propertyPrefix+"position", "raw('position')", Type.INT, titlePrefix+"Position", "Raw spot position"));
     73      columns.add(new TableColumn(idPrefix + "block", propertyPrefix+"block", "raw('block')", Type.INT, titlePrefix+"Block", "Block number"));
     74      columns.add(new TableColumn(idPrefix + "metaGridX", propertyPrefix+"metaGridX", "raw('metaGridX')", Type.INT, titlePrefix+"Meta grid X", "Meta X coordinate"));
     75      columns.add(new TableColumn(idPrefix + "metaGridY", propertyPrefix+"metaGridY", "raw('metaGridY')", Type.INT, titlePrefix+"Meta grid Y", "Meta Y coordinate"));
     76      columns.add(new TableColumn(idPrefix + "row", propertyPrefix+"row", "raw('row')", Type.INT, titlePrefix+"Row", "Row number"));
     77      columns.add(new TableColumn(idPrefix + "column", propertyPrefix+"column", "raw('column')", Type.INT, titlePrefix+"Column", "Column number"));
     78      columns.add(new TableColumn(idPrefix + "x", propertyPrefix+"x", "raw('x')", Type.INT, titlePrefix+"X", "X coordinate"));
     79      columns.add(new TableColumn(idPrefix + "y", propertyPrefix+"y", "raw('y')", Type.INT, titlePrefix+"Y", "Y coordinate"));
     80 
     81      List<RawDataProperty> rdpList = rawDataType.getProperties();
     82      for(RawDataProperty rdp : rdpList)
     83      {
     84        String rdpName = rdp.getName();
     85        columns.add(new TableColumn(idPrefix+rdpName, propertyPrefix+rdpName, "raw('"+rdpName+"')", rdp.getType(),
     86            titlePrefix + rdp.getTitle(), rdp.getDescription()));
     87      }
    8588    }
    8689  }
  • trunk/src/core/common-queries.xml

    r2387 r2392  
    20152015  </query>
    20162016
     2017  <query id="SET_HAS_DATA_FOR_RAWBIOASSAYS" type="HQL">
     2018    <sql>
     2019      UPDATE RawBioAssayData rba
     2020      SET rba.hasData = CASE
     2021        WHEN rba.spots > 0 THEN true
     2022        ELSE false
     2023        END
     2024      WHERE rba.hasData IS NULL
     2025    </sql>
     2026    <description>
     2027      A Hibernate query that sets the hasData property for a
     2028      raw bioassay depending on if it has spots or not.
     2029    </description>
     2030  </query>
     2031
    20172032</predefined-queries>
  • trunk/src/core/net/sf/basedb/core/Affymetrix.java

    r2384 r2392  
    100100   
    101101    @param design The design to get the CDF file from, it must
    102       be an Affymetric chip
     102      be an Affymetrix chip
    103103    @return The CDF file or null if no CDF file has been specified
    104104    @throws PermissionDeniedException If the logged in user doesn't
     
    131131  }
    132132
     133  /**
     134    Attach a CEL file to a raw bioassay. When a raw bioassay has got a CEL
     135    file it counts as if data has been loaded and it can be used
     136    in experiments for analysis. To be able to add a CEL file the
     137    array design must also be connected to an array design with
     138    a CDF file. See {@link #setCdfFile(ArrayDesign, File)}.
     139    <p>
     140    Note! This implementation doesn't validate that the contents of
     141    the file actually is a CEL file, nor does it verify that the CEL
     142    file match the CDF file.
     143 
     144    @param rawBioAssat The raw bioassay
     145    @param file The CEL file, or null to remove the file
     146    @throws PermissionDeniedException If the logged in user doesn't
     147      have write permission for the raw bioassay and use permission for the
     148      file
     149    @throws InvalidDataException If the raw bioassay is null or isn't an Affymetrix
     150      raw data type
     151    @throws BaseException If there is another error
     152  */
     153  public static void setCelFile(RawBioAssay rawBioAssay, File file)
     154    throws PermissionDeniedException, InvalidDataException, BaseException
     155  {
     156    // Validate raw bioassay
     157    if (rawBioAssay == null) throw new InvalidUseOfNullException("rawBioAssay");
     158    if (!rawBioAssay.getRawDataType().isAffymetrix())
     159    {
     160      throw new InvalidDataException("Raw data type for " + rawBioAssay.getName() +
     161        " is not an Affymetrix raw data type");
     162    }
     163    rawBioAssay.checkPermission(Permission.WRITE);
     164   
     165    // Validate array design
     166    ArrayDesign design = rawBioAssay.getArrayDesign();
     167    if (design == null)
     168    {
     169      throw new InvalidDataException("Raw bioassay " + rawBioAssay.getName() +
     170        " doesn't have an array design");
     171    }
     172    if (!design.isAffyChip())
     173    {
     174      throw new InvalidDataException("The array design " + design.getName() +
     175        " is not an Affymterix design");
     176    }
     177
     178    // TODO - verify CDF file
     179   
     180    DbControl dc = rawBioAssay.getDbControl();
     181    if (file != null)
     182    {
     183      file.checkPermission(Permission.USE);
     184      AnyToAny ata = AnyToAny.getNewOrExisting(dc, rawBioAssay, CEL_LINK_NAME, file, true);
     185      if (!ata.isInDatabase()) dc.saveItem(ata);
     186      rawBioAssay.getData().setHasData(true);
     187    }
     188    else
     189    {
     190      AnyToAny.unlinkFrom(dc, rawBioAssay, CEL_LINK_NAME);
     191      rawBioAssay.getData().setHasData(false);
     192    }
     193  }
     194 
     195  /**
     196    Get the file that has been specified as the CEL file for a
     197    raw bioassay.
     198   
     199    @param rawBioAssay The raw bioassay to get the CEL file from, it must
     200      be a raw bioassay of an Affymetrix raw data type
     201    @return The CEL file or null if no CEL file has been specified
     202    @throws PermissionDeniedException If the logged in user doesn't
     203      have read permission for the file
     204    @throws InvalidDataException If the raw bioassay is null or isn't an
     205      Affymetrix raw data type
     206    @throws BaseException If there is another error
     207  */
     208  public static File getCelFile(RawBioAssay rawBioAssay)
     209    throws PermissionDeniedException, InvalidDataException, BaseException
     210  {
     211    if (rawBioAssay == null) throw new InvalidUseOfNullException("rawBioAssay");
     212    if (!rawBioAssay.getRawDataType().isAffymetrix())
     213    {
     214      throw new InvalidDataException("Raw data type for " + rawBioAssay.getName() +
     215      " is not an Affymetrix raw data type");
     216    }
     217    DbControl dc = rawBioAssay.getDbControl();
     218    File celFile = null;
     219    try
     220    {
     221      AnyToAny ata = AnyToAny.getByName(dc, rawBioAssay, CEL_LINK_NAME);
     222      if (ata.getToType() == Item.FILE)
     223      {
     224        celFile = (File)ata.getTo();
     225      }
     226    }
     227    catch (ItemNotFoundException ex)
     228    {}
     229    return celFile;
     230  }
     231 
    133232}
  • trunk/src/core/net/sf/basedb/core/DynamicRawDataQuery.java

    r2304 r2392  
    6060    this.rawDataType = rawDataType;
    6161    this.rootTable = rawDataType.getRealTable();
     62    if (!rawDataType.isStoredInDb())
     63    {
     64      throw new BaseException("Raw data for raw data type '" + rawDataType + "' is not stored in the database.");
     65    }
    6266  }
    6367 
  • trunk/src/core/net/sf/basedb/core/DynamicSpotQuery.java

    r2304 r2392  
    113113    throws InvalidDataException
    114114  {
     115    RawDataType rdt = getDataCube().getRawDataType();
     116    if (!rdt.isStoredInDb())
     117    {
     118      throw new BaseException("Raw data for raw data type: " + rdt + " is not stored in the database.");
     119    }
     120   
    115121    if (joinType == null) throw new InvalidUseOfNullException("joinType");
    116122    join(new DynamicJoin(getVirtualDb(), joinType, null, VirtualTable.RAWPARENTS,
    117123      VirtualColumn.CUBE, VirtualColumn.COLUMN, VirtualColumn.POSITION));
    118     join(new RealJoin(joinType, VirtualTable.RAWPARENTS, getDataCube().getRawDataType().getRealTable(),
     124    join(new RealJoin(joinType, VirtualTable.RAWPARENTS, rdt.getRealTable(),
    119125      VirtualColumn.RAWDATA_ID));
    120126  }
  • trunk/src/core/net/sf/basedb/core/Experiment.java

    r2387 r2392  
    477477      for the raw bioassay
    478478    @throws InvalidDataException If the rawBioAssay is null,
    479       hasn't any spots, or has a different raw data type
     479      doesn't have and data, or has a different raw data type
    480480  */
    481481  public void addRawBioAssay(RawBioAssay rawBioAssay)
     
    485485    if (rawBioAssay == null) throw new InvalidUseOfNullException("rawBioAssay");
    486486    rawBioAssay.checkPermission(Permission.USE);
    487     if (rawBioAssay.getSpots() == 0)
     487    if (!rawBioAssay.hasData())
    488488    {
    489489      throw new InvalidDataException("No raw data has been added to the raw bioassay: "+rawBioAssay);
  • trunk/src/core/net/sf/basedb/core/HibernateUtil.java

    r2387 r2392  
    265265    for (RawDataType rdt : RawDataTypes.getRawDataTypes() )
    266266    {
    267       String entityName = rdt.getEntityName();
    268       String tableName = rdt.getTableName();
    269       log.info("Adding raw data type " + entityName);
    270       try
    271       {
    272         Document dom = XMLUtil.getValidatedXml(templateFile, dtdFile);
    273         Element clazz = dom.getRootElement().getChild("class");
    274         // Specify an entity name and database table for the raw data type
    275         clazz.setAttribute("entity-name", entityName);
    276         clazz.setAttribute("table", "`"+tableName+"`");
    277 
    278         // Specify a sequence name for id generator
    279         Element generator = clazz.getChild("id").getChild("generator");
    280         Element sequenceName = new Element("param");
    281         sequenceName.setAttribute("name", "sequence");
    282         sequenceName.setText(entityName+"_sequence");
    283         generator.addContent(sequenceName);
    284 
    285         // Add admin-defnied properties
    286         for (RawDataProperty property : rdt.getProperties())
     267      if (rdt.isStoredInDb())
     268      {
     269        String entityName = rdt.getEntityName();
     270        String tableName = rdt.getTableName();
     271        log.info("Adding raw data type " + entityName);
     272        try
    287273        {
    288           log.info("Adding raw data property " + property.getName() + " to class " + entityName);
    289           Element el = new Element("property");
    290           el.setAttribute("name", property.getName());
    291           el.setAttribute("column", "`"+property.getColumn()+"`");
    292           el.setAttribute("type", property.getType().getStringValue());
    293           el.setAttribute("length", Integer.toString(property.getLength()));
    294           el.setAttribute("not-null", Boolean.toString(!property.isNullable()));
    295           el.setAttribute("access", "net.sf.basedb.core.ExtendedPropertyAccessor");
    296           clazz.addContent(el);
     274          Document dom = XMLUtil.getValidatedXml(templateFile, dtdFile);
     275          Element clazz = dom.getRootElement().getChild("class");
     276          // Specify an entity name and database table for the raw data type
     277          clazz.setAttribute("entity-name", entityName);
     278          clazz.setAttribute("table", "`"+tableName+"`");
     279 
     280          // Specify a sequence name for id generator
     281          Element generator = clazz.getChild("id").getChild("generator");
     282          Element sequenceName = new Element("param");
     283          sequenceName.setAttribute("name", "sequence");
     284          sequenceName.setText(entityName+"_sequence");
     285          generator.addContent(sequenceName);
     286 
     287          // Add admin-defnied properties
     288          for (RawDataProperty property : rdt.getProperties())
     289          {
     290            log.info("Adding raw data property " + property.getName() + " to class " + entityName);
     291            Element el = new Element("property");
     292            el.setAttribute("name", property.getName());
     293            el.setAttribute("column", "`"+property.getColumn()+"`");
     294            el.setAttribute("type", property.getType().getStringValue());
     295            el.setAttribute("length", Integer.toString(property.getLength()));
     296            el.setAttribute("not-null", Boolean.toString(!property.isNullable()));
     297            el.setAttribute("access", "net.sf.basedb.core.ExtendedPropertyAccessor");
     298            clazz.addContent(el);
     299          }
     300          cfg.addDocument(new DOMOutputter().output(dom));
    297301        }
    298         cfg.addDocument(new DOMOutputter().output(dom));
    299       }
    300       catch (Exception ex)
    301       {
    302         log.error("Exception while adding raw data types", ex);
    303         throw new BaseException(ex);
    304       }
    305       log.info("Added mapping for raw data type: "+entityName);
     302        catch (Exception ex)
     303        {
     304          log.error("Exception while adding raw data types", ex);
     305          throw new BaseException(ex);
     306        }
     307        log.info("Added mapping for raw data type: "+entityName);
     308      }
    306309    }
    307310  }
  • trunk/src/core/net/sf/basedb/core/Install.java

    r2350 r2392  
    9292    method.
    9393  */
    94   public static final int NEW_SCHEMA_VERSION = 6;
     94  public static final int NEW_SCHEMA_VERSION = 7;
    9595
    9696  public static synchronized void createTables(boolean update, final ProgressReporter progress)
  • trunk/src/core/net/sf/basedb/core/RawBioAssay.java

    r2382 r2392  
    5252public class RawBioAssay
    5353  extends AnnotatedItem<RawBioAssayData>
    54   implements FileAttachable, DiskConsumable
     54  implements DiskConsumable
    5555{
    5656  /**
     
    139139  {
    140140    return TYPE;
    141   }
    142   // -------------------------------------------
    143   /*
    144     From the FileAttachable interface
    145     -------------------------------------------
    146   */
    147   public File getFile()
    148     throws PermissionDeniedException, BaseException
    149   {
    150     return getDbControl().getItem(File.class, getData().getFile());
    151   }
    152 
    153   public void setFile(File file)
    154     throws PermissionDeniedException
    155   {
    156     checkPermission(Permission.WRITE);
    157     if (file != null) file.checkPermission(Permission.USE);
    158     getData().setFile(file == null ? null : file.getData());
    159141  }
    160142  // -------------------------------------------
     
    426408    Get the number of raw data spots that has been added to this
    427409    raw bioassay.
    428 
    429410    @return The number of spots
    430411  */
     
    432413  {
    433414    return getData().getSpots();
     415  }
     416 
     417  /**
     418    If raw data has been added to this raw bioassay or not. Note that this method
     419    can return true even if the {@link #getSpots()} returns 0 if the raw data
     420    type uses files to store it's data.
     421  */
     422  public boolean hasData()
     423  {
     424    return getData().getHasData();
    434425  }
    435426 
     
    530521  {
    531522    checkPermission(Permission.WRITE);
    532     if (getSpots() > 0)
     523    if (hasData())
    533524    {
    534525      throw new PermissionDeniedException("Raw data has already been added to "+this);
     
    579570    throws ItemNotFoundException, BaseException
    580571  {
     572    RawDataType rdt = getRawDataType();
     573    if (!rdt.isStoredInDb())
     574    {
     575      throw new BaseException("Raw data for raw data type '" + rdt + "' is not stored in the database.");
     576    }
     577   
    581578    RawData rd = HibernateUtil.loadData(getDbControl().getStatelessSession(),
    582       RawData.class, getRawDataType().getEntityName(), id);
     579      RawData.class, rdt.getEntityName(), id);
    583580    if (rd == null) throw new ItemNotFoundException("RawData[id = " + id + "]");
    584581    return rd;
     
    591588  public DataQuery<RawData> getRawData()
    592589  {
    593     DataQuery<RawData> query = new DataQuery<RawData>(RawData.class, getRawDataType().getEntityName());
     590    RawDataType rdt = getRawDataType();
     591    if (!rdt.isStoredInDb())
     592    {
     593      throw new BaseException("Raw data for raw data type '" + rdt + "' is not stored in the database.");
     594    }
     595    DataQuery<RawData> query = new DataQuery<RawData>(RawData.class, rdt.getEntityName());
    594596    query.restrictPermanent(
    595597      Restrictions.eq(
  • trunk/src/core/net/sf/basedb/core/RawDataBatcher.java

    r2380 r2392  
    154154    this.rawDataType = rawBioAssay.getRawDataType();
    155155    this.arrayDesign = rawBioAssayData.getArrayDesign();
     156    if (!rawDataType.isStoredInDb())
     157    {
     158      throw new BaseException("Raw data for raw data type '" + rawDataType + "' is not stored in the database.");
     159    }
     160   
    156161    if (arrayDesign != null && arrayDesign.getHasFeatures())
    157162    {
  • trunk/src/core/net/sf/basedb/core/RawDataType.java

    r2304 r2392  
    4545{
    4646
     47  private final boolean isAffymetrix;
    4748  private final String id;
    4849  private final String name;
    4950  private final String description;
     51  private final String storage;
     52  private final boolean isStoredInDb;
    5053  private final int channels;
    5154  private final String table;
     
    6164    See the getter methods for a description of the parameters
    6265  */
    63   RawDataType(String id, String name, String description, int channels,
     66  RawDataType(String id, String name, String description, int channels, String storage,
    6467    String table, List<RawDataProperty> properties, List<IntensityFormula> formulas)
    6568  {
     
    6770    this.name = name;
    6871    this.description = description;
     72    this.storage = storage;
    6973    this.channels = channels;
    70     this.table = table;
     74    this.isStoredInDb = "database".equals(storage);
     75    this.table = isStoredInDb ? table : null;
    7176    this.properties = Collections.unmodifiableList(properties);
    7277    this.formulas = formulas;
    73     this.realTable = new RealTable(table, "raw");
     78    this.realTable = isStoredInDb ? new RealTable(table, "raw") : null;
     79   
     80    // This is an ugly hack to support affymetrix data
     81    this.isAffymetrix = "affymetrix".equals(id);
     82   
     83    if (isStoredInDb && table == null)
     84    {
     85      throw new InvalidDataException("No table specified for raw data type: " + id);
     86    }
    7487   
    7588    this.namedProperties = new HashMap<String, RawDataProperty>(properties.size());
     
    104117
    105118  /**
     119    If this raw data type is the Affymetrix raw data type.
     120  */
     121  public boolean isAffymetrix()
     122  {
     123    return isAffymetrix;
     124  }
     125 
     126  /**
    106127    Get the name of this raw data type. This value is the same as the
    107128    <code>name</code> attribute of the <code>&lt;raw-data-type&gt;</code>
     
    145166
    146167  /**
     168    If the raw data of this raw data type is stored in the database
     169    or not.
     170    @see #getTableName()
     171  */
     172  public boolean isStoredInDb()
     173  {
     174    return isStoredInDb;
     175  }
     176 
     177  /**
    147178    Get the name of the database table that is used to store the extra
    148179    properties of this raw data type. This value is the same as the
     
    151182    any client application.
    152183
    153     @return The name of the database table for this raw data type
     184    @return The name of the database table for this raw data type, or null
     185      if not stored in database
     186    @see #isStoredInDb()
    154187  */
    155188  public String getTableName()
  • trunk/src/core/net/sf/basedb/core/RawDataTypes.java

    r2304 r2392  
    146146      String name = el.getAttributeValue("name");
    147147      String description = el.getAttributeValue("description");
     148      String storage = el.getAttributeValue("storage");
    148149      String table = el.getAttributeValue("table");
    149150      int channels = XMLUtil.getIntAttribute(el, "channels", 2);
    150151      List<RawDataProperty> properties = loadProperties(el);
    151152      List<IntensityFormula> formulas = loadIntensityFormulas(el, channels);
    152       RawDataType rdt = new RawDataType(id, name, description, channels, table, properties, formulas);
     153      RawDataType rdt = new RawDataType(id, name, description, channels, storage, table, properties, formulas);
    153154      rawDataTypes.put(id, rdt);
    154155    }
  • trunk/src/core/net/sf/basedb/core/Update.java

    r2382 r2392  
    9898        {@link net.sf.basedb.core.data.ParameterValueData}
    9999      <li>Added {@link net.sf.basedb.core.data.AnyToAnyData}
    100       <li>TODO - we can add more changes here unless they require modifications to data
    101       </ul>
    102     </td>
    103   </tr>
     100      </ul>
     101    </td>
     102  </tr>
     103
     104  <tr>
     105    <td>7</td>
     106    <td>
     107      <ul>
     108      <li>Added {@link net.sf.basedb.core.data.RawBioAssayData#getHasData()}.
     109        The update must set all null values to true or false depending on
     110        the number of spots.
     111      <li>Removed {@link net.sf.basedb.core.data.FileAttachableData} from
     112        <code>RawBioAssayData</code>.
     113      <li>Delete all {@link FormulaData} with affymetrix raw data type.
     114      </ul>
     115    </td>
     116  </tr>
     117
    104118  </table>
    105119
     
    185199      }
    186200     
    187       /*
    188201      if (schemaVersion < 7)
    189202      {
    190203        if (progress != null) progress.display((int)(6*progress_factor), "--Updating to schema version 7...");
    191204        schemaVersion = updateToSchemaVersion7();
     205      }
     206
     207      /*
     208      if (schemaVersion < 8)
     209      {
     210        if (progress != null) progress.display((int)(7*progress_factor), "--Updating to schema version 8...");
     211        schemaVersion = updateToSchemaVersion8();
    192212        - or -
    193         schemaVersion = setSchemaVersionInTransaction(7);
     213        schemaVersion = setSchemaVersionInTransaction(8);
    194214      }
    195215      ... etc...
    196216      */
     217     
    197218      sc.logout();
    198219      if (progress != null) progress.display(100, "Database updated sucessfully.");
     
    373394    return schemaVersion;
    374395  }
     396 
     397  /**
     398    Set RawBioAssays.has_data to true or false depending on the number of spots.
     399    Delete all Formulas with affymetrix raw data type
     400    @return The new schema version (=7)
     401  */
     402  private static int updateToSchemaVersion7()
     403    throws BaseException
     404  {
     405    final int schemaVersion = 6;
     406    org.hibernate.Transaction tx = null;
     407    try
     408    {
     409      tx = HibernateUtil.newTransaction(session);
     410 
     411      // Set has_data for all raw bioassays with a null value
     412      org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "SET_HAS_DATA_FOR_RAWBIOASSAYS");
     413      /*
     414        UPDATE RawBioAssayData rba
     415        SET rba.hasData = CASE
     416          WHEN rba.spots > 0 THEN true
     417          ELSE false
     418          END CASE
     419        WHERE rba.hasData IS NULL
     420      */
     421      HibernateUtil.executeUpdate(query);
     422 
     423      // TODO - Delete formulas with affymetrix raw data type
     424      // HibernateUtil.loadList()
     425     
     426      // Update the shcema version number
     427      setSchemaVersion(schemaVersion);
     428 
     429      // Commit the changes
     430      HibernateUtil.commit(tx);
     431      log.info("updateToSchemaVersion7: OK");
     432    }
     433    catch (BaseException ex)
     434    {
     435      if (tx != null) HibernateUtil.rollback(tx);
     436      log.error("updateToSchemaVersion7: FAILED", ex);
     437      throw ex;
     438    }
     439    return schemaVersion;
     440  }
     441   
    375442}
  • trunk/src/core/net/sf/basedb/core/data/ArrayDesignData.java

    r2304 r2392  
    5858
    5959  private boolean hasFeatures;
    60 
    6160  /**
    6261    If the array design has features or not.
  • trunk/src/core/net/sf/basedb/core/data/RawBioAssayData.java

    r2304 r2392  
    4141public class RawBioAssayData
    4242  extends AnnotatedData
    43   implements FileAttachableData, DiskConsumableData
     43  implements DiskConsumableData
    4444{
    4545
     
    4747  {}
    4848
    49   /*
    50     From the FileAttachableData interface
    51     -------------------------------------------
    52   */
    53   private FileData file;
    54   public FileData getFile()
    55   {
    56     return file;
    57   }
    58   public void setFile(FileData file)
    59   {
    60     this.file = file;
    61   }
    62   // -------------------------------------------
    6349  /*
    6450    From the DiskConsumableData interface
     
    162148  }
    163149 
     150  private boolean hasData;
     151  /**
     152    If the raw bioassay has data or not.
     153    @hibernate.property column="`has_data`" type="boolean" not-null="true"
     154  */
     155  public boolean getHasData()
     156  {
     157    return hasData;
     158  }
     159  public void setHasData(boolean hasData)
     160  {
     161    this.hasData = hasData;
     162  }
     163
    164164  private int spots;
    165165  /**
    166     The number of raw data spots in this raw bio assay.
     166    The number of data spots in this raw bio assay.
    167167    @hibernate.property column="`spots`" type="int" not-null="true"
    168168  */
  • trunk/src/core/net/sf/basedb/core/dtd/raw-data-types.dtd

    r2304 r2392  
    2424<!ELEMENT raw-data-types (raw-data-type+) >
    2525
    26 <!ELEMENT raw-data-type (property+,intensity-formula*) >
     26<!ELEMENT raw-data-type (property*,intensity-formula*) >
    2727
    2828<!ATTLIST raw-data-type
     
    3030  name CDATA #REQUIRED
    3131  channels CDATA #REQUIRED
    32   table CDATA #REQUIRED
     32  storage (file|database) "database"
     33  table CDATA #IMPLIED
    3334  description CDATA #IMPLIED
    3435>
  • trunk/src/core/net/sf/basedb/core/plugin/InteractivePlugin.java

    r2304 r2392  
    7878    Check if the plugin can be used on the specified object. The item is either
    7979    a <code>BasicItem</code> or <code>BasicData</code> object. A client
    80     application calls this method if the plugin has specified a {@link GuiContext}
    81     for that type of item with a {@link GuiContext#type} context type.
     80    application should only call this method for contexts matching one of
     81    the contexts in the set returned by the {@link #getGuiContexts()}
     82    method. For {@link GuiContext.Type#ITEM} contexts an item
     83    of the correct type should be passed as a parameter.
    8284   
    8385    @param context The current context of the client application,
    8486      it is one of the values found in set returned by {@link #getGuiContexts()}
    8587    @param item The currently active item, it's type should match the
    86       {@link GuiContext#getItem()} type
     88      {@link GuiContext#getItem()} type, or null if the context is a list
     89      context
    8790    @return <code>Null</code> if the plugin can use that item, or
    8891      a message explaining why the plugin can't be used
  • trunk/src/plugins/core/net/sf/basedb/plugins/IntensityCalculatorPlugin.java

    r2340 r2392  
    241241  }
    242242  /**
    243     Always null, since plugin doesn't operate on individual items.
     243    Check that the current experiment stores it's raw data in
     244    the database.
    244245  */
    245246  public String isInContext(GuiContext context, Object item)
    246247  {
     248    DbControl dc = sc.newDbControl();
     249    try
     250    {
     251      Experiment e = Experiment.getById(dc, sc.getCurrentContext(Item.EXPERIMENT).getId());
     252      if (!e.getRawDataType().isStoredInDb())
     253      {
     254        return "Raw data for raw data type '" + e.getRawDataType() + "' is not stored in the database.";
     255      }
     256    }
     257    catch (Throwable ex)
     258    {}
     259    finally
     260    {
     261      if (dc != null) dc.close();
     262    }
    247263    return null;
    248264  }
     
    297313        {
    298314          experiment = Experiment.getById(dc, experiment.getId());
     315          if (!experiment.getRawDataType().isStoredInDb())
     316          {
     317            throw new BaseException("Raw data for raw data type '" + experiment.getRawDataType() +
     318              "' is not stored in the database.");
     319          }
    299320          List<RawBioAssay> rawBioAssays = (List<RawBioAssay>)request.getParameterValues("rawBioAssays");
    300321          for (RawBioAssay rba : rawBioAssays)
  • trunk/src/plugins/core/net/sf/basedb/plugins/RawDataFlatFileImporter.java

    r2340 r2392  
    212212      RawBioAssay rba = (RawBioAssay)item;
    213213      String rawDataType = (String)configuration.getValue("rawDataType");
    214       if (rba.getSpots() > 0)
    215       {
    216         message = "The raw bioassay already has spots: " + rba.getName();
    217       }
    218       else if (!rba.getRawDataType().getId().equals(rawDataType))
     214      RawDataType rdt = rba.getRawDataType();
     215      if (rba.hasData())
     216      {
     217        message = "The raw bioassay already has data: " + rba.getName();
     218      }
     219      else if (!rdt.isStoredInDb())
     220      {
     221        message = "Raw data for raw data type '" + rdt + "' is not stored in the database";
     222      }
     223      else if (!rdt.getId().equals(rawDataType))
    219224      {
    220225        message = "Unsupported raw data type: " + rba.getRawDataType().getName();
     
    520525      for (RawDataType rdt : RawDataTypes.getRawDataTypes())
    521526      {
    522         types.add(rdt.getId(), rdt.getName());
     527        if (rdt.isStoredInDb())
     528        {
     529          types.add(rdt.getId(), rdt.getName());
     530        }
    523531      }
    524532      rawDataTypeType = new StringParameterType(255, null, true, 1, 0, 0, types);
  • trunk/src/raw-data-types.xml

    r2251 r2392  
    648648    channels="1"
    649649    name="Affymetrix"
    650     table="RawDataAffymetrix"
     650    storage="file"
    651651    >
    652     <property
    653       name="CHPAvgDiff"
    654       title="CHPAvgDiff"
    655       description="Average intensity difference."
    656       column="chp_avg_diff"
    657       type="float"
    658     />
    659     <property
    660       name="CHPLogAvg"
    661       title="CHPLogAvg"
    662       description="Average log ratio."
    663       column="chp_log_avg"
    664       type="float"
    665     />
    666     <property
    667       name="CHPSignal"
    668       title="CHPSignal"
    669       description="A measure of the relative abundance of a transcript."
    670       column="chp_signal"
    671       type="float"
    672     />
    673     <property
    674       name="CELIntensity"
    675       title="CELIntensity"
    676       description="The intensity value of the probe. Represents the 75th percentile among the DAT file intensity values of the pixels in the feature."
    677       column="cel_intensity"
    678       type="float"
    679     />
    680     <property
    681       name="CHPAbsCall"
    682       title="CHPAbsCall"
    683       description="The call in an absolute analysis that indicates if the transcript was present (P), absent (A), or marginal (M)."
    684       column="chp_abs_call"
    685       type="string"
    686     />
    687     <property
    688       name="CHPChange"
    689       title="CHPChange"
    690       description="A call indicating an Increase (I), Marginal Increase (MI), No Change (NC), Decrease (D), or Marginal Decrease (MD) in transcript level between a baseline array and an experiment array. May also have the value 'No Call'."
    691       column="chp_change"
    692       type="string"
    693     />
    694     <property
    695       name="CHPDetection"
    696       title="CHPDetection"
    697       description="A measurement indicating if the transcript was detected (Present), not detected (Absent) or marginally detected (Marginal). Can be one of 'A', 'M', 'P' or 'No Call'."
    698       column="chp_detection"
    699       type="string"
    700     />
    701     <property
    702       name="CHPDiffCall"
    703       title="CHPDiffCall"
    704       description="The comparison change call."
    705       column="chp_diff"
    706       type="string"
    707     />
    708     <property
    709       name="CHPChangePvalue"
    710       title="CHPChangePvalue"
    711       description="Measures the probability that the expression levels of a probe set in two different arrays are the same or not. When the p-value is close to 0.5 they are likely to be the same. When the p-value is close to 0 the expression level in the experiment array is higher than that of the baseline array. When the p-value is close to 1, the expression level in the experiment arrays is lower than that of the baseline."
    712       column="chp_change_pvalue"
    713       type="float"
    714     />
    715     <property
    716       name="CHPDetectionPvalue"
    717       title="CHPDetectionPvalue"
    718       description="See Detection p-value."
    719       column="chp_detection_pvalue"
    720       type="float"
    721     />
    722     <property
    723       name="CHPDecRatio"
    724       title="CHPDecRatio"
    725       description="The ratio of decreasing pairs to the total number of pairs."
    726       column="chp_dec_ratio"
    727       type="float"
    728     />
    729     <property
    730       name="CHPDPosDNegRatio"
    731       title="CHPDPos-DNegRatio"
    732       description="The ratio of the change in positive to the change in negative pairs."
    733       column="chp_dpos_dneg_ratio"
    734       type="float"
    735     />
    736     <property
    737       name="CHPFoldChange"
    738       title="CHPFoldChange"
    739       description="The fold change."
    740       column="chp_fold_change"
    741       type="float"
    742     />
    743     <property
    744       name="CHPIncDecRatio"
    745       title="CHPIncDecRatio"
    746       description="The ratio of increase to decrease pairs."
    747       column="chp_inc_dec_ratio"
    748       type="float"
    749     />
    750     <property
    751       name="CHPIncRatio"
    752       title="CHPIncRatio"
    753       description="The ratio of increasing pairs to the total number of pairs."
    754       column="chp_inc_ratio"
    755       type="float"
    756     />
    757     <property
    758       name="CHPPosFraction"
    759       title="CHPPosFraction"
    760       description="The fraction of positive pairs."
    761       column="chp_pos_fraction"
    762       type="float"
    763     />
    764     <property
    765       name="CHPPosNegRatio"
    766       title="CHPPosNegRatio"
    767       description="The ratio of the positive to the negative pairs."
    768       column="chp_pos_neg_ratio"
    769       type="float"
    770     />
    771     <property
    772       name="CHPSignalLogRatio"
    773       title="CHPSignalLogRatio"
    774       description="The change in expression level for a transcript between a baseline and an experiment array. This change is expressed as the Log2 ratio."
    775       column="chp_signal_log_ratio"
    776       type="float"
    777     />
    778     <property
    779       name="CHPSignalLogRatioHigh"
    780       title="CHPSignalLogRatioHigh"
    781       description="The upper limit of the Signal Log Ratio within a 95% confidence interval."
    782       column="chp_signal_log_ratio_high"
    783       type="float"
    784     />
    785     <property
    786       name="CHPSignalLogRatioLow"
    787       title="CHPSignalLogRatioLow"
    788       description="The lower limit of the Signal Log Ratio within a 95% confidence interval."
    789       column="chp_signal_log_ratio_low"
    790       type="float"
    791     />
    792     <property
    793       name="CELIntensityStdev"
    794       title="CELIntensityStdev"
    795       description="The standard deviation of the intensity of the probe."
    796       column="cel_intensity_stdev"
    797       type="float"
    798     />
    799     <property
    800       name="CELMask"
    801       title="CELMask"
    802       description="A flag indicating that the probe was masked by the user."
    803       column="cel_mask"
    804       type="boolean"
    805     />
    806     <property
    807       name="CELOutlier"
    808       title="CELOutlier"
    809       description="A flag indicating that the software called this probe an outlier."
    810       column="cel_outlier"
    811       type="boolean"
    812     />
    813     <property
    814       name="CELPixels"
    815       title="CELPixels"
    816       description="The number of pixels used to calculate the intensity."
    817       column="cel_pixels"
    818       type="int"
    819     />
    820     <property
    821       name="CELX"
    822       title="CELX"
    823       description="The x coordinate of the probe."
    824       column="cel_x"
    825       type="int"
    826     />
    827     <property
    828       name="CELY"
    829       title="CELY"
    830       description="The y coordinate of the probe."
    831       column="cel_y"
    832       type="int"
    833     />
    834     <property
    835       name="CHPAvgDiffChange"
    836       title="CHPAvgDiffChange"
    837       description="The change in average difference."
    838       column="chp_avg_diff_change"
    839       type="float"
    840     />
    841     <property
    842       name="CHPBaselineAbsent"
    843       title="CHPBaselineAbsent"
    844       description="Flag indicating if the baseline call was absent."
    845       column="chp_baseline_absent"
    846       type="float"
    847     />
    848     <property
    849       name="CHPCommonPairs"
    850       title="CHPCommonPairs"
    851       description="The number of common probe pairs on two arrays (experiment versus baseline) after saturation across the probe set is determined."
    852       column="chp_common_pairs"
    853       type="int"
    854     />
    855     <property
    856       name="CHPDec"
    857       title="CHPDec"
    858       description="The number of decreasing pairs."
    859       column="chp_dec"
    860       type="int"
    861     />
    862     <property
    863       name="CHPInc"
    864       title="CHPInc"
    865       description="The number of increasing pairs."
    866       column="chp_inc"
    867       type="int"
    868     />
    869     <property
    870       name="CHPLogAvgRatioChange"
    871       title="CHPLogAvgRatioChange"
    872       description="The change in log average ratio."
    873       column="chp_log_avg_ratio_change"
    874       type="float"
    875     />
    876     <property
    877       name="CHPNegative"
    878       title="CHPNegative"
    879       description="Number of negative probe pairs."
    880       column="chp_negative"
    881       type="int"
    882     />
    883     <property
    884       name="CHPNegChange"
    885       title="CHPNegChange"
    886       description="The change in negative pairs."
    887       column="chp_neg_change"
    888       type="int"
    889     />
    890     <property
    891       name="CHPPairs"
    892       title="CHPPairs"
    893       description="The number of probe pairs in a probe set."
    894       column="chp_pairs"
    895       type="int"
    896     />
    897     <property
    898       name="CHPPairsInAvg"
    899       title="CHPPairsInAvg"
    900       description="Number of probe pairs used in computing the average intensity difference."
    901       column="chp_pairs_in_avg"
    902       type="int"
    903     />
    904     <property
    905       name="CHPPairsUsed"
    906       title="CHPPairsUsed"
    907       description="The number of probe pairs in the probe set used in the Detection call."
    908       column="chp_pairs_used"
    909       type="int"
    910     />
    911     <property
    912       name="CHPPosChange"
    913       title="CHPPosChange"
    914       description="The change in positive pairs."
    915       column="chp_pos_change"
    916       type="float"
    917     />
    918     <property
    919       name="CHPPositive"
    920       title="CHPPositive"
    921       description="Number of positive probe pairs."
    922       column="chp_positive"
    923       type="int"
    924     />
    925     <property
    926       name="CHPSortScore"
    927       title="CHPSortScore"
    928       description="The sort score."
    929       column="chp_sort_score"
    930       type="float"
    931     />
    932     <property
    933       name="ProbeSetName"
    934       title="ProbeSetName"
    935       description="The name of the probe set."
    936       column="chp_probe_set_name"
    937       type="string"
    938     />
    939     <intensity-formula
    940       name="CHPSignal"
    941       title="CHPSignal"
    942       description="A measure of the relative abundance of a transcript."
    943       >
    944       <formula
    945         channel="1"
    946         expression="raw('CHPSignal')"
    947       />
    948     </intensity-formula>
    949     <intensity-formula
    950       name="CELIntensity"
    951       title="CELIntensity"
    952       description="The intensity value of the probe. Represents the 75th percentile among the DAT file intensity values of the pixels in the feature."
    953       >
    954       <formula
    955         channel="1"
    956         expression="raw('CELIntensity')"
    957       />
    958     </intensity-formula>
    959652  </raw-data-type>
    960653 
  • trunk/www/common/expression_builder.jsp

    r2296 r2392  
    380380          </td>
    381381          <%
    382           if (rawDataType != null)
     382          if (rawDataType != null && rawDataType.isStoredInDb())
    383383          {
    384384            %>
  • trunk/www/common/import/index.jsp

    r2304 r2392  
    107107      for (PluginConfiguration pluginConfig : configQuery.list(dc))
    108108      {
    109         if (contextType == GuiContext.Type.ITEM)
    110         {
    111           InteractivePlugin ip = plugin.newInstance(InteractivePlugin.class, sc, pluginConfig, null);
    112           String contextMessage = ip.isInContext(context, currentItem);
    113           if (contextMessage == null)
    114           {
    115             configList.add(pluginConfig);
    116             totalPlugins++;
    117           }
    118           else
    119           {
    120             contextMessages.add(contextMessage);
    121           }
    122         }
    123         else
     109        InteractivePlugin ip = plugin.newInstance(InteractivePlugin.class, sc, pluginConfig, null);
     110        String contextMessage = ip.isInContext(context, currentItem);
     111        if (contextMessage == null)
    124112        {
    125113          configList.add(pluginConfig);
    126114          totalPlugins++;
    127115        }
     116        else
     117        {
     118          contextMessages.add(plugin.getName() + ": " + contextMessage);
     119        }
    128120      }
    129121   
     
    132124        plugins.put(plugin, configList);
    133125      }
    134       else if (contextType == GuiContext.Type.ITEM)
     126      else
    135127      {
    136128        InteractivePlugin ip = plugin.newInstance(InteractivePlugin.class, sc, null, null);
     
    143135        else
    144136        {
    145           contextMessages.add(contextMessage);
    146         }
    147       }
    148       else if (contextType == GuiContext.Type.LIST)
    149       {
    150         plugins.put(plugin, null);
    151         totalPlugins++;
     137          contextMessages.add(plugin.getName() + ": " + contextMessage);
     138        }
    152139      }
    153140    }
    154141    if (totalPlugins == 0)
    155142    {
    156       throw new WebException("popup", "No plugins found",
    157         "There are no plugins that can be used in the current context: <br><ul><li>" +
    158         Values.getString(contextMessages, "<li>", true) + "</ul>");
     143      String msg = "No plugins can be used in this context, for the following reasons:<br><ul><li>";
     144      if (contextMessages.size() == 0)
     145      {
     146        msg += "Could not find any plugins";
     147      }
     148      else
     149      {
     150        msg += Values.getString(contextMessages, "<li>", true) + "</ul>";
     151      }
     152      throw new WebException("popup", "No plugins found", msg);
    159153    }
    160154    sc.setSessionSetting("IMPORTERS", plugins);
  • trunk/www/common/plugin/index.jsp

    r2304 r2392  
    141141      for (PluginConfiguration pluginConfig : configQuery.list(dc))
    142142      {
    143         if (contextType == GuiContext.Type.ITEM)
    144         {
    145           InteractivePlugin ip = plugin.newInstance(InteractivePlugin.class, sc, pluginConfig, null);
    146           String contextMessage = ip.isInContext(context, currentItem);
    147           if (contextMessage == null)
    148           {
    149             configList.add(pluginConfig);
    150             totalPlugins++;
    151           }
    152           else
    153           {
    154             contextMessages.add(contextMessage);
    155           }
    156         }
    157         else
     143        InteractivePlugin ip = plugin.newInstance(InteractivePlugin.class, sc, pluginConfig, null);
     144        String contextMessage = ip.isInContext(context, currentItem);
     145        if (contextMessage == null)
    158146        {
    159147          configList.add(pluginConfig);
    160148          totalPlugins++;
    161149        }
    162       }
    163    
     150        else
     151        {
     152          contextMessages.add(plugin.getName() + ": " + contextMessage);
     153        }
     154      }
    164155      if (configList.size() > 0)
    165156      {
    166157        plugins.put(plugin, configList);
    167158      }
    168       else if (contextType == GuiContext.Type.ITEM)
     159      else
    169160      {
    170161        InteractivePlugin ip = plugin.newInstance(InteractivePlugin.class, sc, null, null);
     
    177168        else
    178169        {
    179           contextMessages.add(contextMessage);
     170          contextMessages.add(plugin.getName() + ": " + contextMessage);
    180171        }
    181       }
    182       else if (contextType == GuiContext.Type.LIST)
    183       {
    184         plugins.put(plugin, null);
    185         totalPlugins++;
    186172      }
    187173    }
     
    189175    if (totalPlugins == 0)
    190176    {
    191       throw new WebException("popup", "No plugins found",
    192           "There are no plugins that can be used in the current context: <br><ul><li>" +
    193           Values.getString(contextMessages, "<li>", true) + "</ul>");
     177      String msg = "No plugins can be used in this context, for the following reasons:<br><ul><li>";
     178      if (contextMessages.size() == 0)
     179      {
     180        msg += "Could not find any plugins";
     181      }
     182      else
     183      {
     184        msg += Values.getString(contextMessages, "<li>", true) + "</ul>";
     185      }
     186      throw new WebException("popup", "No plugins found", msg);
    194187    }
    195188    sc.setSessionSetting("PLUGINS", plugins);
  • trunk/www/lims/arraydesigns/edit_design.jsp

    r2384 r2392  
    254254        %>
    255255        <tr id="cdfFile">
    256           <td class="prompt">CDF-file</td>
     256          <td class="prompt">CDF file</td>
    257257          <td>
    258258            <table border="0" cellspacing="0" cellpadding="0">
  • trunk/www/views/experiments/edit_experiment.jsp

    r2304 r2392  
    133133      url += "&exclude="+excludes;
    134134      url += '&filter:STRING:rawDataType='+rawDataType;
    135       url += '&filter:INT:spots=>0';
     135      url += '&filter:BOOLEAN:hasData=true';
    136136      Main.openPopup(url, 'AddRawBioAssays', 1000, 700);
    137137    }
  • trunk/www/views/rawbioassays/edit_rawbioassay.jsp

    r2304 r2392  
    3434  import="net.sf.basedb.core.Permission"
    3535  import="net.sf.basedb.core.RawBioAssay"
     36  import="net.sf.basedb.core.Affymetrix"
    3637  import="net.sf.basedb.core.Scan"
    3738  import="net.sf.basedb.core.Protocol"
     
    6970  String title = null;
    7071  RawBioAssay rawBioAssay = null;
     72  boolean readCurrentCelFile = true;
     73  File currentCelFile = null;
    7174  boolean readCurrentScan = true;
    7275  Scan currentScan = null;
     
    7780  boolean readCurrentArrayDesign = true;
    7881  ArrayDesign currentArrayDesign = null;
    79   boolean readCurrentFile = true;
    80   File currentFile = null;
    8182  RawDataType currentRawDataType = null;
    8283
     
    110111    currentRawDataType = rawBioAssay.getRawDataType();
    111112    title = "Edit raw bioassay -- " + HTML.encodeTags(rawBioAssay.getName());
     113   
     114    if (currentRawDataType.isAffymetrix())
     115    {
     116      try
     117      {
     118        currentCelFile = Affymetrix.getCelFile(rawBioAssay);
     119      }
     120      catch (PermissionDeniedException ex)
     121      {
     122        readCurrentCelFile = false;
     123      }
     124    }
     125   
    112126    try
    113127    {
     
    142156      readCurrentArrayDesign = false;
    143157    }
    144     try
    145     {
    146       currentFile = rawBioAssay.getFile();
    147     }
    148     catch (PermissionDeniedException ex)
    149     {
    150       readCurrentFile = false;
    151     }
    152158  }
    153   if (rawBioAssay != null && !rawBioAssay.hasPermission(Permission.WRITE))
    154   {
    155     throw new PermissionDeniedException(Permission.WRITE, itemType.toString());
    156   }
     159  if (rawBioAssay != null) rawBioAssay.checkPermission(Permission.WRITE);
    157160  final String clazz = "class=\"text\"";
    158161  final String requiredClazz = "class=\"text required\"";
     
    306309    }
    307310   
    308     function selectFileOnClick()
    309     {
    310       var frm = document.forms['rawbioassay'];
    311       var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setFileCallback';
    312       if (frm.file_id.length > 1)
    313       {
    314         var id = Math.abs(parseInt(frm.file_id[1].value));       
     311    function selectCelFileOnClick()
     312    {
     313      var frm = document.forms['rawbioassay'];
     314      var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setCelFileCallback';
     315      if (frm.celfile_id.length > 1)
     316      {
     317        var id = Math.abs(parseInt(frm.celfile_id[1].value));       
    315318        url += '&item_id='+id;
    316319      }
    317       url += '&filter:INT:fileType=<%=SystemItems.getId(FileType.RAW_DATA)%>';
     320      url += '&filter:STRING:name=%25.cel';
    318321      Main.openPopup(url, 'SelectFile', 1000, 700);
    319322    }
    320     function setFileCallback(fileId, name)
    321     {
    322       var frm = document.forms['rawbioassay'];
    323       if (frm.file_id.length < 2) // >
    324       {
    325         frm.file_id[frm.file_id.length] = new Option();
    326       }
    327       frm.file_id[1].value = fileId;
    328       frm.file_id[1].text = name;
    329       frm.file_id.selectedIndex = 1;
     323    function setCelFileCallback(fileId, name)
     324    {
     325      var frm = document.forms['rawbioassay'];
     326      if (frm.celfile_id.length < 2) // >
     327      {
     328        frm.celfile_id[frm.celfile_id.length] = new Option();
     329      }
     330      frm.celfile_id[1].value = fileId;
     331      frm.celfile_id[1].text = name;
     332      frm.celfile_id.selectedIndex = 1;
    330333    }
    331334
     
    364367        <td>
    365368          <%
    366           if (rawBioAssay == null || rawBioAssay.getSpots() == 0)
     369          if (rawBioAssay == null || !rawBioAssay.hasData())
    367370          {
    368371            %>
     
    390393        </td>
    391394      </tr>
     395      <%
     396      if (rawBioAssay == null || rawBioAssay.getRawDataType().isAffymetrix())
     397      {
     398        %>
     399        <tr id="celFile">
     400          <td class="prompt">CEL file</td>
     401          <td>
     402            <table border="0" cellspacing="0" cellpadding="0">
     403            <tr>
     404            <td>
     405              <select name="celfile_id" size="1"
     406                <%=!readCurrentCelFile ? "disabled readonly class=\"disabled\"" : ""%>
     407                style="width: 20em;">
     408              <%
     409              if (!readCurrentCelFile)
     410              {
     411                %>
     412                <option value="-1">- denied -
     413                <%
     414              }
     415              else
     416              {
     417                %>
     418                <option value="0">- none -
     419                <%
     420                if (currentCelFile != null)
     421                {
     422                  %>
     423                  <option value="<%=rawBioAssay == null ? currentCelFile.getId() : -currentCelFile.getId()%>"
     424                    selected><%=HTML.encodeTags(currentCelFile.getName())%>
     425                  <%
     426                }
     427              }
     428              %>
     429              </select>
     430              &nbsp;
     431            </td>
     432            <td><base:button onclick="selectCelFileOnClick()"
     433              title="Select&hellip;" disabled="<%=!readCurrentCelFile%>"/></td>
     434            </tr>
     435            </table>
     436          </td>
     437        </tr>
     438        <%
     439      }
     440      %>
    392441      <tr>
    393442        <td class="prompt">Protocol</td>
     
    561610        </td>
    562611      </tr>
    563       <tr>
    564         <td class="prompt">File</td>
    565         <td>
    566           <table border="0" cellspacing="0" cellpadding="0">
    567           <tr>
    568           <td>
    569             <select name="file_id" size="1"
    570               <%=!readCurrentFile ? "disabled readonly class=\"disabled\"" : ""%>
    571               style="width: 20em;">
    572             <%
    573             if (!readCurrentFile)
    574             {
    575               %>
    576               <option value="-1">- denied -
    577               <%
    578             }
    579             else
    580             {
    581               %>
    582               <option value="0">- none -
    583               <%
    584               if (currentFile != null)
    585               {
    586                 %>
    587                 <option value="<%=rawBioAssay == null ? currentFile.getId() : -currentFile.getId()%>"
    588                   selected><%=HTML.encodeTags(currentFile.getName())%>
    589                 <%
    590               }
    591             }
    592             %>
    593             </select>
    594             &nbsp;
    595           </td>
    596           <td><base:button onclick="selectFileOnClick()"
    597             title="Select&hellip;" disabled="<%=!readCurrentFile%>"/></td>
    598           </tr>
    599           </table>
    600         </td>
    601       </tr>
    602612      <tr valign=top>
    603613        <td class="prompt">Description</td>
  • trunk/www/views/rawbioassays/index.jsp

    r2348 r2392  
    3131  import="net.sf.basedb.core.Include"
    3232  import="net.sf.basedb.core.RawBioAssay"
     33  import="net.sf.basedb.core.Affymetrix"
    3334  import="net.sf.basedb.core.Scan"
    3435  import="net.sf.basedb.core.Protocol"
     
    190191      rba.setArrayDesign(ad);
    191192    }
    192     int fileId = Values.getInt(request.getParameter("file_id"), -1);
    193     if (fileId >= 0) // < 0 = denied or unchanged
    194     {
    195       File f = fileId == 0 ? null : File.getById(dc, fileId);
    196       rba.setFile(f);
    197     }
     193    rdt = rba.getRawDataType();
     194    if (rdt.isAffymetrix())
     195    {
     196      int celFileId = Values.getInt(request.getParameter("celfile_id"), -1);
     197      if (celFileId >= 0) // < 0 = denied or unchanged
     198      {
     199        File celFile = celFileId == 0 ? null : File.getById(dc, celFileId);
     200        Affymetrix.setCelFile(rba, celFile);
     201      }
     202    }
     203
    198204    // Annotations tab
    199205    Base.updateAnnotations(dc, rba, rba, request);
  • trunk/www/views/rawbioassays/list_rawbioassays.jsp

    r2376 r2392  
    3232  import="net.sf.basedb.core.RawDataType"
    3333  import="net.sf.basedb.core.RawDataTypes"
     34  import="net.sf.basedb.core.Affymetrix"
    3435  import="net.sf.basedb.core.AnnotationType"
    3536  import="net.sf.basedb.core.AnnotationSet"
     37  import="net.sf.basedb.core.File"
    3638  import="net.sf.basedb.core.ItemQuery"
    3739  import="net.sf.basedb.core.Include"
     
    4143  import="net.sf.basedb.core.Permission"
    4244  import="net.sf.basedb.core.PluginDefinition"
     45  import="net.sf.basedb.core.PermissionDeniedException"
    4346  import="net.sf.basedb.core.query.Hql"
    4447  import="net.sf.basedb.core.query.Restrictions"
     
    6164%>
    6265<%
     66final String root = request.getContextPath()+"/";
    6367final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType);
    6468final String ID = sc.getId();
     
    221225      />
    222226      <tbl:columndef
     227        id="hasData"
     228        property="hasData"
     229        datatype="boolean"
     230        title="Has data"
     231        sortable="true"
     232        filterable="true"
     233        exportable="true"
     234      />
     235      <tbl:columndef
    223236        id="spots"
    224237        property="spots"
     
    230243      />
    231244      <tbl:columndef
     245        id="celFile"
     246        title="CEL file"
     247      />
     248      <tbl:columndef
    232249        id="bytes"
    233250        property="bytes"
    234251        datatype="long"
    235252        title="Bytes"
    236         sortable="true"
    237         filterable="true"
    238         exportable="true"
    239       />
    240       <tbl:columndef
    241         id="file"
    242         property="file.name"
    243         datatype="string"
    244         title="File"
    245253        sortable="true"
    246254        filterable="true"
     
    433441            {
    434442              RawBioAssay item = rawBioAssays.next();
     443              RawDataType rdt = item.getRawDataType();
    435444              int itemId = item.getId();
    436445              String openSharePopup = "shareItem("+itemId+")";
     
    479488                <tbl:cell column="spots"><%=item.getSpots()%></tbl:cell>
    480489                <tbl:cell column="bytes"><%=Values.formatBytes(item.getBytes())%></tbl:cell>
    481                 <tbl:cell column="rawDataType"><%=HTML.encodeTags(item.getRawDataType().getName())%></tbl:cell>
    482                 <tbl:cell column="file"
    483                   ><base:propertyvalue
    484                     item="<%=item%>"
    485                     property="file"
    486                     enableEditLink="<%=mode.hasEditLink()%>"
    487                     enablePropertyLink="<%=mode.hasPropertyLink()%>"
    488                   /></tbl:cell>
     490                <tbl:cell column="rawDataType"><%=HTML.encodeTags(rdt.getName())%></tbl:cell>
     491                <tbl:cell column="celFile">
     492                <%
     493                if (rdt.isAffymetrix())
     494                {
     495                  File celFile = null;
     496                  boolean readCelFile = true;
     497                  try
     498                  {
     499                    celFile = Affymetrix.getCelFile(item);
     500                  }
     501                  catch (PermissionDeniedException ex)
     502                  {
     503                    readCelFile = false;
     504                  }
     505                  %>
     506                  <%=Base.getLinkedFile(ID, celFile, !readCelFile, true, true, root)%>
     507                  <%
     508                }
     509                %>
     510                </tbl:cell>
     511                <tbl:cell column="hasData"><%=item.hasData()%></tbl:cell>
    489512                <tbl:cell column="scan"
    490513                  ><base:propertyvalue
  • trunk/www/views/rawbioassays/view_rawbioassay.jsp

    r2386 r2392  
    3838  import="net.sf.basedb.core.ExtendedProperty"
    3939  import="net.sf.basedb.core.RawBioAssay"
     40  import="net.sf.basedb.core.RawDataType"
     41  import="net.sf.basedb.core.Affymetrix"
    4042  import="net.sf.basedb.core.SpotImages"
    4143  import="net.sf.basedb.core.Scan"
     
    6971%>
    7072<%
     73final String root = request.getContextPath()+"/";
    7174final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
    7275final String ID = sc.getId();
     
    8285  String title = null;
    8386  RawBioAssay rawBioAssay = RawBioAssay.getById(dc, itemId);
     87  RawDataType rawDataType = rawBioAssay.getRawDataType();
    8488 
    8589  final boolean writePermission = rawBioAssay.hasPermission(Permission.WRITE);
     
    9599  boolean readCurrentArrayDesign = true;
    96100  ArrayDesign currentArrayDesign = null;
    97   boolean readCurrentFile = true;
    98   File currentFile = null;
    99101 
    100102  try
     
    129131  {
    130132    readCurrentArrayDesign = false;
    131   }
    132   try
    133   {
    134     currentFile = rawBioAssay.getFile();
    135   }
    136   catch (PermissionDeniedException ex)
    137   {
    138     readCurrentFile = false;
    139133  }
    140134  boolean readCurrentOwner = true;
     
    261255        image="runplugin.gif"
    262256        title="Create spot images&hellip;"
    263         visible="<%=writePermission && (rawBioAssay.getSpots() > 0)%>"
     257        visible="<%=writePermission && (rawBioAssay.getSpots() > 0) && rawDataType.isStoredInDb()%>"
    264258      />
    265259       
     
    287281      <tr>
    288282        <td class="prompt">Raw data type</td>
    289         <td><%=HTML.encodeTags(rawBioAssay.getRawDataType().getName())%></td>
     283        <td><%=HTML.encodeTags(rawDataType.getName())%></td>
     284      </tr>
     285      <tr>
     286        <td class="prompt">Has data</td>
     287        <td><%=rawBioAssay.hasData() ? "yes" : "no" %></td>
    290288      </tr>
    291289      <tr>
     
    293291        <td><%=rawBioAssay.getSpots()%></td>
    294292      </tr>
     293      <%
     294      if (rawDataType.isAffymetrix())
     295      {
     296        boolean readCurrentCelFile = true;
     297        File currentCelFile = null;
     298        try
     299        {
     300          currentCelFile = Affymetrix.getCelFile(rawBioAssay);
     301        }
     302        catch (PermissionDeniedException ex)
     303        {
     304          readCurrentCelFile = false;
     305        }
     306        %>
     307        <tr>
     308          <td class="prompt">CEL file</td>
     309          <td><%=Base.getLinkedFile(ID, currentCelFile, !readCurrentCelFile, true, true, root)%></td>
     310        </tr>
     311        <%
     312      }
     313      %>
    295314      <tr>
    296315        <td class="prompt">Protocol</td>
     
    308327        <td class="prompt">Array design</td>
    309328        <td><%=Base.getEncodedName(currentArrayDesign, !readCurrentArrayDesign, "../../lims/arraydesigns/index.jsp?ID="+ID)%></td>
    310       </tr>
    311       <tr>
    312         <td class="prompt">File</td>
    313         <td><%=Base.getEncodedName(currentFile, !readCurrentFile)%></td>
    314329      </tr>
    315330      <tr>
     
    460475      </t:tab>
    461476     
    462       <t:tab id="rawdata" title="Raw data" />
     477      <t:tab id="rawdata" title="Raw data" visible="<%=rawBioAssay.getSpots() > 0 && rawDataType.isStoredInDb() %>" />
    463478      </t:tabcontrol>
    464479
Note: See TracChangeset for help on using the changeset viewer.