Changeset 3379
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/conf/omssa.properties.in
r2935 r3379 40 40 # omssa.web.server.timediff.hours = 0 41 41 # omssa.web.server.timediff.correction.minutes = 0 42 # omssa.web.convert.mzdata_to_mgf = true 42 43 # 43 44 # Notes: … … 76 77 # omssa.web.server.timediff.correction.minutes = 2 77 78 # 79 # omssa.web.convert.mzdata_to_mgf is a flag variable, 80 # indicating if an mzData input file should be converted 81 # to an MGF file before an OMSSA search is performed. 82 # If set to `true`, the created MGF file will be placed 83 # in the same Proteios directory as the input mzData file. 84 # The OMSSA result file will refer to the original mzData 85 # file as the input file. 86 # 87 # omssa.web.convert.mzdata_to_mgf = true 88 # 78 89 omssa.web.server.url = http://pubchem.ncbi.nlm.nih.gov 79 90 omssa.web.script.path = /omssa/omssacgi.cgi … … 82 93 omssa.web.server.timediff.hours = -9 83 94 omssa.web.server.timediff.correction.minutes = 0 95 omssa.web.convert.mzdata_to_mgf = true 84 96 # 85 97 # Settings for OMSSA local installation - required … … 93 105 omssa.local.database.directory.path = /omssa-2.1.4.linux/db 94 106 omssa.local.input.basename = omssa_input.xml 107 omssa.local.convert.mzdata_to_mgf = true 95 108 -
trunk/client/servlet/src/org/proteios/action/omssa/SearchOMSSA.java
r3288 r3379 35 35 import org.proteios.core.Directory; 36 36 import org.proteios.core.File; 37 import org.proteios.core.FileParameterType; 38 import org.proteios.core.FileType; 37 39 import org.proteios.core.IntegerParameterType; 38 40 import org.proteios.core.ItemFactory; … … 40 42 import org.proteios.core.ItemParameterType; 41 43 import org.proteios.core.Job; 44 import org.proteios.core.Path; 42 45 import org.proteios.core.PluginDefinition; 43 46 import org.proteios.core.Project; … … 75 78 public static final VBoolean VSAVEASOMSSAPARAMETERSETFLAG = new VBoolean( 76 79 "saveAsOMSSAParameterSetFlag", false); 80 81 // Set estimated execution time to next fastest, SHORT 82 private static final Job.ExecutionTime ESTIMATED_EXECUTION_TIME = Job.ExecutionTime.SHORT; 77 83 78 84 /** … … 131 137 //String omssaWebServerTimediffCorrectionMinutes = "0"; 132 138 String omssaWebServerTimediffCorrectionMinutes = pf.getProperty("omssa.web.server.timediff.correction.minutes"); 139 // OMSSA web mzData to MGF conversion flag 140 //String omssaWebConvertMzDataToMgfFlagStr = "true"; 141 String omssaWebConvertMzDataToMgfFlagStr = pf.getProperty("omssa.web.convert.mzdata_to_mgf"); 142 Boolean omssaWebConvertMzDataToMgfFlag = false; 143 if (omssaWebConvertMzDataToMgfFlagStr != null && ( 144 omssaWebConvertMzDataToMgfFlagStr.equals("true") || 145 omssaWebConvertMzDataToMgfFlagStr.equals("True") || 146 omssaWebConvertMzDataToMgfFlagStr.equals("TRUE") || 147 omssaWebConvertMzDataToMgfFlagStr.equals("yes") || 148 omssaWebConvertMzDataToMgfFlagStr.equals("Yes") || 149 omssaWebConvertMzDataToMgfFlagStr.equals("YES")) 150 ) 151 { 152 omssaWebConvertMzDataToMgfFlag = true; 153 } 133 154 // OMSSA install path 134 155 //String omssaInstallPath = "/omssa-2.1.4.linux"; … … 143 164 //String omssaInputBasename = "proteios_autogenerated_input.xml"; 144 165 String omssaInputBasename = pf.getProperty("omssa.local.input.basename"); 166 // OMSSA local mzData to MGF conversion flag 167 //String omssaLocalConvertMzDataToMgfFlagStr = "true"; 168 String omssaLocalConvertMzDataToMgfFlagStr = pf.getProperty("omssa.local.convert.mzdata_to_mgf"); 169 Boolean omssaLocalConvertMzDataToMgfFlag = false; 170 if (omssaLocalConvertMzDataToMgfFlagStr != null && ( 171 omssaLocalConvertMzDataToMgfFlagStr.equals("true") || 172 omssaLocalConvertMzDataToMgfFlagStr.equals("True") || 173 omssaLocalConvertMzDataToMgfFlagStr.equals("TRUE") || 174 omssaLocalConvertMzDataToMgfFlagStr.equals("yes") || 175 omssaLocalConvertMzDataToMgfFlagStr.equals("Yes") || 176 omssaLocalConvertMzDataToMgfFlagStr.equals("YES")) 177 ) 178 { 179 omssaLocalConvertMzDataToMgfFlag = true; 180 } 145 181 // Directory for temporary files 146 182 String tmpDir = null; … … 155 191 log.debug("omssaWebServerTimediffHours = \"" + omssaWebServerTimediffHours + "\""); 156 192 log.debug("omssaWebServerTimediffCorrectionMinutes = \"" + omssaWebServerTimediffCorrectionMinutes + "\""); 193 log.debug("omssaWebConvertMzDataToMgfFlagStr = \"" + omssaWebConvertMzDataToMgfFlagStr + "\""); 194 log.debug("omssaWebConvertMzDataToMgfFlag = " + omssaWebConvertMzDataToMgfFlag); 157 195 log.debug("omssaInstallPath = \"" + omssaInstallPath + "\""); 158 196 log.debug("omssaProgramName = \"" + omssaProgramName + "\""); 159 197 log.debug("omssaDatabaseDirectoryPath = \"" + omssaDatabaseDirectoryPath + "\""); 160 198 log.debug("omssaInputBasename = \"" + omssaInputBasename + "\""); 199 log.debug("omssaLocalConvertMzDataToMgfFlagStr = \"" + omssaLocalConvertMzDataToMgfFlagStr + "\""); 200 log.debug("omssaLocalConvertMzDataToMgfFlag = " + omssaLocalConvertMzDataToMgfFlag); 161 201 log.debug("tmpDir = \"" + tmpDir + "\""); 162 202 log.debug("uploadOutputFileFlag = " + uploadOutputFileFlag); … … 185 225 } 186 226 log.debug("useWebInterfaceFlag = " + useWebInterfaceFlag); 227 // Get the convert mzData file to MGF file flag 228 Boolean convertMzDataToMgfFlag = false; 229 if (useWebInterfaceFlag) 230 { 231 convertMzDataToMgfFlag = omssaWebConvertMzDataToMgfFlag; 232 } 233 else 234 { 235 convertMzDataToMgfFlag = omssaLocalConvertMzDataToMgfFlag; 236 } 237 log.debug("convertMzDataToMgfFlag = " + convertMzDataToMgfFlag); 187 238 // Get the save OMSSA parameter set flag 188 239 Boolean saveOMSSAParameterSetFlag = getValidBoolean(VSAVEOMSSAPARAMETERSETFLAG); … … 252 303 } 253 304 File spectrumFile = factory.getById(File.class, spectrumFileId); 305 // Check if input spectrum file should be converted before OMSSA search 306 Job convertJob = null; 307 if (convertMzDataToMgfFlag) 308 { 309 // Select file conversion plug-in depending on type of spectrum file 310 FileType fileType = spectrumFile.getFileType(); 311 if ((fileType != null && fileType.getSystemId().equals( 312 FileType.MZDATA)) || spectrumFile.getName().endsWith(".mzData")) 313 { 314 // Create convert job if converted file does not already exist 315 if (!convertedMzDataToMgfFileExists(dc, spectrumFile)) 316 { 317 convertJob = createMzDataToMgfConvertJob(dc, spectrumFile); 318 log.debug("created convert job: " + convertJob.getName()); 319 } 320 else 321 { 322 log.debug("Converted mzData to MGF file already exist, no convert job created."); 323 } 324 } 325 } 254 326 PluginDefinition plugin = PluginDefinition.getById(dc, pluginDefId); 255 327 Job job = factory.createJob(plugin, null); 256 // Set estimated execution time to next fastest, SHORT257 job.setEstimatedExecutionTime( Job.ExecutionTime.SHORT);328 // Set estimated execution time 329 job.setEstimatedExecutionTime(ESTIMATED_EXECUTION_TIME); 258 330 //job.setName(plugin.getName() + " File: " + file.getName()); 259 331 //job.setDescription("Gel: " + gelId + " File: " + file.getName()); … … 311 383 BooleanParameterType useWebInterfaceFlagParam = new BooleanParameterType(); 312 384 job.setParameterValue("useWebInterfaceFlag", useWebInterfaceFlagParam, useWebInterfaceFlag); 385 // 386 BooleanParameterType convertMzDataToMgfFlagParam = new BooleanParameterType(); 387 job.setParameterValue("convertMzDataToMgfFlag", convertMzDataToMgfFlagParam, convertMzDataToMgfFlag); 313 388 // 314 389 ItemParameterType<Project> projectParam = new ItemParameterType<Project>( … … 318 393 //FileParameterType filesParam = new FileParameterType(); 319 394 //job.setParameterValue("file", filesParam, file); 395 // 396 if (convertJob != null) 397 { 398 // Wait for conversion job to finish before starting search job 399 job.setBlocker(convertJob); 400 } 320 401 dc.saveItem(job); 321 402 dc.commit(); … … 379 460 380 461 462 /** 463 * Checks if a converted mzData to MGF file 464 * exists. The converted file is assumed to 465 * be located in the same directory as the input 466 * mzData file, and have the same name as the 467 * latter, but with ".mgf" appended. 468 * Returns true if the file can be found, else false. 469 * 470 * @param dc DbControl The DbControl to use. 471 * @param spectrumFile File The input mzData spectrum file. 472 * @return boolean Returns true if the file can be found, else false. 473 */ 474 private boolean convertedMzDataToMgfFileExists(DbControl dc, File spectrumFile) 475 { 476 boolean fileExists = false; 477 if (fetchConvertedMzDataToMgfFile(dc, spectrumFile) != null) 478 { 479 fileExists = true; 480 } 481 log.debug("fileExists = " + fileExists); 482 return fileExists; 483 } 484 485 486 /** 487 * Fetches the converted mzData to MGF file. 488 * The converted file is assumed to already 489 * exist, being located in the same directory 490 * as the input mzData file, and have the same 491 * name as the latter, but with ".mgf" appended. 492 * Returns null if the file cannot be found. 493 * 494 * @param dc DbControl The DbControl to use. 495 * @param spectrumFile File The input mzData spectrum file. 496 * @return File The converted mzData to MGF file. 497 */ 498 private File fetchConvertedMzDataToMgfFile(DbControl dc, File spectrumFile) 499 { 500 ItemFactory factory = getItemFactory(dc); 501 // Get path for mzData file converted to MGF 502 Path spectrumFilePath = spectrumFile.getPath(); 503 String spectrumFilePathStr = spectrumFilePath.toString(); 504 log.debug("spectrumFilePathStr = \"" + spectrumFilePathStr + "\""); 505 // Construct converted file path by appending ".mgf" 506 spectrumFilePathStr = spectrumFilePathStr + ".mgf"; 507 log.debug("spectrumFilePathStr = \"" + spectrumFilePathStr + "\""); 508 spectrumFilePath = new Path(spectrumFilePathStr, Path.Type.FILE); 509 // Get converted core spectrum file from path 510 File convertedSpectrumFile = null; 511 try 512 { 513 convertedSpectrumFile = factory.getByPath(spectrumFilePath, false); 514 } 515 catch (Exception e) 516 { 517 log.debug("Exception when trying to get core file from path \"" + spectrumFilePathStr + "\": " + e); 518 } 519 log.debug("convertedSpectrumFile = " + convertedSpectrumFile); 520 return convertedSpectrumFile; 521 } 522 523 524 /** 525 * Creates an mzData file to MGF file conversion job. 526 * 527 * @param dc DbControl The DbControl to use. 528 * @param spectrumFile File The input mzData spectrum file. 529 * @return Job The mzData file to MGF file conversion job. 530 */ 531 private Job createMzDataToMgfConvertJob(DbControl dc, File spectrumFile) 532 { 533 PluginDefinition plugin = PluginDefinition.getByClassName( 534 dc, "org.proteios.plugins.MzDataToMGF"); 535 ItemFactory factory = getItemFactory(dc); 536 Job job = factory.createJob(plugin, null); 537 // Set estimated execution time to same as for OMSSA search job 538 job.setEstimatedExecutionTime(ESTIMATED_EXECUTION_TIME); 539 job.setName(plugin.getName() + " mzData file: " + spectrumFile.getName()); 540 job.setDescription("Spectrum File: " + spectrumFile.getName() + "[" + spectrumFile.getId() + "]"); 541 FileParameterType filesParam = new FileParameterType(); 542 job.setParameterValue("file", filesParam, spectrumFile); 543 dc.saveItem(job); 544 return job; 545 } 546 547 381 548 private void saveOMSSAInputFileLocal(java.io.File localFile, OMSSAParameterSet omssaParameterSet) 382 549 throws ActionException -
trunk/plugin/src/org/proteios/plugins/SearchOMSSAPlugin.java
r2961 r3379 44 44 import org.proteios.core.ItemFactory; 45 45 import org.proteios.core.OMSSAParameterSetStorage; 46 import org.proteios.core.Path; 47 import org.proteios.core.Path.Type; 46 48 import org.proteios.core.ProgressReporter; 47 49 import org.proteios.core.SessionControl; … … 316 318 Boolean useWebInterfaceFlag = (Boolean) job 317 319 .getValue("useWebInterfaceFlag"); 320 // Get convert mzData file to MGF file flag 321 Boolean convertMzDataToMgfFlag = (Boolean) job 322 .getValue("convertMzDataToMgfFlag"); 318 323 // 319 324 String omssaProgramPath = omssaInstallPath + "/" + omssaProgramName; … … 363 368 log.debug("uploadOutputFileFlag = " + uploadOutputFileFlag); 364 369 log.debug("useWebInterfaceFlag = " + useWebInterfaceFlag); 370 log.debug("convertMzDataToMgfFlag = " + convertMzDataToMgfFlag); 365 371 // 366 372 // Default is OMSSA search via web interface … … 372 378 omssaWebArchivePath, omssaWebResultFilenamePrefix, 373 379 omssaWebServerTimediffMinutes, omssapssId, spectrumFileId, dirId, 374 uploadOutputFileFlag );380 uploadOutputFileFlag, convertMzDataToMgfFlag); 375 381 } 376 382 else … … 380 386 omssaInstallPath, omssaProgramName, omssaDatabaseDirectoryPath, 381 387 omssaInputFilename, omssaOutputPath, omssapssId, 382 spectrumFileId, dirId, uploadOutputFileFlag );388 spectrumFileId, dirId, uploadOutputFileFlag, convertMzDataToMgfFlag); 383 389 } 384 390 done(); … … 422 428 * @param dirId Integer The directory id 423 429 * @param uploadOutputFileFlag Boolean The upload output file flag 430 * @param convertMzDataToMgfFlag Boolean The convert mzData file to MGF file flag 424 431 */ 425 432 private void omssaSearchViaWebInterface(Request request, … … 429 436 String omssaWebResultFilenamePrefix, double omssaWebServerTimediffMinutes, 430 437 Integer omssapssId, Integer spectrumFileId, Integer dirId, 431 Boolean uploadOutputFileFlag )438 Boolean uploadOutputFileFlag, Boolean convertMzDataToMgfFlag) 432 439 { 433 440 log.debug("omssaWebServerURLStr = \"" + omssaWebServerURLStr + "\""); … … 439 446 log.debug("omssaWebServerTimediffMinutes = " + omssaWebServerTimediffMinutes); 440 447 log.debug("uploadOutputFileFlag = " + uploadOutputFileFlag); 448 log.debug("convertMzDataToMgfFlag = " + convertMzDataToMgfFlag); 441 449 // 442 450 String omssaWebScriptURLStr = omssaWebServerURLStr + "/" + omssaWebScriptPath; … … 462 470 // Get spectrum file 463 471 File spectrumFile = factory.getById(File.class, spectrumFileId); 464 log.debug("spectrumFile = " + spectrumFile); 472 log.debug("spectrumFile (original) = " + spectrumFile); 473 // Always use original spectrum filename, even if a converted file is used for OMSSA search 474 String originalSpectrumFilename = spectrumFile.getName(); 475 // Check if converted spectrum file should be used for search 476 boolean mzDataConvertedToMgfUsed = false; 477 if (convertMzDataToMgfFlag != null && convertMzDataToMgfFlag) 478 { 479 FileType fileType = spectrumFile.getFileType(); 480 if ((fileType != null && fileType.getSystemId().equals( 481 FileType.MZDATA)) || spectrumFile.getName().endsWith(".mzData")) 482 { 483 // Use converted spectrum file for OMSSA search 484 mzDataConvertedToMgfUsed = true; 485 spectrumFile = fetchConvertedMzDataToMgfFile(dc, spectrumFile); 486 log.debug("spectrumFile (converted from mzData to MGF) = " + spectrumFile); 487 } 488 } 465 489 // Get OMSSA input data from OMSSA parameters XML file 466 490 OMSSAParameterSet omssaParameterSet = omssapss … … 850 874 { 851 875 // Construct job done message 876 String convertMessage = new String(""); 877 if (mzDataConvertedToMgfUsed) 878 { 879 convertMessage = new String(" - mzData data converted to MGF used for search"); 880 } 852 881 String doneMessage = new String("OMSSA search finished"); 882 doneMessage = doneMessage + convertMessage; 853 883 // Add OMSSA data input filename 854 884 // doneMessage = doneMessage + "\n" + "OMSSA input file: " + … … 1069 1099 * @param dirId Integer The directory id 1070 1100 * @param uploadOutputFileFlag Boolean The upload output file flag 1101 * @param convertMzDataToMgfFlag Boolean The convert mzData file to MGF file flag 1071 1102 */ 1072 1103 private void omssaSearchLocal(Request request, Response response, … … 1075 1106 String omssaInputFilename, String omssaOutputPath, 1076 1107 Integer omssapssId, Integer spectrumFileId, Integer dirId, 1077 Boolean uploadOutputFileFlag )1108 Boolean uploadOutputFileFlag, Boolean convertMzDataToMgfFlag) 1078 1109 { 1079 1110 String omssaProgramPath = omssaInstallPath + "/" + omssaProgramName; … … 1089 1120 log.debug("omssaOutputPath = \"" + omssaOutputPath + "\""); 1090 1121 log.debug("uploadOutputFileFlag = " + uploadOutputFileFlag); 1122 log.debug("convertMzDataToMgfFlag = " + convertMzDataToMgfFlag); 1091 1123 // Create output file in directory for temporary files 1092 1124 omssaOutputPath = new String("omssa_output_" + job.getId() + ".xml"); … … 1106 1138 // Get spectrum file 1107 1139 File spectrumFile = factory.getById(File.class, spectrumFileId); 1108 log.debug("spectrumFile = " + spectrumFile); 1140 log.debug("spectrumFile (original) = " + spectrumFile); 1141 // Always use original spectrum filename, even if a converted file is used for OMSSA search 1142 String originalSpectrumFilename = spectrumFile.getName(); 1143 // Check if converted spectrum file should be used for search 1144 boolean mzDataConvertedToMgfUsed = false; 1145 if (convertMzDataToMgfFlag != null && convertMzDataToMgfFlag) 1146 { 1147 FileType fileType = spectrumFile.getFileType(); 1148 if ((fileType != null && fileType.getSystemId().equals( 1149 FileType.MZDATA)) || spectrumFile.getName().endsWith(".mzData")) 1150 { 1151 // Use converted spectrum file for OMSSA search 1152 mzDataConvertedToMgfUsed = true; 1153 spectrumFile = fetchConvertedMzDataToMgfFile(dc, spectrumFile); 1154 log.debug("spectrumFile (converted from mzData to MGF) = " + spectrumFile); 1155 } 1156 } 1109 1157 // Get OMSSA input data from OMSSA parameters XML file 1110 1158 OMSSAParameterSet omssaParameterSet = omssapss 1111 1159 .fetchOMSSAParameterSet(); 1112 1160 // Copy spectrum file item to local file used for OMSSA input 1113 String spectrumPath = new String(tmpDir + "/" + spectrumFile.getName());1114 log.debug("spectrumPath = " + spectrumPath);1161 String spectrumPath = new String(tmpDir + "/" + originalSpectrumFilename); 1162 log.debug("spectrumPath for temporary file used for local OMSSA search = " + spectrumPath); 1115 1163 java.io.File spectrumFileTmp = new java.io.File(spectrumPath); 1116 1164 try … … 1447 1495 log.debug("option = \"" + option + "\" (Flag set that input parameter values should be included in result file)"); 1448 1496 cmd = cmd + " " + option; 1497 // 1498 /* 1499 * Note: OMSSA uses the option stored in 1500 * string "spectrumFileOption" to decide 1501 * how to parse a spectrum file, and if OMSSA 1502 * supports the file type at all. The input local 1503 * file path stored in string "spectrumFileTmp" 1504 * may have a file extension indicating a 1505 * different type of file, but this is 1506 * not used by OMSSA. 1507 */ 1449 1508 // 1450 1509 log.debug("spectrum file"); … … 1533 1592 */ 1534 1593 // Construct job done message 1594 String convertMessage = new String(""); 1595 if (mzDataConvertedToMgfUsed) 1596 { 1597 convertMessage = new String(" - mzData data converted to MGF used for search"); 1598 } 1535 1599 String doneMessage = new String("OMSSA search finished"); 1600 doneMessage = doneMessage + convertMessage; 1536 1601 // 1537 1602 doneMessage = doneMessage + "\n" + "OMSSA input file: " + omssaInputFilename; … … 1591 1656 1592 1657 /** 1658 * Fetches the converted mzData to MGF file. 1659 * The converted file is assumed to already 1660 * exist, being located in the same directory 1661 * as the input mzData file, and have the same 1662 * name as the latter, but with ".mgf" appended. 1663 * Returns null if the file cannot be found. 1664 * 1665 * @param dc DbControl The DbControl to use. 1666 * @param spectrumFile File The input mzData spectrum file. 1667 * @return File The converted mzData to MGF file. 1668 */ 1669 private File fetchConvertedMzDataToMgfFile(DbControl dc, File spectrumFile) 1670 { 1671 ItemFactory factory = new ItemFactory(dc); 1672 // Get path for mzData file converted to MGF 1673 Path spectrumFilePath = spectrumFile.getPath(); 1674 String spectrumFilePathStr = spectrumFilePath.toString(); 1675 log.debug("spectrumFilePathStr = \"" + spectrumFilePathStr + "\""); 1676 // Construct converted file path by appending ".mgf" 1677 spectrumFilePathStr = spectrumFilePathStr + ".mgf"; 1678 log.debug("spectrumFilePathStr = \"" + spectrumFilePathStr + "\""); 1679 spectrumFilePath = new Path(spectrumFilePathStr, Path.Type.FILE); 1680 // Get converted core spectrum file from path 1681 File convertedSpectrumFile = null; 1682 try 1683 { 1684 convertedSpectrumFile = factory.getByPath(spectrumFilePath, false); 1685 } 1686 catch (Exception e) 1687 { 1688 log.debug("Exception when trying to get core file from path \"" + spectrumFilePathStr + "\": " + e); 1689 } 1690 log.debug("convertedSpectrumFile = " + convertedSpectrumFile); 1691 return convertedSpectrumFile; 1692 } 1693 1694 1695 /** 1593 1696 * Update command line with new option and value, 1594 1697 * provided that the value differs from null and
Note: See TracChangeset
for help on using the changeset viewer.