Changeset 3807
- Timestamp:
- Oct 5, 2007, 3:36:13 PM (16 years ago)
- Location:
- branches/filedb
- Files:
-
- 1 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/filedb/config/dist/raw-data-types.xml
r3675 r3807 649 649 </intensity-formula> 650 650 </raw-data-type> 651 652 <raw-data-type 653 id="affymetrix" 654 channels="1" 655 name="Affymetrix" 656 storage="file" 657 > 658 </raw-data-type> 659 651 660 652 <raw-data-type 661 653 id="agilent" -
branches/filedb/src/core/net/sf/basedb/core/Affymetrix.java
r3804 r3807 27 27 import net.sf.basedb.core.data.ReporterData; 28 28 import net.sf.basedb.core.filehandler.CdfFileHandler; 29 import net.sf.basedb.core.filehandler.CelFileHandler; 29 30 import affymetrix.fusion.cdf.FusionCDFData; 30 31 import affymetrix.fusion.cel.FusionCELData; … … 162 163 raw data type 163 164 @throws BaseException If there is another error 164 @deprecated 165 @deprecated Use {@link FileStoreUtil#setDataFile(DbControl, FileStoreEnabled, String, File)} 166 instead with {@link DataFileType#AFFYMETRIX_CEL} as the file 167 type 165 168 */ 166 169 public static void setCelFile(RawBioAssay rawBioAssay, File file) 167 170 throws PermissionDeniedException, InvalidDataException, BaseException 168 171 { 169 // Validate raw bioassay170 172 if (rawBioAssay == null) throw new InvalidUseOfNullException("rawBioAssay"); 171 if (!rawBioAssay.getRawDataType().isAffymetrix())172 {173 throw new InvalidDataException("Raw data type for " + rawBioAssay.getName() +174 " is not an Affymetrix raw data type");175 }176 173 rawBioAssay.checkPermission(Permission.WRITE); 177 174 175 if (!rawBioAssay.isPlatform(Platform.AFFYMETRIX)) 176 { 177 throw new InvalidDataException("Raw bioassay isn't an Affymetrix chip: " + rawBioAssay.getName()); 178 } 178 179 DbControl dc = rawBioAssay.getDbControl(); 179 if (file != null) 180 { 181 // Validate array design 182 ArrayDesign design = rawBioAssay.getArrayDesign(); 183 if (design == null) 184 { 185 throw new InvalidDataException("Raw bioassay " + rawBioAssay.getName() + 186 " must have an array design to set CEL file"); 187 } 188 if (!design.isPlatform(Platform.AFFYMETRIX)) 189 { 190 throw new InvalidDataException("The array design " + design.getName() + 191 " is not an Affymterix design"); 192 } 193 194 // Verify that CEL chip type match CDF type 195 FusionCELData cel = loadCelFile(file); 196 File cdfFile = getCdfFile(design); 197 FusionCDFData cdf = loadCdfFile(cdfFile); 198 validateCelAndCdf(cel, cdf, cdfFile.getName()); 199 200 file.checkPermission(Permission.USE); 201 AnyToAny ata = AnyToAny.getNewOrExisting(dc, rawBioAssay, CEL_LINK_NAME, file, true); 202 if (!ata.isInDatabase()) dc.saveItem(ata); 203 204 // Set headers 205 setHeader(rawBioAssay, "Algorithm", cel.getAlg()); 206 for (int i = 0; i < cel.getNumberAlgorithmParameters(); ++i) 207 { 208 String name = cel.getAlgorithmParameterTag(i); 209 setHeader(rawBioAssay, "Algorithm parameter: " + name, cel.getAlgorithmParameter(name)); 210 } 211 setHeader(rawBioAssay, "Dat header", cel.getDatHeader()); 212 setHeader(rawBioAssay, "Chip type", cel.getChipType()); 213 214 // Set number of spots 215 rawBioAssay.getData().setHasData(true); 216 rawBioAssay.getData().setSpots(cel.getCells()); 217 218 } 219 else 220 { 221 AnyToAny.unlinkFrom(dc, rawBioAssay, CEL_LINK_NAME); 222 rawBioAssay.getData().setHasData(false); 223 rawBioAssay.getData().setSpots(0); 224 } 225 } 226 227 private static void setHeader(RawBioAssay rba, String name, String value) 228 { 229 if (name == null || value == null) return; 230 rba.setHeader(name, value); 180 FileStoreUtil.setDataFile(dc, rawBioAssay, DataFileType.AFFYMETRIX_CEL, file); 181 if (file != null) rawBioAssay.getFileSet().validate(dc, true); 231 182 } 232 183 … … 349 300 @throws InvalidDataException If the file is not a CEL file 350 301 @since 2.4 302 @deprecated Use {@link CdfFileHandler#loadCdfFile(File)} instead 351 303 */ 352 304 public static FusionCELData loadCelFile(File celFile) 353 305 throws InvalidDataException 354 306 { 355 if (celFile == null) throw new InvalidUseOfNullException("celFile"); 356 if (celFile.getLocation() != Location.PRIMARY) 357 { 358 throw new ItemNotFoundException("File data is not online for file '" + 359 celFile.getName() + "'; location=" + celFile.getLocation()); 360 } 361 FusionCELData cel = new FusionCELData(); 362 cel.setFileName(celFile.getName()); 363 cel.setInputStream(celFile.getDownloadStream(0)); 364 if (!cel.readHeader()) 365 { 366 throw new InvalidDataException("Could not read CEL file '" + 367 celFile.getPath()+"': " + cel.getError()); 368 } 369 return cel; 307 return new CelFileHandler().loadCelFile(celFile); 370 308 } 371 309 -
branches/filedb/src/core/net/sf/basedb/core/Application.java
r3783 r3807 468 468 Keyring.init(); 469 469 HibernateUtil.testTransactions(); 470 RawDataTypes.initPlatforms(); 470 471 471 472 // Adding a task that cleans the session control cache at regular intervale -
branches/filedb/src/core/net/sf/basedb/core/ArrayDesign.java
r3804 r3807 299 299 write permission 300 300 @throws InvalidDataException If platform is null 301 @since 2.5 301 302 */ 302 303 public void setPlatform(Platform platform) … … 316 317 @throws PermissionDeniedException If the logged in user doesn't have 317 318 write permission 319 @since 2.5 318 320 */ 319 321 public void setVariant(PlatformVariant variant) … … 337 339 @return TRUE if either the variant of platform matches the 338 340 external ID 341 @since 2.5 339 342 */ 340 343 public boolean isPlatform(String externalId) … … 353 356 If the array design has a platform variant, the setting from the 354 357 variant is returned, otherwise the setting from the platform. 355 @return TRUE if this array design use a file-only platform 358 @return TRUE if this array design use a file-only variant / platform 359 @since 2.5 356 360 */ 357 361 public boolean isFileOnlyPlatform() … … 709 713 } 710 714 715 /** 716 Set the number of features that are stored in files. 717 @param numFeatures The number of features 718 @since 2.5 719 */ 711 720 public void setNumFileFeatures(int numFeatures) 712 721 { -
branches/filedb/src/core/net/sf/basedb/core/FileSet.java
r3804 r3807 538 538 boolean ignore = false; 539 539 boolean isValid = true; 540 boolean invalidRelation = false; 540 541 String errorMessage = null; 541 542 if (handler.isValidator) … … 547 548 catch (Throwable t) 548 549 { 550 invalidRelation = t instanceof InvalidRelationException; 549 551 ignore = t instanceof PermissionDeniedException; 550 552 errors.add(t); 551 553 isValid = false; 552 554 errorMessage = t.getMessage(); 553 if (!ignore ) handler.resetMetadata(dc);555 if (!ignore && !invalidRelation) handler.resetMetadata(dc); 554 556 } 555 557 } 556 if (extractMetadata && handler.isMetadataReader && isValid)558 if (extractMetadata && handler.isMetadataReader && (isValid || invalidRelation)) 557 559 { 558 560 try -
branches/filedb/src/core/net/sf/basedb/core/Platform.java
r3801 r3807 378 378 if (isFileOnly()) 379 379 { 380 // TODO - autogenerate a raw data type in a proper way 381 rdt = new RawDataType(getExternalId(), getName(), getDescription(), getData().getChannels(), 382 "file", null, null, null); 380 rdt = RawDataTypes.getRawDataType("platform." + getExternalId()); 383 381 } 384 382 else -
branches/filedb/src/core/net/sf/basedb/core/PlatformVariant.java
r3800 r3807 408 408 if (isFileOnly()) 409 409 { 410 // TODO - autogenerate a raw data type 411 rdt = new RawDataType(getExternalId(), getName(), getDescription(), getData().getChannels(), 412 "file", null, null, null); 410 rdt = RawDataTypes.getRawDataType("variant." + getExternalId()); 413 411 } 414 412 else -
branches/filedb/src/core/net/sf/basedb/core/RawBioAssay.java
r3804 r3807 102 102 throws BaseException 103 103 { 104 Platform generic = Platform.getById(dc, SystemItems.getId(Platform.GENERIC)); 104 Platform generic = Platform.getByExternalId(dc, 105 rawDataType.isAffymetrix() ? Platform.AFFYMETRIX : Platform.GENERIC); 105 106 return getNew(dc, generic, rawDataType); 106 107 } … … 116 117 } 117 118 118 /*119 119 public static RawBioAssay getNew(DbControl dc, PlatformVariant variant, RawDataType rawDataType) 120 120 { 121 122 } 123 */ 121 RawBioAssay rba = dc.newItem(RawBioAssay.class); 122 rba.setVariant(variant); 123 RawDataType variantRdt = variant.getRawDataType(); 124 rba.setRawDataType(variantRdt != null ? variantRdt : rawDataType); 125 rba.setName("New raw bioassay"); 126 return rba; 127 128 } 124 129 125 130 /** … … 349 354 // ------------------------------------------- 350 355 356 /** 357 Set the platform of the raw bioassay. This method will set the variant 358 to null. Use {@link #setVariant(PlatformVariant)} if you want to 359 set a specific variant. 360 @param platform The new platform 361 @throws PermissionDeniedException If the logged in user doesn't have 362 write permission 363 @throws InvalidDataException If platform is null 364 @since 2.5 365 */ 351 366 public void setPlatform(Platform platform) 352 367 { … … 357 372 } 358 373 374 /** 375 Set the platform and variant of the raw bioassay. This method will 376 automatically set the platform to {@link PlatformVariant#getPlatform()}. 377 378 @param variant The new platform variant, or null to remove 379 the variant and keep the platform as it is 380 @throws PermissionDeniedException If the logged in user doesn't have 381 write permission 382 @since 2.5 383 */ 359 384 public void setVariant(PlatformVariant variant) 360 385 { … … 370 395 } 371 396 } 397 398 /** 399 Check if the platform/variant of this raw bioassay has the 400 given external ID. 401 @param externalId The external ID to match 402 @return TRUE if either the variant of platform matches the 403 external ID 404 @since 2.5 405 */ 406 public boolean isPlatform(String externalId) 407 { 408 if (externalId == null) return false; 409 if (externalId.equals(getData().getPlatform().getExternalId())) return true; 410 if (getData().getVariant() != null) 411 { 412 if (externalId.equals(getData().getVariant().getExternalId())) return true; 413 } 414 return false; 415 } 416 417 /** 418 Check if this raw bioassay uses a file-only platform or variant. 419 If the raw bioassay has a platform variant, the setting from the 420 variant is returned, otherwise the setting from the platform. 421 @return TRUE if this raw bioassay use a file-only variant / platform 422 @since 2.5 423 */ 424 public boolean isFileOnlyPlatform() 425 { 426 if (getData().getVariant() != null) 427 { 428 return getData().getVariant().isFileOnly(); 429 } 430 else 431 { 432 return getData().getPlatform().isFileOnly(); 433 } 434 } 372 435 373 436 /** … … 393 456 checkPermission(Permission.WRITE); 394 457 if (rawDataType == null) throw new InvalidUseOfNullException("rawDataType"); 395 if (getData().get Spots() > 0)458 if (getData().getNumDbSpots() > 0) 396 459 { 397 460 throw new PermissionDeniedException("Not allowed to change the raw data type after raw data has been added"); … … 523 586 checkPermission(Permission.WRITE); 524 587 if (arrayDesign != null) arrayDesign.checkPermission(Permission.USE); 525 if (getData().get Spots() > 0)588 if (getData().getNumDbSpots() > 0) 526 589 { 527 590 throw new PermissionDeniedException("Not allowed to change the array design after raw data has been added"); … … 550 613 checkPermission(Permission.WRITE); 551 614 if (arrayDesign != null) arrayDesign.checkPermission(Permission.USE); 552 if (getData().getSpots() > 0 && arrayDesign != null) 553 { 554 // No need to validate if there is no change 555 if (arrayDesign.getData().equals(getData().getArrayDesign())) return; 556 557 if (getRawDataType().isAffymetrix()) 558 { 559 // Verify CEL and CDF files 560 Affymetrix.validateCelAndCdf(this, arrayDesign, false); 561 } 562 else if (getRawDataType().isStoredInDb()) 563 { 564 validateFeatures(getDbControl(), arrayDesign, true, progress); 565 } 615 616 // No need to validate if there is no change 617 if (arrayDesign == null && getData().getArrayDesign() == null) return; 618 if (arrayDesign != null && arrayDesign.getData().equals(getData().getArrayDesign())) return; 619 620 // Re-validate files 621 if (hasFileSet()) getFileSet().validate(getDbControl(), true); 622 623 // Re-validate data in database if we already have db data 624 if (getData().getNumDbSpots() > 0 && arrayDesign != null) 625 { 626 validateFeatures(getDbControl(), arrayDesign, true, progress); 566 627 } 567 628 getData().setArrayDesign(arrayDesign == null ? null : arrayDesign.getData()); … … 581 642 raw bioassay. 582 643 @return The number of spots 644 @deprecated Use {@link #getNumDbSpots()} or {@link #getNumFileSpots()} 645 instead. This method first checks the database and if not 0, it 646 returns that value, otherwise it returns the number of file spots 583 647 */ 584 648 public int getSpots() 585 649 { 586 return getData().getSpots(); 587 } 650 int dbSpots = getNumDbSpots(); 651 return dbSpots > 0 ? dbSpots : getNumFileSpots(); 652 } 653 654 /** 655 Get the number of spots on this raw bioassay that are 656 stored in the database. 657 @return The number of spots in the database 658 @since 2.5 659 */ 660 public int getNumDbSpots() 661 { 662 return getData().getNumDbSpots(); 663 } 664 665 /** 666 Get the number of spots on this raw bioassay that are 667 stored inside files. 668 @return The number of spots in files 669 @since 2.5 670 */ 671 public int getNumFileSpots() 672 { 673 return getData().getNumFileSpots(); 674 } 675 676 /** 677 Set the number of spots that are stored in files. 678 @param numSpots The number of spots 679 @since 2.5 680 */ 681 public void setNumFileSpots(int numSpots) 682 { 683 checkPermission(Permission.WRITE); 684 getData().setNumFileSpots(numSpots); 685 getData().setHasData(numSpots > 0 || getNumDbSpots() > 0); 686 } 687 588 688 589 689 /** … … 656 756 { 657 757 checkPermission(Permission.WRITE); 658 if (getData().getSpots() > 0)659 {660 throw new PermissionDeniedException("Not allowed to change the headers after raw data has been added");661 }662 758 if (name == null) throw new InvalidUseOfNullException("header.name"); 663 759 if (name.length() > MAX_HEADER_NAME_LENGTH) … … 672 768 getData().getHeaders().put(name, value); 673 769 } 770 771 public void removeHeaders() 772 { 773 checkPermission(Permission.WRITE); 774 getData().getHeaders().clear(); 775 } 776 777 public void removeHeader(String name) 778 { 779 checkPermission(Permission.WRITE); 780 getData().getHeaders().remove(name); 781 } 782 674 783 /** 675 784 Get the names of all raw data headers. The set is sorted by name. … … 819 928 private void validateFeatures(DbControl dc, ArrayDesign design, boolean update, ProgressReporter progress) 820 929 { 821 if (design.isAffyChip())822 {823 throw new InvalidDataException("The array design is an Affymetrix chip: " + design.getName());824 }825 930 if (design.hasFeatures()) 826 931 { -
branches/filedb/src/core/net/sf/basedb/core/RawDataBatcher.java
r3783 r3807 306 306 throws BaseException 307 307 { 308 rawBioAssayData.set Spots(rawBioAssayData.getSpots() + getTotalInsertCount());308 rawBioAssayData.setNumDbSpots(rawBioAssayData.getNumDbSpots() + getTotalInsertCount()); 309 309 rawBioAssayData.setBytes(rawBioAssayData.getBytes() + bytes); 310 rawBioAssayData.setHasData(rawBioAssayData.get Spots() > 0);310 rawBioAssayData.setHasData(rawBioAssayData.getNumDbSpots() > 0); 311 311 if (preloaded != null) preloaded.clear(); 312 312 } … … 441 441 Statement s = HibernateUtil.getConnection(getDbControl().getHibernateSession()).createStatement(); 442 442 s.executeUpdate(sql); 443 rawBioAssayData.set Spots(0);443 rawBioAssayData.setNumDbSpots(0); 444 444 rawBioAssayData.setBytes(0); 445 rawBioAssayData.setHasData( false);445 rawBioAssayData.setHasData(rawBioAssayData.getNumFileSpots() > 0); 446 446 } 447 447 catch (SQLException ex) -
branches/filedb/src/core/net/sf/basedb/core/RawDataType.java
r3783 r3807 29 29 import java.util.Collections; 30 30 31 import net.sf.basedb.core.data.PlatformData; 32 import net.sf.basedb.core.data.PlatformVariantData; 31 33 import net.sf.basedb.core.data.RawData; 32 34 … … 48 50 { 49 51 50 private final boolean isAffymetrix;51 52 private final String id; 52 53 private final String name; 53 54 private final String description; 54 private final String storage;55 private final boolean is StoredInDb;55 private final boolean fileOnly; 56 private final boolean isAffymetrix; 56 57 private final int channels; 57 private finalString table;58 private final List<RawDataProperty> properties;59 private final Map<String, RawDataProperty> namedProperties;60 private final List<IntensityFormula> formulas;61 private final Map<String, IntensityFormula> namedFormulas;62 63 private final RealTable realTable;58 private String table; 59 private RealTable realTable; 60 private List<RawDataProperty> properties; 61 private Map<String, RawDataProperty> namedProperties; 62 private List<IntensityFormula> formulas; 63 private Map<String, IntensityFormula> namedFormulas; 64 64 65 65 66 /** … … 67 68 See the getter methods for a description of the parameters 68 69 */ 69 RawDataType(String id, String name, String description, int channels, String storage, 70 RawDataType(String id, String name, String description, int channels, 71 String table, List<RawDataProperty> properties, List<IntensityFormula> formulas) 72 { 73 this(id, name, description, channels, false, false, table, properties, formulas); 74 } 75 76 RawDataType(PlatformData platform) 77 { 78 this("platform." + platform.getExternalId(), platform.getName(), 79 platform.getDescription(), platform.getChannels(), true, 80 Platform.AFFYMETRIX.equals(platform.getExternalId()), 81 null, null, null); 82 } 83 84 RawDataType(PlatformVariantData variant) 85 { 86 this("variant." + variant.getExternalId(), variant.getName(), 87 variant.getDescription(), variant.getChannels(), true, 88 Platform.AFFYMETRIX.equals(variant.getPlatform().getExternalId()), 89 null, null, null); 90 } 91 92 private RawDataType(String id, String name, String description, int channels, 93 boolean fileOnly, boolean isAffymetrix, 70 94 String table, List<RawDataProperty> properties, List<IntensityFormula> formulas) 71 95 { … … 73 97 this.name = name; 74 98 this.description = description; 75 this.storage = storage;76 99 this.channels = channels; 77 this.isStoredInDb = "database".equals(storage); 78 this.table = isStoredInDb ? table : null; 79 this.properties = properties == null ? null : Collections.unmodifiableList(properties); 80 this.formulas = formulas; 81 this.realTable = isStoredInDb ? new RealTable(table, "raw") : null; 100 this.fileOnly = fileOnly; 101 this.isAffymetrix = isAffymetrix; 82 102 83 // This is an ugly hack to support affymetrix data 84 this.isAffymetrix = "affymetrix".equals(id); 85 86 if (isStoredInDb && table == null) 103 // For database raw data types 104 if (!fileOnly) 87 105 { 88 throw new InvalidDataException("No table specified for raw data type: " + id); 106 if (table == null) 107 { 108 throw new InvalidDataException("No table specified for raw data type: " + id); 109 } 110 this.table = table; 111 this.realTable = new RealTable(table, "raw"); 112 113 // Extended properties (=columns) of the table 114 if (properties == null) 115 { 116 this.properties = null; 117 } 118 else 119 { 120 this.properties = Collections.unmodifiableList(properties); 121 this.namedProperties = new HashMap<String, RawDataProperty>(); 122 for (RawDataProperty property : properties) 123 { 124 if (namedProperties.put(property.getName(), property) != null) 125 { 126 throw new BaseException("RawDataProperty[name="+property.getName()+"] is already defined for raw data type: "+name); 127 } 128 } 129 } 130 131 // Intensity formulas 132 this.formulas = formulas; 133 if (formulas != null) 134 { 135 this.namedFormulas = new HashMap<String, IntensityFormula>(); 136 for (IntensityFormula formula : formulas) 137 { 138 if (namedFormulas.put(formula.getName(), formula) != null) 139 { 140 throw new BaseException("IntensityFormula[name="+formula.getName()+"] is already defined for raw data type: "+name); 141 } 142 } 143 } 89 144 } 90 91 this.namedProperties = new HashMap<String, RawDataProperty>( 92 properties == null ? 0 : properties.size()); 93 if (properties != null) 94 { 95 for (RawDataProperty property : properties) 96 { 97 if (namedProperties.put(property.getName(), property) != null) 98 { 99 throw new BaseException("RawDataProperty[name="+property.getName()+"] is already defined for raw data type: "+name); 100 } 101 } 102 } 103 104 this.namedFormulas = new HashMap<String, IntensityFormula>( 105 formulas == null ? 0 : formulas.size()); 106 if (formulas != null) 107 { 108 for (IntensityFormula formula : formulas) 109 { 110 if (namedFormulas.put(formula.getName(), formula) != null) 111 { 112 throw new BaseException("IntensityFormula[name="+formula.getName()+"] is already defined for raw data type: "+name); 113 } 114 } 115 } 116 } 117 145 } 146 118 147 /** 119 148 Get the id of this raw data type. This value is the same as the … … 129 158 /** 130 159 If this raw data type is the Affymetrix raw data type. 160 @deprecated Use --- instead 131 161 */ 132 162 public boolean isAffymetrix() … … 177 207 178 208 /** 179 If the raw data of this raw data type isstored in the database209 If the raw data of this raw data type can be stored in the database 180 210 or not. 181 211 @see #getTableName() … … 183 213 public boolean isStoredInDb() 184 214 { 185 return isStoredInDb;215 return !fileOnly; 186 216 } 187 217 … … 213 243 214 244 /** 215 Get a list of {@link RawDataProperty} s with definitions for the245 Get a list of {@link RawDataProperty}:s with definitions for the 216 246 extra properties that has been defined for this raw data type. 217 247 -
branches/filedb/src/core/net/sf/basedb/core/RawDataTypes.java
r3679 r3807 26 26 package net.sf.basedb.core; 27 27 28 import net.sf.basedb.core.data.PlatformData; 29 import net.sf.basedb.core.data.PlatformVariantData; 28 30 import net.sf.basedb.core.dbengine.DbEngine; 29 31 import net.sf.basedb.util.Values; 30 32 import net.sf.basedb.util.XMLUtil; 31 33 34 import java.util.HashMap; 32 35 import java.util.HashSet; 33 36 import java.util.List; … … 66 69 private static Map<String, RawDataType> rawDataTypes = null; 67 70 71 private static Map<String, RawDataType> platformTypes = null; 72 68 73 /** 69 74 The DTD which is used to validate the XML file. … … 86 91 } 87 92 93 static synchronized void initPlatforms() 94 { 95 org.hibernate.Session session = null; 96 org.hibernate.Transaction tx = null; 97 98 try 99 { 100 platformTypes = new HashMap<String, RawDataType>(); 101 session = HibernateUtil.newSession(); 102 tx = HibernateUtil.newTransaction(session); 103 104 org.hibernate.Query query = HibernateUtil.createQuery(session, 105 "FROM PlatformData pfd WHERE pfd.fileOnly = true"); 106 for (PlatformData platform : HibernateUtil.loadList(PlatformData.class, query)) 107 { 108 RawDataType rdt = new RawDataType(platform); 109 platformTypes.put(rdt.getId(), rdt); 110 } 111 112 query = HibernateUtil.createQuery(session, 113 "FROM PlatformVariantData pfv WHERE pfv.fileOnly = true"); 114 for (PlatformVariantData variant : HibernateUtil.loadList(PlatformVariantData.class, query)) 115 { 116 RawDataType rdt = new RawDataType(variant); 117 platformTypes.put(rdt.getId(), rdt); 118 } 119 120 } 121 finally 122 { 123 if (tx != null) HibernateUtil.commit(tx); 124 if (session != null) HibernateUtil.close(session); 125 } 126 } 127 88 128 /** 89 129 Unload all settings. … … 94 134 if (rawDataTypes != null) rawDataTypes.clear(); 95 135 rawDataTypes = null; 136 if (platformTypes != null) platformTypes.clear(); 137 platformTypes = null; 96 138 } 97 139 … … 136 178 public static RawDataType getRawDataType(String id) 137 179 { 138 return id == null ? null : rawDataTypes.get(id); 180 if (id == null) return null; 181 if (id.startsWith("platform.")) 182 { 183 return getPlatformRawDataType(id); 184 } 185 else if (id.startsWith("variant.")) 186 { 187 return getVariantRawDataType(id); 188 } 189 else 190 { 191 return rawDataTypes.get(id); 192 } 193 } 194 195 196 private static RawDataType getPlatformRawDataType(String id) 197 { 198 RawDataType rdt = platformTypes.get(id); 199 if (rdt != null) return rdt; 200 201 org.hibernate.Session session = null; 202 org.hibernate.Transaction tx = null; 203 try 204 { 205 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, 206 "GET_PLATFORM_FOR_EXTERNAL_ID"); 207 query.setString("externalId", id.substring(9)); 208 PlatformData platform = HibernateUtil.loadData(PlatformData.class, query); 209 if (platform == null || !platform.isFileOnly()) return null; 210 rdt = new RawDataType(platform); 211 platformTypes.put(id, rdt); 212 } 213 finally 214 { 215 if (tx != null) HibernateUtil.commit(tx); 216 if (session != null) HibernateUtil.close(session); 217 } 218 return rdt; 219 } 220 221 private static RawDataType getVariantRawDataType(String id) 222 { 223 RawDataType rdt = platformTypes.get(id); 224 if (rdt != null) return rdt; 225 226 org.hibernate.Session session = null; 227 org.hibernate.Transaction tx = null; 228 try 229 { 230 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, 231 "GET_PLATFORMVARIANT_FOR_EXTERNAL_ID"); 232 query.setString("externalId", id.substring(9)); 233 PlatformVariantData variant = HibernateUtil.loadData(PlatformVariantData.class, query); 234 if (variant == null || !variant.isFileOnly()) return null; 235 rdt = new RawDataType(variant); 236 platformTypes.put(id, rdt); 237 } 238 finally 239 { 240 if (tx != null) HibernateUtil.commit(tx); 241 if (session != null) HibernateUtil.close(session); 242 } 243 return rdt; 139 244 } 140 245 … … 182 287 usedNames.add("table:" + table); 183 288 } 289 else 290 { 291 throw new ConfigurationException("Attribute storage='" + storage + 292 "' is no longer supported. Please remove declaration for <rawdatatype id='" + id + 293 "'> from " + Application.getRawDataTypesFile()); 294 } 184 295 if (channels <= 0) 185 296 { … … 189 300 List<RawDataProperty> properties = loadProperties(el, channels); 190 301 List<IntensityFormula> formulas = loadIntensityFormulas(el, channels); 191 RawDataType rdt = new RawDataType(id, name, description, channels, storage, table, properties, formulas); 302 RawDataType rdt = new RawDataType(id, name, description, channels, 303 table, properties, formulas); 192 304 rawDataTypes.put(id, rdt); 193 305 } -
branches/filedb/src/core/net/sf/basedb/core/Update.java
r3804 r3807 1763 1763 HibernateUtil.executeUpdate(query); 1764 1764 1765 // Change filter with 'spots' to 'numDbSpots' 1766 query = HibernateUtil.getPredefinedSQLQuery(session, 1767 "UPDATE_PROPERTY_FILTER"); 1768 /* 1769 UPDATE PropertyFilters pf 1770 SET pf.property = :newProperty 1771 WHERE pf.property = :oldProperty 1772 */ 1773 query.setString("oldProperty", "spots"); 1774 query.setString("newProperty", "numDbSpots"); 1775 HibernateUtil.executeUpdate(query); 1776 1765 1777 // Add READ permission to PLATFORM and DATAFILETYPE for all plug-ins 1766 1778 // working with ARRAYDESIGN or RAWBIOASSAY -
branches/filedb/src/core/net/sf/basedb/core/data/RawBioAssayData.java
r3783 r3807 83 83 Get the platform this raw bioassay uses. 84 84 @since 2.5 85 @hibernate.many-to-one outer-join="false" update="false"85 @hibernate.many-to-one outer-join="false" 86 86 @hibernate.column name="`platform_id`" not-null="true" 87 87 */ … … 99 99 Get the platform variant this raw bioassay uses, or null. 100 100 @since 2.5 101 @hibernate.many-to-one outer-join="false" update="false"101 @hibernate.many-to-one outer-join="false" 102 102 @hibernate.column name="`variant_id`" 103 103 */ … … 212 212 private int spots; 213 213 /** 214 The number of data spots in this raw bio assay. 214 The number of data spots in this raw bio assay, that 215 are stored in the database. 215 216 @hibernate.property column="`spots`" type="int" not-null="true" 216 */ 217 public int getSpots() 217 @since 2.5 218 */ 219 public int getNumDbSpots() 218 220 { 219 221 return spots; 220 222 } 221 public void set Spots(int spots)223 public void setNumDbSpots(int spots) 222 224 { 223 225 this.spots = spots; 224 226 } 225 227 228 private int fileSpots; 229 /** 230 The number of spots on this raw bioassay that are stored inside 231 files. 232 @hibernate.property column="`file_spots`" type="int" not-null="true" 233 @since 2.5 234 */ 235 public int getNumFileSpots() 236 { 237 return fileSpots; 238 } 239 public void setNumFileSpots(int fileSpots) 240 { 241 this.fileSpots = fileSpots; 242 } 243 226 244 private long bytes; 227 245 /** -
branches/filedb/src/core/net/sf/basedb/core/filehandler/AffymetrixFileHandler.java
r3802 r3807 25 25 26 26 import affymetrix.fusion.cdf.FusionCDFData; 27 import affymetrix.fusion.cel.FusionCELData; 27 28 import net.sf.basedb.core.File; 28 29 import net.sf.basedb.core.FileStoreEnabled; … … 92 93 } 93 94 95 public FusionCELData loadCelFile(File celFile) 96 { 97 if (celFile == null) throw new InvalidUseOfNullException("celFile"); 98 if (celFile.getLocation() != Location.PRIMARY) 99 { 100 throw new ItemNotFoundException("File data is not online for file '" + 101 celFile.getName() + "'; location=" + celFile.getLocation()); 102 } 103 FusionCELData cel = new FusionCELData(); 104 cel.setFileName(celFile.getName()); 105 cel.setInputStream(celFile.getDownloadStream(0)); 106 if (!cel.readHeader()) 107 { 108 throw new InvalidDataException("Could not read CEL file '" + 109 celFile.getPath()+"': " + cel.getError()); 110 } 111 return cel; 112 } 94 113 } -
branches/filedb/src/core/net/sf/basedb/core/filehandler/CdfFileHandler.java
r3802 r3807 66 66 if (!isAffymetrix(design)) 67 67 { 68 throw new InvalidDataException("Array design '" + design +68 throw new InvalidDataException("Array design '" + design.getName() + 69 69 "' is not using the Affymetrix platform"); 70 70 } -
branches/filedb/src/core/net/sf/basedb/core/filehandler/CelFileHandler.java
r3802 r3807 24 24 package net.sf.basedb.core.filehandler; 25 25 26 import affymetrix.fusion.cdf.FusionCDFData; 27 import affymetrix.fusion.cel.FusionCELData; 28 import net.sf.basedb.core.ArrayDesign; 29 import net.sf.basedb.core.DataFileType; 26 30 import net.sf.basedb.core.DbControl; 31 import net.sf.basedb.core.File; 32 import net.sf.basedb.core.FileSetMember; 33 import net.sf.basedb.core.FileStoreUtil; 34 import net.sf.basedb.core.InvalidDataException; 35 import net.sf.basedb.core.InvalidRelationException; 36 import net.sf.basedb.core.Platform; 37 import net.sf.basedb.core.RawBioAssay; 38 import net.sf.basedb.core.StringUtil; 27 39 28 40 /** … … 38 50 implements DataFileValidator, DataFileMetadataReader 39 51 { 52 private FusionCELData celData; 40 53 41 54 public CelFileHandler() 42 55 {} 43 56 57 /* 58 From the DataFileValidator interface 59 ---------------------------------------- 60 */ 61 /** 62 Check that the raw bioassay is using the Affymetrix platform 63 ({@link Platform#AFFYMETRIX}) and that the file selected 64 as the CEL file really is a CEL file. 65 */ 44 66 public void validate(DbControl dc) 45 67 { 68 RawBioAssay rba = (RawBioAssay)getItem(); 69 // Check platform 70 if (!isAffymetrix(rba)) 71 { 72 throw new InvalidDataException("Raw bioassay '" + rba.getName() + 73 "' is not using the Affymetrix platform"); 74 } 75 76 // Get the member for CEL file type 77 FileSetMember celMember = getMember(DataFileType.AFFYMETRIX_CEL); 78 if (celMember != null) 79 { 80 // Verify CEL file 81 File celFile = celMember.getFile(); 82 celData = loadCelFile(celFile); 83 } 84 85 // The CEL file is valid, a failure below will result in InvalidRelationException 86 try 87 { 88 ArrayDesign design = rba.getArrayDesign(); 89 if (design == null) 90 { 91 throw new InvalidDataException("Raw bioassay " + rba.getName() + 92 " has no array design"); 93 } 94 if (!design.isPlatform(Platform.AFFYMETRIX)) 95 { 96 throw new InvalidDataException("The array design " + design.getName() + 97 " is not an Affymterix design"); 98 } 99 100 // Verify that CEL chip type match CDF type 101 File cdfFile = FileStoreUtil.getDataFile(dc, design, DataFileType.AFFYMETRIX_CDF); 102 FusionCDFData cdfData = loadCdfFile(cdfFile); 103 validateCelAndCdf(celData, cdfData, cdfFile.getName()); 104 } 105 catch (Throwable t) 106 { 107 throw new InvalidRelationException(t); 108 } 46 109 47 110 } 111 // ------------------------------------------- 48 112 113 /* 114 From the DataFileMetadataReader interface 115 ---------------------------------------- 116 */ 49 117 public void extractMetadata(DbControl dc) 50 118 { 51 119 if (celData == null) 120 { 121 FileSetMember celMember = getMember(DataFileType.AFFYMETRIX_CEL); 122 if (celMember != null) celData = loadCelFile(celMember.getFile()); 123 } 124 if (celData != null) 125 { 126 RawBioAssay rba = (RawBioAssay)getItem(); 127 setHeader(rba, "Algorithm", celData.getAlg()); 128 for (int i = 0; i < celData.getNumberAlgorithmParameters(); ++i) 129 { 130 String name = celData.getAlgorithmParameterTag(i); 131 setHeader(rba, "Algorithm parameter: " + name, 132 celData.getAlgorithmParameter(name)); 133 } 134 setHeader(rba, "Dat header", celData.getDatHeader()); 135 setHeader(rba, "Chip type", celData.getChipType()); 136 137 // Set number of spots 138 rba.setNumFileSpots(celData.getCells()); 139 } 52 140 } 53 141 142 /** 143 Reset the number of file spots to 0, and remove all headers. 144 */ 54 145 public void resetMetadata(DbControl dc) 55 146 { 56 147 RawBioAssay rba = (RawBioAssay)getItem(); 148 rba.setNumFileSpots(0); 149 rba.removeHeaders(); 150 } 151 // ------------------------------------------- 152 153 private void setHeader(RawBioAssay rba, String name, String value) 154 { 155 if (name == null || value == null) return; 156 value = StringUtil.trimString(value, RawBioAssay.MAX_HEADER_VALUE_LENGTH); 157 rba.setHeader(name, value); 57 158 } 58 159 160 private static void validateCelAndCdf(FusionCELData cel, FusionCDFData cdf, String cdfChipType) 161 throws InvalidDataException 162 { 163 String celChipType = cel.getChipType(); 164 if (!cdfChipType.startsWith(celChipType)) 165 { 166 throw new InvalidDataException("CEL chip type (" + celChipType + 167 ") doesn't match CDF chip type (" + cdfChipType + ")"); 168 } 169 170 if (cel.getRows() != cdf.getHeader().getRows() || cel.getCols() != cdf.getHeader().getRows()) 171 { 172 throw new InvalidDataException("CEL size (rows=" + cel.getRows() + ", cols=" + cel.getCols() + 173 ") doesn't match CDF size (rows=" + 174 cdf.getHeader().getRows() + ", cols=" + cdf.getHeader().getCols()+")"); 175 } 176 } 177 178 59 179 } -
branches/filedb/src/core/net/sf/basedb/core/filehandler/DataFileValidator.java
r3802 r3807 27 27 import net.sf.basedb.core.DbControl; 28 28 import net.sf.basedb.core.InvalidDataException; 29 import net.sf.basedb.core.InvalidRelationException; 29 30 import net.sf.basedb.core.PermissionDeniedException; 30 31 … … 49 50 or a subclass if the file is not a valid file. {@link PermissionDeniedException}:s 50 51 are ignored by the core and will not change the validation status. 52 An exception of type {@link InvalidRelationException} is thrown 53 the file itself is valid, but a related file that it depends on is not. The 54 core will still mark the file as invalid and store the error message, 55 but metadata extraction will still be performed. 51 56 52 57 @param dc A DbControl object that can be used for database … … 54 59 @throws InvalidDataException If the validator detects an invalid 55 60 file 61 @throws InvalidRelationException If the validator detects that the 62 file is valid but another file that it depends on is not, metadata 63 extract will still happen 56 64 */ 57 65 public void validate(DbControl dc) 58 throws InvalidDataException ;66 throws InvalidDataException, InvalidRelationException; 59 67 } -
branches/filedb/www/common/datafiles/select_files.jsp
r3802 r3807 180 180 181 181 <form name="datafiles"> 182 <table class="form" cellspacing="2" border="0" cellpadding="0" width="100%">183 182 <% 184 if (deniedPlatform) 183 if (fileTypes.size() == 0) 184 { 185 %> 186 <div class="error"> 187 The <%=platform == null ? "" : "'" + HTML.encodeTags(platform.getName()) + "'" %> 188 platform doesn't define any file types for <%=itemType.toString() %> 189 items. 190 </div> 191 <% 192 } 193 else if (deniedPlatform) 185 194 { 186 195 %> … … 188 197 <% 189 198 } 190 %> 191 <% 192 for (DataFileType dft : fileTypes) 193 { 194 PlatformFileType pft = platform == null ? 195 null : platform.getFileType(dft, variant); 196 boolean isRequired = pft == null ? false : pft.isRequired(); 197 FileSetMember member = fileSet == null || !fileSet.hasMember(dft) ? 198 null : fileSet.getMember(dft); 199 File file = null; 200 boolean deniedFile = false; 201 if (member != null) 199 else 200 { 201 %> 202 <table class="form" cellspacing="2" border="0" cellpadding="0" width="100%"> 203 <% 204 for (DataFileType dft : fileTypes) 202 205 { 203 try 206 PlatformFileType pft = platform == null ? 207 null : platform.getFileType(dft, variant); 208 boolean isRequired = pft == null ? false : pft.isRequired(); 209 FileSetMember member = fileSet == null || !fileSet.hasMember(dft) ? 210 null : fileSet.getMember(dft); 211 File file = null; 212 boolean deniedFile = false; 213 if (member != null) 204 214 { 205 file = member.getFile(); 215 try 216 { 217 file = member.getFile(); 218 } 219 catch (PermissionDeniedException ex) 220 { 221 deniedFile = true; 222 } 206 223 } 207 catch (PermissionDeniedException ex) 224 225 String path = ""; 226 if (file != null) 208 227 { 209 deniedFile = true;228 path = file.getPath().toString(); 210 229 } 211 } 212 213 String path = ""; 214 if (file != null) 215 { 216 path = file.getPath().toString(); 217 } 218 else if (deniedFile || deniedPlatform) 219 { 220 path = "- denied -"; 221 } 222 String inputName= "datafile."+dft.getId(); 223 recentFiles = (List<File>)cc.getRecent(dc, Item.FILE, dft.getExternalId()); 224 %> 225 <tr> 226 <td class="prompt"><%=HTML.encodeTags(dft.getName())%></td> 227 <td> 228 <table border="0" cellspacing="0" cellpadding="0"> 229 <tr> 230 <td> 231 <input <%=isRequired ? requiredClazz : clazz%> type="text" 232 name="<%=inputName%>" value="<%=HTML.encodeTags(path)%>" 233 size="50" title="<%=HTML.encodeTags(dft.getDescription())%>" 234 <%=deniedFile || deniedPlatform ? "disabled" : "" %> 235 onchange="fileOnChange('<%=inputName%>')"> 236 </td> 237 <td><base:button 238 title="Browse…" 239 onclick="<%="browseOnClick('"+inputName+"')"%>" 240 disabled="<%=deniedFile || deniedPlatform %>" 241 /> 242 </td> 243 </tr> 244 </table> 245 </td> 246 </tr> 247 <tr> 248 <td align="right"></td> 249 <td> 250 <% 251 if (recentFiles != null && recentFiles.size() > 0) 230 else if (deniedFile || deniedPlatform) 252 231 { 253 %> 254 <select name="recent.<%=inputName%>" onchange="recentOnChange('<%=inputName%>')"> 255 <option value="">- recently used - 232 path = "- denied -"; 233 } 234 String inputName= "datafile."+dft.getId(); 235 recentFiles = (List<File>)cc.getRecent(dc, Item.FILE, dft.getExternalId()); 236 %> 237 <tr> 238 <td class="prompt"><%=HTML.encodeTags(dft.getName())%></td> 239 <td> 240 <table border="0" cellspacing="0" cellpadding="0"> 241 <tr> 242 <td> 243 <input <%=isRequired ? requiredClazz : clazz%> type="text" 244 name="<%=inputName%>" value="<%=HTML.encodeTags(path)%>" 245 size="50" title="<%=HTML.encodeTags(dft.getDescription())%>" 246 <%=deniedFile || deniedPlatform ? "disabled" : "" %> 247 onchange="fileOnChange('<%=inputName%>')"> 248 </td> 249 <td><base:button 250 title="Browse…" 251 onclick="<%="browseOnClick('"+inputName+"')"%>" 252 disabled="<%=deniedFile || deniedPlatform %>" 253 /> 254 </td> 255 </tr> 256 </table> 257 </td> 258 </tr> 259 <tr> 260 <td align="right"></td> 261 <td> 256 262 <% 257 for (File recent : recentFiles)263 if (recentFiles != null && recentFiles.size() > 0) 258 264 { 259 265 %> 260 <option value="<%=recent.getId()%>"><%=HTML.encodeTags(recent.getPath().toString())%> 266 <select name="recent.<%=inputName%>" onchange="recentOnChange('<%=inputName%>')"> 267 <option value="">- recently used - 268 <% 269 for (File recent : recentFiles) 270 { 271 %> 272 <option value="<%=recent.getId()%>"><%=HTML.encodeTags(recent.getPath().toString())%> 273 <% 274 } 275 %> 276 </select> 261 277 <% 262 278 } 263 279 %> 264 </select> 265 <% 266 } 267 %> 268 </td> 280 </td> 281 </tr> 282 <% 283 } 284 %> 285 <tr> 286 <td class="prompt">Validate</td> 287 <td><input type="checkbox" value="1" name="datafiles.validate"></td> 269 288 </tr> 289 <tr> 290 <td class="prompt">Extract metadata</td> 291 <td><input type="checkbox" value="1" name="datafiles.metadata"></td> 292 </tr> 293 </table> 270 294 <% 271 295 } 272 296 %> 273 <tr>274 <td class="prompt">Validate</td>275 <td><input type="checkbox" value="1" name="datafiles.validate"></td>276 </tr>277 <tr>278 <td class="prompt">Extract metadata</td>279 <td><input type="checkbox" value="1" name="datafiles.metadata"></td>280 </tr>281 </table>282 297 283 298 </form> -
branches/filedb/www/include/scripts/platforms.js
r3802 r3807 54 54 } 55 55 } 56 } 56 } 57 58 this.getPlatformById = function(id) 59 { 60 return allPlatforms['ID'+id]; 61 } 62 63 this.populateList = function(list, platformId, variantId) 64 { 65 for (var p = 0; p < allPlatforms.length; p++) 66 { 67 var platform = allPlatforms[p]; 68 var option = new Option(platform.name, platform.id, false, platformId == platform.id && !variantId); 69 list[list.length] = option; 70 option.className = 'selectoptionheader'; 71 for (var v = 0; v < platform.variants.length; v++) 72 { 73 var variant = platform.variants[v]; 74 option = new Option(variant.name, platform.id + ':' + variant.id, false, platformId == platform.id && variantId == variant.id); 75 option.className = 'selectoptionindent'; 76 list[list.length] = option; 77 } 78 } 79 } 80 81 this.getSelectedPlatform = function(list) 82 { 83 if (list.length == 0 || list.selectedIndex < 0) return null; 84 var pv = list[list.selectedIndex].value.split(':'); 85 return this.getPlatformById(pv[0]); 86 } 87 88 this.getSelectedVariant = function(list) 89 { 90 if (list.length == 0 || list.selectedIndex < 0) return null; 91 var pv = list[list.selectedIndex].value.split(':'); 92 if (pv.length < 2) return null; 93 var platform = this.getPlatformById(pv[0]); 94 return platform.getVariantById(pv[1]); 95 } 96 97 } 98 99 var allPlatforms = new Array(); 100 function Platform(id, externalId, name, fileOnly, rawDataType) 101 { 102 this.id = id; 103 this.externalId = externalId; 104 this.name = name; 105 this.fileOnly = fileOnly; 106 this.rawDataType = rawDataType; 107 this.variants = new Array(); 108 109 allPlatforms[allPlatforms.length] = this; 110 allPlatforms['ID'+id] = this; 111 112 this.getVariantById = function(id) 113 { 114 return this.variants['ID'+id]; 115 } 116 } 117 118 function Variant(platform, id, externalId, name, fileOnly, rawDataType) 119 { 120 this.platform = platform; 121 this.id = id; 122 this.externalId = externalId; 123 this.name = name; 124 this.fileOnly = fileOnly; 125 this.rawDataType = rawDataType; 126 127 platform.variants[platform.variants.length] = this; 128 platform.variants['ID'+id] = this; 57 129 } 58 130 59 131 60 132 133 -
branches/filedb/www/lims/arraydesigns/edit_design.jsp
r3802 r3807 37 37 import="net.sf.basedb.core.Platform" 38 38 import="net.sf.basedb.core.PlatformVariant" 39 import="net.sf.basedb.core. Affymetrix"39 import="net.sf.basedb.core.RawDataType" 40 40 import="net.sf.basedb.core.ItemQuery" 41 41 import="net.sf.basedb.core.ItemResultList" … … 153 153 function switchTab(tabControlId, tabId) 154 154 { 155 var frm = document.forms['design']; 155 156 if (TabControl.setActiveTab(tabControlId, tabId)) 156 157 { … … 169 170 else if (tabId == 'datafiles' && (platformChanged || !dataFilesLoaded)) 170 171 { 171 var platform Id = getPlatform();172 var variant Id = getVariant();173 Platforms.loadDataFilesFrame(frames.datafiles, '<%=ID%>', '<%=itemType.name()%>', <%=design == null ? 0 : design.getId()%>, platform Id, variantId);172 var platform = Platforms.getSelectedPlatform(frm.platform); 173 var variant = Platforms.getSelectedVariant(frm.platform); 174 Platforms.loadDataFilesFrame(frames.datafiles, '<%=ID%>', '<%=itemType.name()%>', <%=design == null ? 0 : design.getId()%>, platform == null ? 0 : platform.id, variant == null ? 0 : variant.id); 174 175 dataFilesLoaded = true; 175 176 platformChanged = false; … … 183 184 } 184 185 185 function getPlatform()186 {187 var frm = document.forms['design'];188 if (frm.platform.length == 0) return 0;189 var pv = frm.platform[frm.platform.selectedIndex].value.split(':');190 return pv[0];191 }192 193 function getVariant()194 {195 var frm = document.forms['design'];196 if (frm.platform.length == 0) return 0;197 var pv = frm.platform[frm.platform.selectedIndex].value.split(':');198 return pv.length > 1 ? pv[1] : null;199 }200 201 186 function platformOnChange() 202 187 { … … 221 206 function initPlatforms(platformId, variantId) 222 207 { 223 var platforms = new Array();224 var variants = new Array();225 208 <% 226 209 for (Platform p : platforms) 227 210 { 211 RawDataType rdt = p.isFileOnly() ? null : p.getRawDataType(); 228 212 %> 229 platforms[platforms.length] = { name:'<%=p.getName()%>', id:<%=p.getId()%> }; 230 variants['platform.<%=p.getId()%>'] = new Array(); 213 var p<%=p.getId()%> = new Platform(<%=p.getId()%>, '<%=HTML.javaScriptEncode(p.getExternalId())%>', '<%=HTML.javaScriptEncode(p.getName())%>', <%=p.isFileOnly()%>, '<%=rdt == null ? "" : rdt.getId()%>'); 231 214 <% 232 215 } 233 216 for (PlatformVariant v : variants) 234 217 { 218 RawDataType rdt = v.isFileOnly() ? null : v.getRawDataType(); 235 219 Platform p = v.getPlatform(); 236 String index = "platform." + p.getId();237 220 %> 238 var iants['<%=index%>'][variants['<%=index%>'].length] = { name:'<%=v.getName()%>', id:<%=v.getId()%> };221 var v<%=v.getId()%> = new Variant(p<%=p.getId()%>, <%=v.getId()%>, '<%=HTML.javaScriptEncode(v.getExternalId())%>', '<%=HTML.javaScriptEncode(v.getName())%>', <%=v.isFileOnly()%>, '<%=rdt == null ? "" : rdt.getId()%>'); 239 222 <% 240 223 } 241 224 %> 242 225 var frm = document.forms['design']; 243 for (var p = 0; p < platforms.length; p++) 244 { 245 var platform = platforms[p]; 246 var index = 'platform.' + platform.id; 247 var option = new Option(platform.name, platform.id, false, platformId == platform.id && !variantId); 248 frm.platform[frm.platform.length] = option; 249 option.className = 'selectoptionheader'; 250 for (var v = 0; v < variants[index].length; v++) 251 { 252 var variant = variants[index][v]; 253 option = new Option(variant.name, platform.id + ':' + variant.id, false, platformId == platform.id && variantId == variant.id); 254 option.className = 'selectoptionindent'; 255 frm.platform[frm.platform.length] = option; 256 } 257 } 226 Platforms.populateList(frm.platform, platformId, variantId); 258 227 } 259 228 </script> … … 278 247 <td class="prompt">Platform</td> 279 248 <td> 280 <select name="platform" onchange="platformOnChange()" <%=deniedPlatform ? "disabled" : "" %>> 249 <select name="platform" onchange="platformOnChange()" class="required" 250 <%=deniedPlatform ? "disabled" : "" %>> 281 251 <% 282 252 if (deniedPlatform) -
branches/filedb/www/lims/arraydesigns/list_designs.jsp
r3801 r3807 252 252 exportable="true" 253 253 show="always" 254 />255 <tbl:columndef256 id="affyChip"257 property="affyChip"258 datatype="boolean"259 title="Affy chip"260 sortable="true"261 filterable="true"262 exportable="true"263 />264 <tbl:columndef265 id="cdfFile"266 title="CDF file"267 254 /> 268 255 <tbl:columndef … … 549 536 enablePropertyLink="<%=mode.hasPropertyLink()%>" 550 537 /></tbl:cell> 551 <tbl:cell column="affyChip"><%=item.isAffyChip()%></tbl:cell>552 <tbl:cell column="cdfFile">553 <%554 if (item.isAffyChip())555 {556 File cdfFile = null;557 boolean readCdfFile = true;558 try559 {560 cdfFile = Affymetrix.getCdfFile(item);561 }562 catch (PermissionDeniedException ex)563 {564 readCdfFile = false;565 }566 %>567 <%=Base.getLinkedFile(ID, cdfFile, !readCdfFile, true, true, root)%>568 <%569 }570 %>571 </tbl:cell>572 538 <tbl:cell column="hasFeatures"><%=item.hasFeatures() ? "yes" : "no"%></tbl:cell> 573 539 <tbl:cell column="numDbFeatures"><%=item.getNumDbFeatures()%></tbl:cell> -
branches/filedb/www/views/rawbioassays/edit_rawbioassay.jsp
r3679 r3807 36 36 import="net.sf.basedb.core.Permission" 37 37 import="net.sf.basedb.core.RawBioAssay" 38 import="net.sf.basedb.core.Affymetrix" 38 import="net.sf.basedb.core.Platform" 39 import="net.sf.basedb.core.PlatformVariant" 39 40 import="net.sf.basedb.core.Scan" 40 41 import="net.sf.basedb.core.Protocol" … … 52 53 import="net.sf.basedb.core.PermissionDeniedException" 53 54 import="net.sf.basedb.core.BaseException" 55 import="net.sf.basedb.core.query.Orders" 56 import="net.sf.basedb.core.query.Hql" 54 57 import="net.sf.basedb.clients.web.Base" 55 58 import="net.sf.basedb.clients.web.util.HTML" … … 74 77 RawBioAssay rawBioAssay = null; 75 78 String name = null; 76 boolean readCurrentCelFile = true; 77 File currentCelFile = null; 79 boolean hasDbSpots = false; 80 81 boolean deniedPlatform = false; 82 Platform currentPlatform = null; 83 PlatformVariant currentVariant = null; 84 78 85 boolean readCurrentScan = true; 79 86 Scan currentScan = null; … … 131 138 title = "Create raw bioassay"; 132 139 cc.removeObject("item"); 140 141 int currentPlatformId = Values.getInt(cc.getPropertyValue("platform"), 0); 142 if (currentPlatformId == 0) 143 { 144 currentPlatformId = Values.getInt(cc.getRecent(Item.PLATFORM.name(), 0), 0); 145 } 146 if (currentPlatformId != 0) currentPlatform = Platform.getById(dc, currentPlatformId); 147 133 148 currentRawDataType = RawDataTypes.getRawDataType(cc.getPropertyValue("rawDataType")); 134 149 if (currentRawDataType == null) … … 182 197 { 183 198 rawBioAssay = RawBioAssay.getById(dc, itemId); 199 rawBioAssay.checkPermission(Permission.WRITE); 200 hasDbSpots = rawBioAssay.getNumDbSpots() > 0; 184 201 cc.setObject("item", rawBioAssay); 185 202 name = rawBioAssay.getName(); … … 187 204 title = "Edit raw bioassay -- " + HTML.encodeTags(rawBioAssay.getName()); 188 205 189 if (currentRawDataType.isAffymetrix())190 {191 try192 {193 currentCelFile = Affymetrix.getCelFile(rawBioAssay);194 }195 catch (PermissionDeniedException ex)196 {197 readCurrentCelFile = false;198 }199 }200 201 206 try 202 207 { 208 currentPlatform = rawBioAssay.getPlatform(); 209 currentVariant = rawBioAssay.getVariant(); 210 } 211 catch (PermissionDeniedException ex) 212 { 213 deniedPlatform = true; 214 } 215 216 try 217 { 203 218 currentScan = rawBioAssay.getScan(); 204 219 } … … 232 247 } 233 248 } 234 if (rawBioAssay != null) rawBioAssay.checkPermission(Permission.WRITE); 249 250 ItemQuery<Platform> platformQuery = Platform.getQuery(); 251 platformQuery.order(Orders.asc(Hql.property("name"))); 252 platformQuery.setCacheResult(true); 253 ItemResultList<Platform> platforms = platformQuery.list(dc); 254 255 ItemQuery<PlatformVariant> variantQuery = PlatformVariant.getQuery(); 256 variantQuery.order(Orders.asc(Hql.property("name"))); 257 variantQuery.setCacheResult(true); 258 ItemResultList<PlatformVariant> variants = variantQuery.list(dc); 259 235 260 final String clazz = "class=\"text\""; 236 261 final String requiredClazz = "class=\"text required\""; … … 238 263 239 264 <base:page type="popup" title="<%=title%>"> 240 <base:head scripts="tabcontrol.js,annotations.js " styles="tabcontrol.css">265 <base:head scripts="tabcontrol.js,annotations.js,platforms.js" styles="tabcontrol.css"> 241 266 <script language="JavaScript"> 242 267 // Validate the "RawBioAssay" tab … … 249 274 frm.name.focus(); 250 275 return false; 251 }252 if (frm.rawdatatype)253 {254 var rawDataType = frm.rawdatatype[frm.rawdatatype.selectedIndex].value;255 if (isAffymetrix[rawDataType])256 {257 var celFileId = frm.celfile_id[frm.celfile_id.selectedIndex].value;258 var arrayDesignId = frm.arraydesign_id[frm.arraydesign_id.selectedIndex].value;259 if (celFileId != 0 && arrayDesignId == 0)260 {261 alert('You must select an array design if a CEL file is specified');262 return false;263 }264 }265 276 } 266 277 return true; … … 281 292 Annotations.addInheritedAnnotationsToForm(frames.inheritedAnnotations, frm); 282 293 } 294 if (dataFilesLoaded) 295 { 296 Platforms.addDataFilesToForm(frames.datafiles, frm); 297 } 283 298 frm.submit(); 284 299 } … … 289 304 var parentsChanged = false; 290 305 var protocolChanged = false; 306 var dataFilesLoaded = false; 307 var platformChanged = false; 291 308 function switchTab(tabControlId, tabId) 292 309 { 310 var frm = document.forms['rawbioassay']; 293 311 if (TabControl.setActiveTab(tabControlId, tabId)) 294 312 { … … 306 324 parentsChanged = false; 307 325 } 308 } 309 } 310 326 else if (tabId == 'datafiles' && (platformChanged || !dataFilesLoaded)) 327 { 328 var platform = Platforms.getSelectedPlatform(frm.platform); 329 var variant = Platforms.getSelectedVariant(frm.platform); 330 Platforms.loadDataFilesFrame(frames.datafiles, '<%=ID%>', '<%=itemType.name()%>', <%=rawBioAssay == null ? 0 : rawBioAssay.getId()%>, platform == null ? 0 : platform.id, variant == null ? 0 : variant.id); 331 dataFilesLoaded = true; 332 platformChanged = false; 333 } 334 } 335 } 336 337 function platformOnChange() 338 { 339 var frm = document.forms['rawbioassay']; 340 platformChanged = true; 341 var platform = Platforms.getSelectedPlatform(frm.platform); 342 var variant = Platforms.getSelectedVariant(frm.platform); 343 var fileOnly = (variant != null && variant.fileOnly) || 344 (variant == null && platform.fileOnly); 345 var rawDataType = variant == null ? platform.rawDataType : variant.rawDataType; 346 if (frm.rawdatatype[frm.rawdatatype.length - 1].value == '') 347 { 348 frm.rawdatatype[frm.rawdatatype.length - 1] = null; 349 } 350 if (fileOnly) 351 { 352 frm.rawdatatype.disabled = true; 353 Main.removeClass(frm.rawdatatype, 'required'); 354 frm.rawdatatype[frm.rawdatatype.length] = new Option('- file only -', ''); 355 frm.rawdatatype.selectedIndex = frm.rawdatatype.length - 1; 356 } 357 else if (rawDataType) 358 { 359 frm.rawdatatype.disabled = true; 360 Main.removeClass(frm.rawdatatype, 'required'); 361 Forms.selectListOption(frm.rawdatatype, rawDataType); 362 } 363 else 364 { 365 frm.rawdatatype.disabled = false; 366 Main.addClass(frm.rawdatatype, 'required'); 367 } 368 } 369 311 370 function getProtocolId() 312 371 { … … 426 485 { 427 486 var frm = document.forms['rawbioassay']; 428 var url = '../../lims/arraydesigns/index.jsp?ID=<%=ID%>& mode=selectone&callback=setArrayDesignCallback';487 var url = '../../lims/arraydesigns/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setArrayDesignCallback'; 429 488 if (frm.arraydesign_id.length > 1) 430 489 { … … 432 491 url += '&item_id='+id; 433 492 } 493 var platform = Platforms.getSelectedPlatform(frm.platform); 494 url += '&filter:INT:platform='+platform.id; 434 495 Main.openPopup(url, 'SelectArrayDesign', 1000, 700); 435 496 } … … 448 509 } 449 510 450 var isAffymetrix = new Array();451 <%452 for (RawDataType rdt : RawDataTypes.getRawDataTypes())453 {454 %>455 isAffymetrix['<%=rdt.getId()%>'] = <%=rdt.isAffymetrix() ? "true" : "false" %>;456 <%457 }458 %>459 460 function selectCelFileOnClick()461 {462 var frm = document.forms['rawbioassay'];463 464 if (frm.rawdatatype)465 {466 var rawDataType = frm.rawdatatype[frm.rawdatatype.selectedIndex].value;467 if (!isAffymetrix[rawDataType])468 {469 alert('CEL-files are only used for Affymetrix data types.');470 return;471 }472 }473 474 var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setCelFileCallback';475 if (frm.celfile_id.length > 1)476 {477 var id = Math.abs(parseInt(frm.celfile_id[1].value));478 url += '&item_id='+id;479 }480 url += '&filter:STRING:name=%25.cel';481 Main.openPopup(url, 'SelectFile', 1000, 700);482 }483 function setCelFileCallback(id, name)484 {485 var frm = document.forms['rawbioassay'];486 var list = frm.celfile_id;487 if (list.length < 2 || list[1].value == '0') // >488 {489 Forms.addListOption(list, 1, new Option());490 }491 list[1].value = id;492 list[1].text = name;493 list.selectedIndex = 1;494 }495 496 function rawDataTypeOnChange()497 {498 var frm = document.forms['rawbioassay'];499 if (frm.rawdatatype)500 {501 var rawDataType = frm.rawdatatype[frm.rawdatatype.selectedIndex].value;502 if (isAffymetrix[rawDataType])503 {504 frm.celfile_id.disabled = false;505 }506 else507 {508 frm.celfile_id.disabled = true;509 }510 }511 }512 513 511 function init() 514 512 { … … 523 521 } 524 522 %> 525 rawDataTypeOnChange(); 523 initPlatforms(<%=currentPlatform == null ? 0 : currentPlatform.getId()%>, <%=currentVariant == null ? 0 : currentVariant.getId()%>); 524 platformOnChange(); 525 } 526 527 function initPlatforms(platformId, variantId) 528 { 529 <% 530 for (Platform p : platforms) 531 { 532 RawDataType rdt = p.isFileOnly() ? null : p.getRawDataType(); 533 %> 534 var p<%=p.getId()%> = new Platform(<%=p.getId()%>, '<%=HTML.javaScriptEncode(p.getExternalId())%>', '<%=HTML.javaScriptEncode(p.getName())%>', <%=p.isFileOnly()%>, '<%=rdt == null ? "" : rdt.getId()%>'); 535 <% 536 } 537 for (PlatformVariant v : variants) 538 { 539 RawDataType rdt = v.isFileOnly() ? null : v.getRawDataType(); 540 Platform p = v.getPlatform(); 541 %> 542 var v<%=v.getId()%> = new Variant(p<%=p.getId()%>, <%=v.getId()%>, '<%=HTML.javaScriptEncode(v.getExternalId())%>', '<%=HTML.javaScriptEncode(v.getName())%>', <%=v.isFileOnly()%>, '<%=rdt == null ? "" : rdt.getId()%>'); 543 <% 544 } 545 %> 546 var frm = document.forms['rawbioassay']; 547 Platforms.populateList(frm.platform, platformId, variantId); 526 548 } 527 549 </script> … … 544 566 </tr> 545 567 <tr> 546 <td class="prompt"> Raw data type</td>568 <td class="prompt">Platform</td> 547 569 <td> 570 <select name="platform" onchange="platformOnChange()" class="required" 571 <%=deniedPlatform || hasDbSpots ? "disabled" : "" %>> 548 572 <% 549 if ( rawBioAssay == null || !rawBioAssay.hasData())573 if (deniedPlatform) 550 574 { 551 575 %> 552 <select name="rawdatatype" class="required" onchange="rawDataTypeOnChange()"> 553 <% 554 for (RawDataType rdt : RawDataTypes.getRawDataTypes()) 555 { 556 String selected = rdt.equals(currentRawDataType) ? "selected" : ""; 557 %> 558 <option value="<%=rdt.getId()%>" <%=selected%>><%=HTML.encodeTags(rdt.getName())%> 559 <% 560 } 561 %> 562 </select> 563 <% 564 } 565 else 566 { 567 %> 568 <%=HTML.encodeTags(currentRawDataType.getName())%> 576 <option value="-1">- denied - 569 577 <% 570 578 } 571 579 %> 572 580 </select> 581 </td> 582 </tr> 583 <tr> 584 <td class="prompt">Raw data type</td> 585 <td> 586 <select name="rawdatatype" class="required" 587 <%=hasDbSpots ? "disabled" : "" %>> 588 <% 589 for (RawDataType rdt : RawDataTypes.getRawDataTypes()) 590 { 591 String selected = rdt.equals(currentRawDataType) ? "selected" : ""; 592 %> 593 <option value="<%=rdt.getId()%>" <%=selected%>><%=HTML.encodeTags(rdt.getName())%> 594 <% 595 } 596 %> 597 </select> 573 598 </td> 574 599 </tr> … … 577 602 <td class="prompt">Array design</td> 578 603 <td> 579 <% 580 //if (rawBioAssay == null || !rawBioAssay.hasData()) 581 { 582 %> 583 <base:select 584 id="arraydesign_id" 585 clazz="selectionlist" 586 required="false" 587 current="<%=currentArrayDesign%>" 588 denied="<%=!readCurrentArrayDesign%>" 589 recent="<%=recentArrayDesigns%>" 590 defaultitem="<%=defaultArrayDesign%>" 591 newitem="<%=rawBioAssay == null%>" 592 onselect="selectArrayDesignOnClick()" 593 onchange="arrayDesignOnChange()" 594 /> 595 <% 596 } 597 /* 598 else 599 { 600 %> 601 <%=readCurrentArrayDesign ? 602 (currentArrayDesign != null ? HTML.encodeTags(currentArrayDesign.getName()) : "<i>- none -</i>") 603 : "<i>- denied - </i>"%> 604 <% 605 } 606 */ 607 %> 604 <base:select 605 id="arraydesign_id" 606 clazz="selectionlist" 607 required="false" 608 current="<%=currentArrayDesign%>" 609 denied="<%=!readCurrentArrayDesign%>" 610 recent="<%=recentArrayDesigns%>" 611 defaultitem="<%=defaultArrayDesign%>" 612 newitem="<%=rawBioAssay == null%>" 613 onselect="selectArrayDesignOnClick()" 614 onchange="arrayDesignOnChange()" 615 /> 608 616 </td> 609 617 </tr> 610 <%611 if (rawBioAssay == null || !rawBioAssay.hasData() || rawBioAssay.getRawDataType().isAffymetrix())612 {613 %>614 <tr id="celFile">615 <td class="prompt">CEL file</td>616 <td>617 <base:select618 id="celfile_id"619 clazz="selectionlist"620 required="false"621 current="<%=currentCelFile%>"622 denied="<%=!readCurrentCelFile%>"623 recent="<%=recentFiles%>"624 newitem="<%=rawBioAssay == null%>"625 onselect="selectCelFileOnClick()"626 />627 </td>628 </tr>629 <%630 }631 %>632 618 633 619 <tr> … … 691 677 <div align=right> <i><base:icon image="required.gif" /> = required information</i></div> 692 678 </t:tab> 679 680 <t:tab id="datafiles" title="Data files" helpid="datafiles.edit"> 681 <iframe name="datafiles" id="idDatafiles" src="../../common/datafiles/wait.jsp" 682 width="100%" height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0 683 marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe> 684 </t:tab> 693 685 694 686 <t:tab id="annotations" title="Annotations & parameters" -
branches/filedb/www/views/rawbioassays/index.jsp
r3679 r3807 43 43 import="net.sf.basedb.core.RawDataType" 44 44 import="net.sf.basedb.core.RawDataTypes" 45 import="net.sf.basedb.core.Platform" 46 import="net.sf.basedb.core.PlatformVariant" 45 47 import="net.sf.basedb.core.User" 46 48 import="net.sf.basedb.core.Path" … … 78 80 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 79 81 <%! 80 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name, rawDataType,spots,description");82 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,platform,variant,hasData,description"); 81 83 private static final Item itemType = Item.RAWBIOASSAY; 82 84 … … 214 216 dc = sc.newDbControl(); 215 217 RawBioAssay rba = (RawBioAssay)cc.getObject("item"); 218 219 Platform platform = null; 220 PlatformVariant variant = null; 221 if (request.getParameter("platform") != null) 222 { 223 String[] pv = request.getParameter("platform").split(":"); 224 int platformId = Values.getInt(pv[0], -1); 225 int variantId = pv.length > 1 ? Values.getInt(pv[1], -1) : -1; 226 if (platformId > 0) platform = Platform.getById(dc, platformId); 227 if (variantId > 0) variant = PlatformVariant.getById(dc, variantId); 228 } 229 216 230 RawDataType rdt = RawDataTypes.getRawDataType(Values.getStringOrNull(request.getParameter("rawdatatype"))); 217 231 if (rdt != null) cc.setRecent("RawDataType", rdt.getId(), maxRecent); … … 219 233 if (rba == null) 220 234 { 221 rba = RawBioAssay.getNew(dc, rdt); 235 if (variant != null) 236 { 237 rba = RawBioAssay.getNew(dc, variant, rdt); 238 } 239 else 240 { 241 rba = RawBioAssay.getNew(dc, platform, rdt); 242 } 222 243 message = "Raw bioassay created"; 223 244 dc.saveItem(rba); … … 225 246 else 226 247 { 248 dc.reattachItem(rba); 227 249 if (rdt != null) rba.setRawDataType(rdt); 228 dc.reattachItem(rba); 250 if (variant != null) 251 { 252 rba.setVariant(variant); 253 } 254 else if (platform != null) 255 { 256 rba.setPlatform(platform); 257 } 229 258 message = "Raw bioassay updated"; 230 259 } … … 258 287 { 259 288 ad = arrayDesignId == 0 ? null : ArrayDesign.getById(dc, arrayDesignId); 260 if (rba. getSpots() > 0)289 if (rba.hasData()) 261 290 { 262 291 if (rba.getRawDataType().isStoredInDb() && ad != null && ad.hasFeatures()) … … 280 309 if (ad != null) cc.setRecent(ad, maxRecent); 281 310 } 282 rdt = rba.getRawDataType(); 283 if (rdt.isAffymetrix()) 284 { 285 int celFileId = Values.getInt(request.getParameter("celfile_id"), -1); 286 if (celFileId >= 0) // < 0 = denied or unchanged 287 { 288 File celFile = celFileId == 0 ? null : File.getById(dc, celFileId); 289 Affymetrix.setCelFile(rba, celFile); 290 } 291 } 292 311 312 // Data files tab 313 boolean validate = Values.getBoolean(request.getParameter("datafiles.validate")); 314 boolean metadata = Values.getBoolean(request.getParameter("datafiles.metadata")); 315 Base.updateFiles(dc, rba, request, validate, metadata, cc, maxRecent); 316 293 317 // Annotations tab 294 318 Base.updateAnnotations(dc, rba, rba, request); -
branches/filedb/www/views/rawbioassays/list_rawbioassays.jsp
r3679 r3807 32 32 import="net.sf.basedb.core.Item" 33 33 import="net.sf.basedb.core.RawBioAssay" 34 import="net.sf.basedb.core.Platform" 34 35 import="net.sf.basedb.core.RawDataType" 35 36 import="net.sf.basedb.core.RawDataTypes" … … 89 90 { 90 91 final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); 91 final ItemQuery<RawBioAssay> query = Base.getConfiguredQuery(cc, true, RawBioAssay.getQuery(), mode);92 92 93 93 // Query for experiments relatated to the current raw bioassay … … 98 98 experimentQuery.order(Orders.asc(Hql.property("name"))); 99 99 100 // Get all platforms 101 final ItemQuery<Platform> platformQuery = Platform.getQuery(); 102 platformQuery.order(Orders.asc(Hql.property("name"))); 103 platformQuery.setCacheResult(true); 104 Enumeration<String, String> platforms = new Enumeration<String, String>(); 105 for (Platform p : platformQuery.list(dc)) 106 { 107 platforms.add(Integer.toString(p.getId()), p.getName()); 108 } 109 100 110 Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); 101 111 annotationTypes = annotationTypeQuery.list(dc); 102 112 try 103 113 { 114 final ItemQuery<RawBioAssay> query = Base.getConfiguredQuery(cc, true, RawBioAssay.getQuery(), mode); 104 115 rawBioAssays = query.iterate(dc); 105 116 } 106 117 catch (Throwable t) 107 118 { 119 t.printStackTrace(); 108 120 cc.setMessage(t.getMessage()); 109 121 } … … 250 262 show="always" 251 263 /> 252 <% 264 <tbl:columndef 265 id="platform" 266 property="platform" 267 sortproperty="platform.name" 268 exportproperty="platform.name" 269 datatype="int" 270 enumeration="<%=platforms%>" 271 title="Platform" 272 sortable="true" 273 filterable="true" 274 exportable="true" 275 /> 276 <tbl:columndef 277 id="variant" 278 property="variant.name" 279 datatype="string" 280 title="Variant" 281 sortable="true" 282 filterable="true" 283 exportable="true" 284 /> <% 253 285 Enumeration<String, String> rawEnumeration = new Enumeration<String, String>(); 254 286 for (RawDataType rdt : RawDataTypes.getRawDataTypes()) … … 277 309 /> 278 310 <tbl:columndef 279 id=" spots"280 property=" spots"311 id="numDbSpots" 312 property="numDbSpots" 281 313 datatype="int" 282 title="Spots" 283 sortable="true" 284 filterable="true" 285 exportable="true" 286 /> 287 <tbl:columndef 288 id="celFile" 289 title="CEL file" 290 /> 314 title="Db spots" 315 sortable="true" 316 filterable="true" 317 exportable="true" 318 /> 319 <tbl:columndef 320 id="numFileSpots" 321 property="numFileSpots" 322 datatype="int" 323 title="File spots" 324 sortable="true" 325 filterable="true" 326 exportable="true" 327 /> 291 328 <tbl:columndef 292 329 id="bytes" … … 560 597 onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)" 561 598 title="<%=tooltip%>"><%=name%></div></tbl:cell> 562 <tbl:cell column="spots"><%=item.getSpots()%></tbl:cell> 599 <tbl:cell column="numDbSpots"><%=item.getNumDbSpots()%></tbl:cell> 600 <tbl:cell column="numFileSpots"><%=item.getNumFileSpots()%></tbl:cell> 563 601 <tbl:cell column="bytes"><%=Values.formatBytes(item.getBytes())%></tbl:cell> 564 <tbl:cell column="rawDataType"><%=HTML.encodeTags(rdt.getName())%></tbl:cell> 565 <tbl:cell column="celFile"> 566 <% 567 if (rdt.isAffymetrix()) 568 { 569 File celFile = null; 570 boolean readCelFile = true; 571 try 572 { 573 celFile = Affymetrix.getCelFile(item); 574 } 575 catch (PermissionDeniedException ex) 576 { 577 readCelFile = false; 578 } 579 %> 580 <%=Base.getLinkedFile(ID, celFile, !readCelFile, true, true, root)%> 581 <% 582 } 583 %> 584 </tbl:cell> 602 <tbl:cell column="platform" 603 ><base:propertyvalue 604 item="<%=item%>" 605 property="platform" 606 enableEditLink="<%=mode.hasEditLink()%>" 607 enablePropertyLink="<%=mode.hasPropertyLink()%>" 608 /></tbl:cell> 609 <tbl:cell column="variant" 610 ><base:propertyvalue 611 item="<%=item%>" 612 property="variant" 613 enableEditLink="<%=mode.hasEditLink()%>" 614 enablePropertyLink="<%=mode.hasPropertyLink()%>" 615 /></tbl:cell> <tbl:cell column="rawDataType"><%=HTML.encodeTags(rdt.getName())%></tbl:cell> 585 616 <tbl:cell column="hasData"><%=item.hasData()%></tbl:cell> 586 617 <tbl:cell column="scan" -
branches/filedb/www/views/rawbioassays/view_rawbioassay.jsp
r3679 r3807 265 265 </tr> 266 266 <tr> 267 <td class="prompt">Platform</td> 268 <td><base:propertyvalue item="<%=rawBioAssay%>" property="platform" /></td> 269 </tr> 270 <tr> 271 <td class="prompt">Variant</td> 272 <td><base:propertyvalue item="<%=rawBioAssay%>" property="variant" /></td> 273 </tr> 274 <tr> 267 275 <td class="prompt">Raw data type</td> 268 276 <td><%=HTML.encodeTags(rawDataType.getName())%></td> 269 277 </tr> 270 278 <tr> 271 <td class="prompt">Has data</td>272 <td><%=rawBioAssay.hasData() ? "yes" : "no" %></td>273 </tr>274 <tr>275 279 <td class="prompt">Spots</td> 276 <td><%=rawBioAssay.getSpots()%></td> 277 </tr> 278 <% 279 if (rawDataType.isAffymetrix()) 280 { 281 boolean readCurrentCelFile = true; 282 File currentCelFile = null; 283 try 284 { 285 currentCelFile = Affymetrix.getCelFile(rawBioAssay); 286 } 287 catch (PermissionDeniedException ex) 288 { 289 readCurrentCelFile = false; 290 } 291 %> 292 <tr> 293 <td class="prompt">CEL file</td> 294 <td><%=Base.getLinkedFile(ID, currentCelFile, !readCurrentCelFile, true, true, root)%></td> 295 </tr> 296 <% 297 } 298 %> 280 <td><%=rawBioAssay.hasData() ? "yes (db: " + rawBioAssay.getNumDbSpots() + 281 "; file: " + rawBioAssay.getNumFileSpots() + ")" : "no"%></td> 282 </tr> 299 283 <tr> 300 284 <td class="prompt">Protocol</td> … … 388 372 </table> 389 373 390 <h4>Raw data headers</h4> 391 <table class="form" cellspacing="0"> 374 <jsp:include page="../../common/datafiles/list_files.jsp"> 375 <jsp:param name="item_type" value="<%=itemType.name()%>" /> 376 <jsp:param name="item_id" value="<%=itemId%>" /> 377 <jsp:param name="ID" value="<%=ID%>" /> 378 </jsp:include> 379 392 380 <% 393 381 Set<String> names = rawBioAssay.getHeaderNames(); 394 boolean needsTr = true; 395 if (names != null) 396 { 397 for (String name : names) 382 %> 383 <base:section 384 id="headers" 385 title="<%="Raw data headers (" + (names == null ? 0 : names.size()) + ")"%>" 386 context="<%=cc%>" 387 > 388 <table class="form" cellspacing="0"> 389 <% 390 boolean needsTr = true; 391 if (names != null) 398 392 { 393 for (String name : names) 394 { 395 %> 396 <%=needsTr ? "<tr valign=\"top\">" : "" %> 397 <td class="prompt"><%=HTML.encodeTags(name)%></td> 398 <td><%=HTML.encodeTags(rawBioAssay.getHeader(name))%></td> 399 <td> </td> 400 <%=needsTr ? "" : "</tr>"%> 401 <% 402 needsTr = !needsTr; 403 } 399 404 %> 400 <%=needsTr ? "<tr valign=\"top\">" : "" %>401 <td class="prompt"><%=HTML.encodeTags(name)%></td>402 <td><%=HTML.encodeTags(rawBioAssay.getHeader(name))%></td>403 <td> </td>404 405 <%=needsTr ? "" : "</tr>"%> 405 406 <% 406 needsTr = !needsTr;407 407 } 408 408 %> 409 <%=needsTr ? "" : "</tr>"%> 410 <% 411 } 412 %> 413 </table> 409 </table> 410 </base:section> 414 411 415 412 <% … … 429 426 { 430 427 %> 431 <h4 class="docked">Experiments</h4> 432 <tbl:table 428 <base:section 433 429 id="experiments" 434 clazz="itemlist"435 co lumns="all"430 title="<%="Experiments (" + experiments.size() + ")"%>" 431 context="<%=cc%>" 436 432 > 437 <tbl:columndef 438 id="name" 439 title="Name" 440 /> 441 <tbl:columndef 442 id="description" 443 title="Description" 444 /> 445 <tbl:data> 446 <tbl:columns> 447 </tbl:columns> 448 <tbl:rows> 449 <% 450 for (Experiment item : experiments) 451 { 433 <h4 class="docked">Experiments</h4> 434 <tbl:table 435 id="experiments" 436 clazz="itemlist" 437 columns="all" 438 > 439 <tbl:columndef 440 id="name" 441 title="Name" 442 /> 443 <tbl:columndef 444 id="description" 445 title="Description" 446 /> 447 <tbl:data> 448 <tbl:columns> 449 </tbl:columns> 450 <tbl:rows> 451 <% 452 for (Experiment item : experiments) 453 { 454 %> 455 <tbl:row> 456 <tbl:cell column="name"><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> 457 <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> 458 </tbl:row> 459 <% 460 } 452 461 %> 453 <tbl:row> 454 <tbl:cell column="name"><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell> 455 <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> 456 </tbl:row> 457 <% 458 } 459 %> 460 </tbl:rows> 461 </tbl:data> 462 </tbl:table> 462 </tbl:rows> 463 </tbl:data> 464 </tbl:table> 465 </base:section> 463 466 <% 464 467 } … … 473 476 { 474 477 %> 475 <h4 class="docked">Shared to</h4> 478 <base:section 479 id="sharedTo" 480 title="Shared to" 481 context="<%=cc%>"> 476 482 <tbl:table 477 483 id="itemsSharedTo" … … 542 548 </tbl:data> 543 549 </tbl:table> 550 </base:section> 544 551 <% 545 552 }
Note: See TracChangeset
for help on using the changeset viewer.