Changeset 555
- Timestamp:
- Jan 28, 2008, 11:48:07 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/net/sf/basedb/illumina/src/net/sf/basedb/illumina/install/Install.java
r554 r555 29 29 import net.sf.basedb.core.DataFileType; 30 30 import net.sf.basedb.core.DbControl; 31 import net.sf.basedb.core.FileType; 31 32 import net.sf.basedb.core.InvalidDataException; 32 33 import net.sf.basedb.core.Item; … … 43 44 import net.sf.basedb.core.RequestInformation; 44 45 import net.sf.basedb.core.StringParameterType; 46 import net.sf.basedb.core.SystemItems; 45 47 import net.sf.basedb.core.plugin.About; 46 48 import net.sf.basedb.core.plugin.AboutImpl; … … 111 113 ( 112 114 "installSnp", 113 " InstallSNP variant",114 "T he SNP variant of Illumina should be installed?",115 "SNP variant", 116 "TRUE if he SNP variant of Illumina should be installed, FALSE otherwise.", 115 117 new BooleanParameterType(true, true) 116 118 ); … … 118 120 ( 119 121 "installExp1", 120 " Install Expression1 variant",121 "T he Expression1 variant of Illumina should be installed?",122 "Expression 1", 123 "TRUE if the Expression 1 variant of Illumina should be installed, FALSE otherwise.", 122 124 new BooleanParameterType(true, true) 123 125 ); … … 125 127 ( 126 128 "installExp2", 127 " Install Expression2 variant",128 "T he Expression2 variant of Illumina should be installed?",129 "Expression2", 130 "TRUE if the Expression 2 variant of Illumina should be installed, FALSE otherwise", 129 131 new BooleanParameterType(true, true) 130 132 ); … … 134 136 135 137 private static final String BGX_FILEYTPE_EXTENSION = "bgx"; 136 private static final String SCANDATA_FILETYPE_EXTENSION = ""; 137 private static final String SNP_FILETYPE_EXTENSION = ""; 138 private static final String SCANDATA_FILETYPE_EXTENSION = ""; //TODO 139 private static final String SNP_FILETYPE_EXTENSION = ""; //TODO 138 140 139 141 private static final PluginParameter<String> alreadyInstalledErrorParameter = new PluginParameter<String>( 140 142 "alreadyInstalledError", 141 "Platform or any of the selected variants is already installed", 142 "How to situations where the platform or any of the selected variants " + 143 "already exists in the database." + 144 "If not specified, default value will be used.\n\n" + 143 "Item already exists.", 144 "How to act when an external id is taken for either the platform or any of the selected variants." + 145 "If not specified, default value(skip) will be used.\n\n" + 145 146 "abort = Abort the installation, nothing will be created.\n" + 146 "skip = Installation of the already existing item will be skipped" +147 "and t he installation tries to proceed with rest of the items.",147 "skip = The installation will skip the existing item " + 148 "and try to proceed.", 148 149 new StringParameterType(255, SKIP_OPTION, true, 1, 0, 0, 149 150 Arrays.asList( new String[] { ABORT_OPTION, SKIP_OPTION})) … … 198 199 boolean installExp2 = (Boolean)job.getValue("installExp2"); 199 200 String alreadyExistingItem = (String)job.getValue("alreadyInstalledError"); 200 201 201 202 HashSet<Integer> expressionTypes = new HashSet<Integer>(); 202 203 if (installExp1) expressionTypes.add(1); … … 299 300 public void installIlluminaItems(boolean installSNP, HashSet<Integer> expressionTypes, boolean ignoreExistingItems, ProgressReporter progress) 300 301 throws ItemAlreadyExistsException 301 { 302 { 303 RawDataType illuminaRawDataType = RawDataTypes.getRawDataType("illumina_scandata"); 304 if (illuminaRawDataType == null) 305 { 306 throw new InvalidDataException("Raw data type[illumina.scandata] is missing. " + 307 "This must exist before the items can be installed, see the Illumina plug-in manual."); 308 } 302 309 DbControl dc = null; 303 310 int largestNumOfStrips = 0; … … 309 316 String bgxFileTypeId = "illumina.bgx"; 310 317 318 FileType reporterMapType = null; 319 FileType rawDataType = null; 320 311 321 Iterator<Integer> expressionTypeIterator = expressionTypes.iterator(); 312 322 while(expressionTypeIterator.hasNext()) … … 320 330 dc = sc.newDbControl(); 321 331 332 reporterMapType = FileType.getById(dc, SystemItems.getId("net.sf.basedb.core.FileType.REPORTER_MAP")); 333 rawDataType = FileType.getById(dc, SystemItems.getId("net.sf.basedb.core.FileType.RAW_DATA")); 334 322 335 List<DataFileType> expressionDataFileTypes = new ArrayList<DataFileType>(); 323 336 DataFileType dft = createDataFileType(dc, bgxFileTypeId, "BGX file", Item.ARRAYDESIGN, BGX_FILEYTPE_EXTENSION, ignoreExistingItems); 324 dft.setDescription("Illumina BGX file"); 337 if (dft.getDescription() == null || dft.getDescription().equals(""))dft.setDescription("Illumina BGX file"); 338 if (dft.getGenericType() == null) dft.setGenericType(reporterMapType); 325 339 expressionDataFileTypes.add(dft); 326 340 327 341 for (int i = 1; i <= largestNumOfStrips; i++ ) 328 342 { 329 String name = "Scandata filetype" + i;343 String name = "Scandata " + i; 330 344 dft = createDataFileType(dc, scandataFileTypePrefix + i, name, Item.RAWBIOASSAY, SCANDATA_FILETYPE_EXTENSION, ignoreExistingItems); 331 dft.setDescription("Illumina scandata file"); 345 if (dft.getGenericType() == null) dft.setGenericType(rawDataType); 346 if (dft.getDescription() == null || dft.getDescription().equals("")) dft.setDescription("Illumina scandata file for strip #" + i + " in the array."); 332 347 expressionDataFileTypes.add(dft); 333 348 } … … 338 353 dc = sc.newDbControl(); 339 354 Platform illuminaPlatform = createPlatform(dc, illuminaPlatformExternalId, "Illumina", ignoreExistingItems); 355 if (illuminaPlatform.getDescription() == null || illuminaPlatform.getDescription().equals("")) illuminaPlatform.setDescription("Illumina platform."); 340 356 341 357 List<PlatformVariant> platformVariants = new ArrayList<PlatformVariant>(); 342 String namePrefix = " Illumina expression";358 String namePrefix = "Expression "; 343 359 for (int type : expressionTypes) 344 360 { 345 361 PlatformVariant pfv = createPlatformVariant(dc, expExternalIdPrefix + type, namePrefix + type, 346 illuminaPlatform, RawDataTypes.getRawDataType("illumina.scandata"), ignoreExistingItems);347 pfv.setDescription("Platform variant to use with Illumina expression containing " + type + " strip(s)/array");362 illuminaPlatform, illuminaRawDataType, ignoreExistingItems); 363 if (pfv.getDescription() == null || pfv.getDescription().equals("")) pfv.setDescription("Platform variant to use with Illumina expression containing " + type + " strip(s)/array"); 348 364 pfv.addFileType(DataFileType.getByExternalId(dc, bgxFileTypeId), true); 349 365 for (int i = 1; i <= type; i++) … … 356 372 { 357 373 PlatformVariant pfv = createPlatformVariant(dc, snpVariantExternalId, "Illumina SNP", illuminaPlatform, 2, ignoreExistingItems); 358 pfv.setDescription("Platform variant to be used with Illumina SNP data.");374 if (pfv.getDescription() == null || pfv.getDescription().equals("")) pfv.setDescription("Platform variant to be used with Illumina SNP data."); 359 375 //TODO Add data file types to the SNP variant. 360 376 platformVariants.add(pfv); … … 409 425 dft = DataFileType.getByExternalId(dc, externalId); 410 426 if (!dft.getExtension().equals(extension)) message = dft.getName() + " has invalid extension"; 411 if ( dft.getItemType().equals(itemType)) message = dft.getName() + " has invalid item type";427 if (!dft.getItemType().equals(itemType)) message = dft.getName() + " has invalid item type"; 412 428 if (message != null) throw new ItemAlreadyExistsException(message); 413 429 … … 433 449 throw new ItemAlreadyExistsException(platform.getExternalId()); 434 450 } 451 String message = null; 452 if (platform.getRawDataType() != null) message = "The already existing platform has a raw data type that can't be used with " + name + "[" + externalId + "]"; 453 if (message != null) throw new ItemAlreadyExistsException(message); 435 454 //TODO Check that existing platform can be used with the rest of the items. 436 455 } … … 460 479 String message = null; 461 480 if (variant.isFileOnly()) message = "Platform variant " + variant.getExternalId() + " already exists but is file-only"; 462 if (!variant.getRawDataType().equals(rawDataType)) message = "Platform variant " + variant.getExternalId() + " already exists but has not " + rawDataType.getName() + " as raw data type"; 463 if (!variant.getPlatform().equals(illuminaPlatform)) message = "Platform variant " + variant.getExternalId() + " already exists for another platform."; 481 else if (variant.getRawDataType() != null && !variant.getRawDataType().equals(rawDataType)) 482 { 483 message = "Platform variant " + variant.getExternalId() + " already exists but has not the right raw data type"; 484 } 485 else if (!variant.getPlatform().equals(illuminaPlatform)) message = "Platform variant " + variant.getExternalId() + " already exists for another platform."; 464 486 if (message != null) throw new ItemAlreadyExistsException(message); 465 487 … … 490 512 String message = null; 491 513 if (!variant.isFileOnly()) message = "Platform variant " + variant.getName() + " exists but is not file-only"; 492 if (!variant.getPlatform().equals(platform)) message = "Platform variant " + variant.getName() + " exists but has not platform: " + platform;493 if (variant.getRawDataType().getChannels() != channels) message = "Platform variant " + variant.getName() + " exists but not for " + channels + " data";514 else if (!variant.getPlatform().equals(platform)) message = "Platform variant " + variant.getName() + " exists but has not platform: " + platform; 515 else if (variant.getRawDataType().getChannels() != channels) message = "Platform variant " + variant.getName() + " exists but not for " + channels + " data"; 494 516 if (message != null) throw new InvalidDataException (message); 495 517 }
Note: See TracChangeset
for help on using the changeset viewer.