Changeset 234 for trunk/uk/ac/scri/batchimporter/src/sbrn
- Timestamp:
- Feb 14, 2007, 2:51:39 PM (16 years ago)
- Location:
- trunk/uk/ac/scri/batchimporter/src/sbrn/base
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/uk/ac/scri/batchimporter/src/sbrn/base/BatchDataImport.java
r231 r234 200 200 System.out.println("dir = " + dir.getName()); 201 201 202 //get the raw data type 202 //get the raw data type from the experiment 203 203 RawDataType rawDataType = experiment.getRawDataType(); 204 204 System.out.println("rawDataType = " + rawDataType.getName()); … … 247 247 } 248 248 //if it's a cel file, add it to the dataFiles array 249 if(extension.equalsIgnoreCase("cel"))249 else if(extension.equalsIgnoreCase("cel")) 250 250 { 251 251 System.out.println("setting dataFiles["+dataFileCount+"] to file " + file.getName()); 252 252 dataFiles[dataFileCount] = file; 253 253 dataFileCount++; 254 } 255 //if it is neither a cel file nor a cdf file then the user must have defined the Experiment as 256 //being Affy but the data they are importing is not Affy 257 //in that case we need to throw an Exception and abort the whole import 258 else 259 { 260 throw new Exception("data file is not Affymetrix cel file but Experiment was defined as Affymetrix data type"); 254 261 } 255 262 } … … 277 284 File exampleFile = fileList.get(0); 278 285 System.out.println("exampleFile = " + exampleFile.getName()); 279 280 //only do this for non-Affy data types 286 287 //check we don't have a discrepancy between the raw data type and the data files here 288 //if users have specified a non-affy data type and the data is affy we need to abort the import with an appropriate error 289 //get the current file and check its extension 290 String exampleFileName = exampleFile.getName(); 291 String exampleFileExtension = exampleFileName.substring(exampleFileName.lastIndexOf(".")+1); 292 if(exampleFileExtension.equalsIgnoreCase("cdf") || exampleFileExtension.equalsIgnoreCase("cel")) 293 { 294 throw new Exception("Affymetrix data found but Experiment data type was specified as non-Affy"); 295 } 296 297 //for non-Affy data types, find a suitable plugin configuration 281 298 PluginConfiguration importConfig = null; 282 299 if (!rawDataType.getName().equalsIgnoreCase("affymetrix")) … … 286 303 importConfig = detector.detectPluginConfig(exampleFile); 287 304 System.out.println("PluginConfiguration importConfig = " + importConfig); 305 306 //now need to figure out the raw data type to make sure it matches that of the Experiment we are importing into 307 //this can be done by looking at the plugin config which should have it stored in it 308 List rdtVal = importConfig.getParameterValues("rawDataType"); 309 String rawDataTypeStr = (String)rdtVal.get(0); 310 System.out.println("rawDataType detected from files = " + rawDataTypeStr); 311 //compare this to the raw data type of the experiment 312 if(!rawDataType.getName().equalsIgnoreCase(rawDataTypeStr)) 313 { 314 throw new Exception("raw data types of experiment and data files do not match"); 315 } 316 288 317 } 289 318 … … 374 403 } 375 404 405 //make sure we have a working dbcontrol object 406 if(dc.isClosed()) 407 dc = sc.newDbControl(); 376 408 //commit the changes to the database 377 409 dc.commit(); -
trunk/uk/ac/scri/batchimporter/src/sbrn/base/PluginConfigDetector.java
r229 r234 79 79 pc = configList.get(0); 80 80 } 81 catch ( Exception x)81 catch (IndexOutOfBoundsException x) 82 82 { 83 83 x.printStackTrace(); 84 throw new Exception( x);84 throw new Exception("no suitable plugin configuration found for this data type"); 85 85 } 86 86 finally
Note: See TracChangeset
for help on using the changeset viewer.