Changeset 468 for trunk/uk/ac/ebi
- Timestamp:
- Nov 12, 2007, 5:47:38 PM (15 years ago)
- Location:
- trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/RawDataValidation.java
r459 r468 12 12 Note: seperate implementation to base1/ baseloader 13 13 @author Dominic Oyeniran 14 @email oyeniran@ebi.ac.uk14 @email 15 15 @version 1.0 16 16 */ -
trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/Tab2MageHybridizationValidation.java
r459 r468 61 61 protected Path spath; 62 62 63 // must be added from the HybridizationValidation interface 63 64 protected String path; 64 65 /** … … 130 131 for(Tab2MAGEHybridization hyb : hybs) 131 132 { 133 // check if the raw data files really exist 132 134 log.info("Checking that file exist......."); 133 135 List<String> fileErrors= checkIfFilesExist(hyb, spath); … … 135 137 136 138 log.info("Checking that file has proper type......"); 139 // check if the files have the proper type 140 137 141 List<String> fileTypesErrors = checkFileTypes(hyb, platform); 138 142 if (!fileTypesErrors.isEmpty())errors.addAll(fileTypesErrors); … … 145 149 } 146 150 } 151 147 152 if (!errors.isEmpty()) 148 153 { … … 172 177 Validate the hybridization headers from the Tab2MAGE file. 173 178 This code MUST be modified for MAGE-TAB implementation. 179 [TODO] convert all headers to lowercase, to facilitate matching of hyb section header to Tab2mageConstants/Spec 174 180 @param header an <code>ArrayList</code> with all headers from the Tab2MAGE file 175 181 @return true if the headers are valid, false otherwise … … 177 183 public static boolean validateHeader(ArrayList<String> header, Writer writer) 178 184 { 185 //[TODO] convert all headers to lowercase, to facilitate matching of hyb section header to Tab2mageConstants/Spec 179 186 //header= header2LowerCase(header); 180 187 List<String> headerErrors = new LinkedList<String>(); … … 185 192 { 186 193 log.error("The column \"" + Tab2MageConstants.hybridization.getName() + "\" wasn't found!"); 194 //valid = false; 187 195 headerErrors.add("The column \"" + Tab2MageConstants.hybridization.getName() + "\" wasn't found!"); 188 196 } … … 191 199 { 192 200 log.error("The column \"" + Tab2MageConstants.labeledextract.getName() + "\" wasn't found!"); 201 //valid = false; 193 202 headerErrors.add("The column \"" + Tab2MageConstants.labeledextract.getName() + "\" wasn't found!"); 194 203 } … … 197 206 { 198 207 log.error("The column \"" + Tab2MageConstants.dye.getName() + "\" wasn't found!"); 208 //valid = false; 199 209 headerErrors.add("The column \"" + Tab2MageConstants.dye.getName() + "\" wasn't found!"); 200 210 } … … 203 213 { 204 214 log.error("The column \"" + Tab2MageConstants.extract.getName()+ "\" wasn't found!"); 215 //valid = false; 205 216 headerErrors.add("The column \"" + Tab2MageConstants.extract.getName()+ "\" wasn't found!"); 206 217 } … … 209 220 { 210 221 log.error("The column \"" + Tab2MageConstants.sample.getName() + "\" wasn't found!"); 222 //valid = false; 211 223 headerErrors.add("The column \"" + Tab2MageConstants.sample.getName() + "\" wasn't found!"); 212 224 } … … 215 227 { 216 228 log.error("The column \"" + Tab2MageConstants.biosource.getName() + "\" wasn't found!"); 229 //valid = false; 217 230 headerErrors.add("The column \"" + Tab2MageConstants.biosource.getName() + "\" wasn't found!"); 218 231 } … … 221 234 { 222 235 log.error("The column \"" + Tab2MageConstants.array_accession.getName() + "\" wasn't found!"); 236 //valid = false; 223 237 headerErrors.add("The column \"" + Tab2MageConstants.array_accession.getName() + "\" wasn't found!"); 224 238 } 239 240 /* 241 a bit flexible to accommodate non provision of array serial 242 */ 243 //if (!header.contains(Tab2MAGEHybridization.ARRAY + "[" + Constants.ARRAY_SERIAL + "]")){ 244 // log.error("The column \"" + Tab2MAGEHybridization.ARRAY + "[" + Constants.ARRAY_SERIAL + "]" + " wasn't found!"); 245 // valid = false; 246 //} 247 248 /* 249 check for biomaterial characteristics - simply biosource annotation in base2. 250 And exisitence of experimental factors 251 NOTE: "Characteristics" would be used for MAGE-TAB implementation 252 */ 253 225 254 226 255 cont: … … 244 273 { 245 274 log.error("At least one BioMaterial Characteristics should be provided!"); 275 //valid = false; 246 276 headerErrors.add("At least one BioMaterial Characteristics should be provided!"); 247 277 } … … 250 280 { 251 281 log.error("At least one Experimental Factor should be provided!"); 282 //valid = false; 252 283 headerErrors.add("At least one Experimental Factor should be provided!"); 253 284 } … … 275 306 { 276 307 log.error("The protocol column \"" + head + "\" is not a valid protocol format allowed in the tab2mage specification!"); 308 //valid = false; 277 309 headerErrors.add("The protocol column \"" + head + "\" is not a valid protocol format allowed in the tab2mage specification!"); 278 310 } … … 282 314 if(!tmpValid1 || !tmpValid2 || !tmpValid3){ 283 315 log.error("The protocol columns of the Tab2MAGE hybridization section aren't valid!"); 316 //valid = false; 284 317 headerErrors.add("The protocol columns of the Tab2MAGE hybridization section aren't valid!"); 285 318 } … … 294 327 { 295 328 log.error("The parameter " + head + " does not match parameters specified in the protocol section!"); 329 //valid = false; 296 330 headerErrors.add("The parameter: [" + head + "] does not match parameters specified in the protocol section!"); 297 331 } … … 352 386 { 353 387 log.error("The raw data file [" + hyb.getFileRaw() + "] doesn't exist or couldn't be accessed!"); 388 //return false; 354 389 errs.add("The raw data file [" + hyb.getFileRaw() + "] doesn't exist or couldn't be accessed!"); 355 390 } 391 356 392 } 357 393 … … 361 397 { 362 398 log.error("The image file [" + hyb.getFileImage() + "] doesn't exist or couldn't be accessed!"); 399 //return false; 363 400 errs.add("The image file [" + hyb.getFileImage() + "] doesn't exist or couldn't be accessed!"); 364 401 } 365 402 } 403 /* 404 Uncomment to ADD support for cdf and chp file 405 */ 406 //System.out.println("cheking the cdf file....."); 407 //if(hyb.getFileCDF() != null) 408 //{ 409 // if(!File.exists(dc, dir, hyb.getFileCDF())) 410 // { 411 // log.error("The cdf file " + hyb.getFileCDF() + " doesn't exist or couldn't be accessed!"); 412 // return false; 413 // } 414 //} 415 //System.out.println("cheking the chp file....."); 416 //if(hyb.getFileCHP() != null && !hyb.getFileCHP().equals("NA")) 417 //{ 418 // if (!File.exists(dc, dir, hyb.getFileCHP())) 419 // { 420 // log.error("The chp file " + hyb.getFileCHP() + " doesn't exist or couldn't be accessed!"); 421 // return false; 422 // } 423 //} 424 425 /* 426 code to be used for support of file[normalised], file[transformed] not supported yet in Base2 427 hyb.getFileTransformed and hyb.getFileNormalised should be added to Tab2MAGEHybridization Class. 428 429 430 //if(hyb.getFileTransformed() != null ) 431 //{ 432 // if (!File.exists(dc, directory, hyb.getFileTransformed())) 433 // { 434 // log.error("The transformed file " + hyb.getFileTransformed() + " doesn't exist or couldn't be accessed!"); 435 // return false; 436 // } 437 //} 438 439 //if(hyb.getFileNormalised() != null ) 440 //{ 441 // if (!File.exists(dc, directory, hyb.getFileNormalised())) 442 // { 443 // log.error("The normalised file " + hyb.getFileNormalised() + " doesn't exist or couldn't be accessed!"); 444 // return false; 445 // } 446 //} 447 448 END OF THE SECTION TO ADD FUNCTIONALITY ADD-ONS. 449 */ 366 450 } 367 451 catch (Throwable tr) … … 390 474 { 391 475 log.error("The raw data file from the hybridization [" + hyb.getName() + "] has not the proper type."); 476 //return false; 392 477 er.add("The raw data file from the hybridization [" + hyb.getName() + "] has not the proper type."); 393 478 } … … 401 486 { 402 487 log.error("The CHP file from the hybridization [" + hyb.getName() + "] has not the proper type."); 488 //return false; 403 489 er.add("The CHP file from the hybridization [" + hyb.getName() + "] has not the proper type."); 404 490 } … … 412 498 { 413 499 log.error("The GPR file from the hybridization [" + hyb.getName() + "] has not the proper type."); 500 //return false; 414 501 er.add("The GPR file from the hybridization [" + hyb.getName() + "] has not the proper type."); 415 502 } 416 503 } 504 505 //add code to check other raw data file here, do extend the experiment platform enum class too 506 417 507 return er; 418 508 } … … 521 611 } 522 612 613 523 614 public void setAllowSlideCreation(boolean allowSlideCreation) 524 615 { -
trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/Tab2MageImportValidatorUtils.java
r458 r468 186 186 if (parameterAnnotationType.containsKey(e.getKey())) 187 187 { 188 log.info("Found Parameter key : [" + e.getKey()+ "] and value is :" + parameterAnnotationType.get(e.getKey()));188 //log.info("Found Parameter key : [" + e.getKey()+ "] and value is :" + parameterAnnotationType.get(e.getKey())); 189 189 parameter="true"; 190 190 } 191 //log.info(".....checking biomat map"); 191 192 if (bioMaterialAnnotationType.containsKey(e.getKey())) 192 193 { 193 log.info("Found BioMat key: [" + e.getKey()+ "] and value is :" + bioMaterialAnnotationType.get(e.getKey()));194 //log.info("Found BioMat key: [" + e.getKey()+ "] and value is :" + bioMaterialAnnotationType.get(e.getKey())); 194 195 items.add("biosource"); 195 196 } 196 197 //log.info(".....checking factor value map"); 197 198 if (factorValueAnnotationType.containsKey(e.getKey())) 198 199 { 199 log.info("Found Factor Value key: [" + e.getKey()+ "] and value is :" + factorValueAnnotationType.get(e.getKey()));200 //log.info("Found Factor Value key: [" + e.getKey()+ "] and value is :" + factorValueAnnotationType.get(e.getKey())); 200 201 items.add("rawbioassay"); 201 202 } … … 228 229 } 229 230 /** 230 creates a simple flatfile into a specified directory using the format of exis ting similar file231 creates a simple flatfile into a specified directory using the format of exisiting similar file 231 232 @param dc, the db control 232 233 @param dir, the directory- parent directory -
trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/Tab2MageProtocolValidation.java
r458 r468 79 79 log.error("The protocol type is empty. Must be provided"); 80 80 errors.add("Protocol Type for protocol with accession number: [" + protocol.getAccession()+ "] is empty. Must be provided"); 81 //return false; 81 82 } 82 83 83 84 //check if protocol is allowed in tab2mage. 85 84 86 Set<Tab2MageConstants> allowedProtocols = Collections.unmodifiableSet(Tab2MageConstants.protocolContants()); 85 87 for (Tab2MageConstants allowedProtocol : allowedProtocols ) … … 93 95 if(!allowed) 94 96 { 97 // if it is not reachable log the error message and stop 95 98 log.error("The protocol : " + protocol.getName() + " isn't permissible in the tab2mage specification.!"); 99 //return false; 96 100 errors.add("The protocol : [" + protocol.getName() + "] isn't permissible in the tab2mage specification.!"); 97 101 } 98 102 99 103 // check if all protocol types are reachable in base2 104 100 105 ItemQuery<ProtocolType> protocolTypesQuery = ProtocolType.getQuery(); 101 106 ItemResultList<ProtocolType> protocolTypes =protocolTypesQuery.list(dc); … … 111 116 } 112 117 if(!found) 113 { 118 { 119 // if it is not reachable log the error message and stop 114 120 log.warn("The protocol type: " + protocol.getType() + " isn't existing in BASE.!\n The importer may FAIL and your experiment may not be loaded"); 115 121 errors.add("The protocol type: [" + protocol.getType() + "] isn't existing in BASE.!\n The importer may FAIL and your experiment may not be loaded"); 116 } 122 // return false; 123 } 117 124 118 125 // check name and accession … … 121 128 log.error("A protocol accession is empty."); 122 129 errors.add("A protocol accession is empty in the protocol section. Must be provided to proceed"); 130 //return false; 123 131 } 124 132 if(protocol.getName().equals("") || protocol.getName() == null) … … 126 134 log.error("A protocol name is empty."); 127 135 errors.add("A protocol name is empty in the protocol section. Must be provided to proceed"); 128 } 136 //return false; 137 } 138 129 139 getAllProtocolParameters(protocol); 130 140 } … … 196 206 Tab2MageProtocolValidation.protocolParameters = protocolParameters; 197 207 } 208 198 209 } -
trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/Tab2MageValidationFactory.java
r458 r468 132 132 response = resp; 133 133 statusFile = file; 134 //this calls the Tab2mage file validation routine 135 //validateTab2MageFile(); 134 136 createWriter(); 135 137 } … … 198 200 */ 199 201 @SuppressWarnings("static-access") 202 //public void validateTab2MageFile() 200 203 public Map<ValidationConstants, Boolean> validateTab2MageFile() 201 204 { … … 246 249 } 247 250 251 // Display the protocols only for debugging 252 //log.info("\n+++++++++++++++++++++++ALL THE PROTOCOLS++++++++++++++++++++++++++++++++++++++\n"); 253 //for (Tab2MAGEProtocol p : protocols) 254 //{ 255 // log.warn(p.getAccession()+ "\t" +p.getText()+ "\t" +p.getName() + "\t" +p.getType()+ "\t" +p.getParameters()); 256 //} 257 //Display all the parameters, only for debugging 258 259 //log.info("\n++++++++++++++++++++ The parameters ++++++++++++++\n"); 260 //List<String> params= protocolVal.getProtocolParameters(); 261 //for (String p : params) 262 //{ 263 // log.warn(p); 264 //} 265 248 266 log.info( doneProtocol ? " \n.... Protocol validation is SUCCESSFUL .... \n" :" \n.... Protocol validation FAILED .... \n"); 249 267 statusOut.write( doneProtocol ? " \n.... Protocol validation is SUCCESSFUL .... \n" :" \n.... Protocol validation FAILED .... \n"); … … 263 281 { 264 282 log.error("SORRY: The header for the hybridization section of the tab2mage file: " +filename+ " is invalid. Must be rectified to proceed. See the log file for more details"); 283 //throw new NutribasePluginException("The header for the hybridization section of the tab2mage file: " +filename+ " is invalid. Must be rectified to proceed. See the log file for more details"); 265 284 statusOut.write("Sorry the header for the hybridization section of the tab2mage file: " +filename+ " is invalid. Must be rectified to proceed."); 266 285 doneHybridizationHeaders = false; 267 286 } 268 287 statusOut.write( doneHybridizationHeaders ? " \n.... Hybridization header validation is SUCCESSFUL .... \n" :" \n.... Hybridization header validation FAILED .... \n"); 269 270 //validate rows /lines 288 //statusOut.flush(); 289 290 //validate rows /lines 271 291 272 292 Tab2MageHybridizationValidation validateHyb = new Tab2MageHybridizationValidation(dir, platform, hybs, reader, sc); … … 286 306 287 307 */ 308 // check if the dc is closed, or disconnected and create a new one if yes 288 309 if (dc == null || !dc.isConnected() || dc.isClosed()) dc = sc.newDbControl(); 289 310 dir= Directory.getByPath(dc, dir.getPath()); … … 317 338 { 318 339 log.error("Sorry the agilent files cannot be validated. Mandatory Columns are missing. Must be rectified to proceed. See the log file for more details"); 340 //throw new ValidationException("An agilent file is missing once or more mandatory columns!"); 319 341 statusOut.write("Sorry the agilent files cannot be validated. Mandatory Columns are missing. Must be rectified to proceed."); 320 342 doneAgilent =false; … … 386 408 387 409 statusOut.close(); 410 //dc.commit(); 388 411 } 389 412 catch(Throwable tr)
Note: See TracChangeset
for help on using the changeset viewer.