Changeset 3814
- Timestamp:
- Oct 10, 2007, 2:57:07 PM (16 years ago)
- Location:
- branches/filedb
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/filedb/src/core/common-queries.xml
r3804 r3814 2895 2895 </query> 2896 2896 2897 <query id="CHANGE_EXPERIMENT_RAWDATATYPE" type="HQL"> 2898 <sql> 2899 UPDATE ExperimentData 2900 SET rawDataType = :newRawDataType 2901 WHERE rawDataType = :oldRawDataType 2902 </sql> 2903 <description> 2904 A HQL query that changes all raw data type for experiments from 2905 an old value to a new value. 2906 </description> 2907 </query> 2908 2897 2909 2898 2910 </predefined-queries> -
branches/filedb/src/core/net/sf/basedb/core/Affymetrix.java
r3807 r3814 200 200 { 201 201 if (rawBioAssay == null) throw new InvalidUseOfNullException("rawBioAssay"); 202 if (!rawBioAssay. getRawDataType().isAffymetrix())202 if (!rawBioAssay.isPlatform(Platform.AFFYMETRIX)) 203 203 { 204 204 throw new InvalidDataException("Raw data type for " + rawBioAssay.getName() + 205 " is not an Affymetrix raw data type");205 " is not an Affymetrix raw data type"); 206 206 } 207 207 DbControl dc = rawBioAssay.getDbControl(); 208 File celFile = null; 209 try 210 { 211 AnyToAny ata = AnyToAny.getByName(dc, rawBioAssay, CEL_LINK_NAME); 212 if (ata.getToType() == Item.FILE) 213 { 214 celFile = (File)ata.getTo(); 215 } 216 } 217 catch (ItemNotFoundException ex) 218 {} 219 return celFile; 208 return FileStoreUtil.getDataFile(dc, rawBioAssay, DataFileType.AFFYMETRIX_CEL); 220 209 } 221 210 … … 234 223 public static void validateCelAndCdf(RawBioAssay rawBioAssay, ArrayDesign design, boolean required) 235 224 { 236 File celFile = getCelFile(rawBioAssay); 237 File cdfFile = getCdfFile(design); 225 DbControl dc = rawBioAssay.getDbControl(); 226 File celFile = FileStoreUtil.getDataFile(dc, rawBioAssay, DataFileType.AFFYMETRIX_CEL);; 227 File cdfFile = FileStoreUtil.getDataFile(dc, design, DataFileType.AFFYMETRIX_CDF); 238 228 if (celFile != null && cdfFile != null) 239 229 { 240 230 String cdfChipType = cdfFile.getName(); 241 FusionCELData cel = loadCelFile(celFile);242 FusionCDFData cdf = loadCdfFile(cdfFile);231 FusionCELData cel = new CelFileHandler().loadCelFile(celFile); 232 FusionCDFData cdf = new CdfFileHandler().loadCdfFile(cdfFile); 243 233 validateCelAndCdf(cel, cdf, cdfChipType); 244 234 } -
branches/filedb/src/core/net/sf/basedb/core/RawDataType.java
r3807 r3814 56 56 private final boolean isAffymetrix; 57 57 private final int channels; 58 private final int platformId; 59 private final int variantId; 58 60 private String table; 59 61 private RealTable realTable; … … 71 73 String table, List<RawDataProperty> properties, List<IntensityFormula> formulas) 72 74 { 73 this(id, name, description, channels, false, false, table, properties, formulas); 74 } 75 75 this(id, name, description, channels, false, 0, 0, false, table, properties, formulas); 76 } 77 78 /** 79 Create a new raw data type representing a file-only platform. 80 @param platform The platform 81 */ 76 82 RawDataType(PlatformData platform) 77 83 { 78 84 this("platform." + platform.getExternalId(), platform.getName(), 79 85 platform.getDescription(), platform.getChannels(), true, 86 platform.getId(), 0, 80 87 Platform.AFFYMETRIX.equals(platform.getExternalId()), 81 88 null, null, null); 82 89 } 83 90 91 /** 92 Create a new raw data type representing a file-only platform variant. 93 @param variant The platform variant 94 */ 84 95 RawDataType(PlatformVariantData variant) 85 96 { 86 97 this("variant." + variant.getExternalId(), variant.getName(), 87 98 variant.getDescription(), variant.getChannels(), true, 99 variant.getPlatform().getId(), variant.getId(), 88 100 Platform.AFFYMETRIX.equals(variant.getPlatform().getExternalId()), 89 101 null, null, null); … … 91 103 92 104 private RawDataType(String id, String name, String description, int channels, 93 boolean fileOnly, boolean isAffymetrix,105 boolean fileOnly, int platformId, int variantId, boolean isAffymetrix, 94 106 String table, List<RawDataProperty> properties, List<IntensityFormula> formulas) 95 107 { … … 99 111 this.channels = channels; 100 112 this.fileOnly = fileOnly; 113 this.platformId = platformId; 114 this.variantId = variantId; 101 115 this.isAffymetrix = isAffymetrix; 102 116 … … 158 172 /** 159 173 If this raw data type is the Affymetrix raw data type. 160 @deprecated Use --- instead 174 @deprecated Use {@link #getPlatform(DbControl)} and compare 175 the external ID with {@link Platform#AFFYMETRIX} 161 176 */ 162 177 public boolean isAffymetrix() … … 165 180 } 166 181 182 public Platform getPlatform(DbControl dc) 183 { 184 return platformId == 0 ? null : Platform.getById(dc, platformId); 185 } 186 187 public PlatformVariant getVariant(DbControl dc) 188 { 189 return variantId == 0 ? null : PlatformVariant.getById(dc, variantId); 190 } 191 167 192 /** 168 193 Get the name of this raw data type. This value is the same as the -
branches/filedb/src/core/net/sf/basedb/core/RawDataTypes.java
r3807 r3814 161 161 162 162 /** 163 Get a collection with all raw data types that has been defined. 163 Get a collection with all raw data types that has been defined. This method 164 only returns raw data types that are importable to the database. To 165 get file-only raw data types use {@link #getFileOnlyRawDataTypes()} 164 166 @return A <code>Collection</code> containing {@link RawDataType} objects 167 where {@link RawDataType#isStoredInDb()} returns true 165 168 */ 166 169 public static Collection<RawDataType> getRawDataTypes() 167 170 { 168 171 return Collections.unmodifiableCollection(rawDataTypes.values()); 172 } 173 174 /** 175 Get the raw data types that are representations of file-only 176 {@link Platform}:s. 177 @return A <code>Collection</code> containing {@link RawDataType} objects 178 where {@link RawDataType#isStoredInDb()} returns false 179 @since 2.5 180 */ 181 public static Collection<RawDataType> getFileOnlyRawDataTypes() 182 { 183 return Collections.unmodifiableCollection(platformTypes.values()); 169 184 } 170 185 … … 203 218 try 204 219 { 220 session = HibernateUtil.newSession(); 221 tx = HibernateUtil.newTransaction(session); 205 222 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, 206 223 "GET_PLATFORM_FOR_EXTERNAL_ID"); … … 228 245 try 229 246 { 247 session = HibernateUtil.newSession(); 248 tx = HibernateUtil.newTransaction(session); 230 249 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, 231 250 "GET_PLATFORMVARIANT_FOR_EXTERNAL_ID"); -
branches/filedb/src/core/net/sf/basedb/core/Update.java
r3807 r3814 1660 1660 1661 1661 /** 1662 Set a platform for array designs and raw bioassays. 1663 Move CEL and CDF files into FileSet:s 1664 Remove filters on isAffyChip property 1662 <ul> 1663 <li>Set a platform for array designs and raw bioassays 1664 <li>Change experiment raw data type if it is "affymetrix" to "platform.affymetrix" 1665 <li>Move CEL and CDF files into FileSet:s 1666 <li>Remove filters on ArrayDesign.isAffyChip property 1667 <li>Rename filter on RawBioassay.spots property to RawBioassay.numDbSpots 1668 <li>Add READ permission to PLATFORM and DATAFILETYPE for all plug-ins 1669 working with ARRAYDESIGN or RAWBIOASSAY 1670 </ul> 1665 1671 */ 1666 1672 @SuppressWarnings("deprecation") … … 1753 1759 } 1754 1760 1761 // Change raw data type for 'affymetrix' experiments to 'platform.affymetrix' 1762 org.hibernate.Query query = HibernateUtil.getPredefinedSQLQuery(session, 1763 "CHANGE_EXPERIMENT_RAWDATATYPE"); 1764 /* 1765 UPDATE ExperimentData 1766 SET rawDataType = :newRawDataType 1767 WHERE rawDataType = :oldRawDataType 1768 */ 1769 query.setString("oldRawDataType", "affymetrix"); 1770 query.setString("newRawDataType", "platform.affymetrix"); 1771 HibernateUtil.executeUpdate(query); 1772 1755 1773 // Remove filters on the 'affyChip' property 1756 org.hibernate.Queryquery = HibernateUtil.getPredefinedSQLQuery(session,1774 query = HibernateUtil.getPredefinedSQLQuery(session, 1757 1775 "DELETE_PROPERTY_FILTER"); 1758 1776 /* -
branches/filedb/src/core/net/sf/basedb/core/filehandler/AffymetrixFileHandler.java
r3807 r3814 70 70 @param cdfFile The file to load 71 71 @return A FusionCDFData object representing the CDF file 72 @throws ItemNotFoundException If the act aul file is not on the server72 @throws ItemNotFoundException If the actual file is not on the server 73 73 @throws InvalidDataException If the file is not a CDF file 74 74 */ … … 93 93 } 94 94 95 /** 96 Load a CEL file using the Affymetric Fusion SDK. This method 97 checks that the file exists, and read all headers. 98 99 @param celFile The file to load 100 @return A FusionCELData object representing the CEL file 101 @throws ItemNotFoundException If the actual file is not on the server 102 @throws InvalidDataException If the file is not a CEL file 103 */ 95 104 public FusionCELData loadCelFile(File celFile) 96 105 { -
branches/filedb/src/test/TestDirty.java
r3783 r3814 92 92 TestJob.test_delete(jobId); 93 93 TestPluginConfiguration.test_delete(pluginConfigurationId); 94 TestFile.test_delete(fileId);95 94 TestRawBioAssay.test_delete(rawBioAssayId); 96 95 TestArrayDesign.test_delete(arrayDesignId); 96 TestFile.test_delete(fileId); 97 97 TestReporter.test_delete(); 98 98 write("++Testing import of dirty data "+(ok ? "OK" : "Failed")+"\n"); -
branches/filedb/www/views/experiments/edit_experiment.jsp
r3679 r3814 54 54 import="net.sf.basedb.clients.web.util.HTML" 55 55 import="net.sf.basedb.util.Values" 56 import="net.sf.basedb.util.Enumeration" 56 57 import="net.sf.basedb.util.formatter.Formatter" 57 58 import="net.sf.basedb.clients.web.formatter.FormatterFactory" … … 151 152 frm.name.focus(); 152 153 return false; 154 } 155 if (frm.rawdatatype) 156 { 157 if (frm.rawdatatype[frm.rawdatatype.selectedIndex].value == '') 158 { 159 alert("You must select a raw data type"); 160 frm.rawdatatype.focus(); 161 return false; 162 } 153 163 } 154 164 return true; … … 334 344 if (experiment == null) 335 345 { 336 %>337 <select name="rawdatatype" class="required">338 <%339 currentRawDataType = currentRawDataType != null ? currentRawDataType : defaultRawDataType;346 currentRawDataType = currentRawDataType != null ? 347 currentRawDataType : defaultRawDataType; 348 Enumeration<RawDataType, String> rawEnumeration = 349 new Enumeration<RawDataType, String>(); 340 350 for (RawDataType rdt : RawDataTypes.getRawDataTypes()) 341 351 { 352 rawEnumeration.add(rdt, rdt.getName()); 353 } 354 for (RawDataType rdt : RawDataTypes.getFileOnlyRawDataTypes()) 355 { 356 rawEnumeration.add(rdt, rdt.getName()); 357 } 358 rawEnumeration.sortValues(); 359 %> 360 <select name="rawdatatype" class="required unchangeable"> 361 <% 362 for (int i = 0; i < rawEnumeration.size(); ++i) 363 { 364 RawDataType rdt = rawEnumeration.getKey(i); 342 365 String selected = rdt.equals(currentRawDataType) ? "selected" : ""; 343 366 %> … … 413 436 </tr> 414 437 </table> 415 <div align=right> <i><base:icon image="required.gif" /> = required information</i></div> 438 <div align=right> 439 <i><base:icon image="required.gif" /> = required information</i> 440 <%if (experiment == null) {%><br> 441 <i><base:icon image="unchangeable.gif" /> = can't be changed later</i> 442 <%}%> 443 </div> 416 444 </t:tab> 417 445 -
branches/filedb/www/views/experiments/list_experiments.jsp
r3679 r3814 226 226 rawEnumeration.add(rdt.getId(), HTML.encodeTags(rdt.getName())); 227 227 } 228 for (RawDataType rdt : RawDataTypes.getFileOnlyRawDataTypes()) 229 { 230 rawEnumeration.add(rdt.getId(), HTML.encodeTags(rdt.getName())); 231 } 232 rawEnumeration.sortValues(); 228 233 %> 229 234 <tbl:columndef -
branches/filedb/www/views/rawbioassays/list_rawbioassays.jsp
r3807 r3814 282 282 filterable="true" 283 283 exportable="true" 284 /> <% 284 /> 285 <% 285 286 Enumeration<String, String> rawEnumeration = new Enumeration<String, String>(); 286 287 for (RawDataType rdt : RawDataTypes.getRawDataTypes()) … … 288 289 rawEnumeration.add(rdt.getId(), HTML.encodeTags(rdt.getName())); 289 290 } 291 for (RawDataType rdt : RawDataTypes.getFileOnlyRawDataTypes()) 292 { 293 rawEnumeration.add(rdt.getId(), HTML.encodeTags(rdt.getName())); 294 } 295 rawEnumeration.sortValues(); 290 296 %> 291 297 <tbl:columndef
Note: See TracChangeset
for help on using the changeset viewer.