Changeset 3867
- Timestamp:
- Sep 23, 2010, 8:44:23 AM (13 years ago)
- Location:
- trunk/client/servlet/src/org/proteios
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/org/proteios/action/omssa/ViewActiveOMSSAParameterSetStorage.java
r3825 r3867 1 1 /* 2 $Id$ 3 4 Copyright (C) 2006 Fredrik Levander, Gregory Vincic, Olle Mansson 5 Copyright (C) 2007 Fredrik Levander, Gregory Vincic 6 7 Files are copyright by their respective authors. The contributions to 8 files where copyright is not explicitly stated can be traced with the 9 source code revision system. 10 11 This file is part of Proteios. 12 Available at http://www.proteios.org/ 13 14 Proteios-2.x is free software; you can redistribute it and/or 15 modify it under the terms of the GNU General Public License 16 as published by the Free Software Foundation; either version 2 17 of the License, or (at your option) any later version. 18 19 Proteios is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU General Public License for more details. 23 24 You should have received a copy of the GNU General Public License 25 along with this program; if not, write to the Free Software 26 Foundation, Inc., 59 Temple Place - Suite 330, 27 Boston, MA 02111-1307, USA. 28 */ 2 $Id$ 3 4 Copyright (C) 2006 Fredrik Levander, Gregory Vincic, Olle Mansson 5 Copyright (C) 2007 Fredrik Levander, Gregory Vincic 6 Copyright (C) 2010 Gregory Vincic 7 8 Files are copyright by their respective authors. The contributions to 9 files where copyright is not explicitly stated can be traced with the 10 source code revision system. 11 12 This file is part of Proteios. 13 Available at http://www.proteios.org/ 14 15 Proteios-2.x is free software; you can redistribute it and/or 16 modify it under the terms of the GNU General Public License 17 as published by the Free Software Foundation; either version 2 18 of the License, or (at your option) any later version. 19 20 Proteios is distributed in the hope that it will be useful, 21 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 GNU General Public License for more details. 24 25 You should have received a copy of the GNU General Public License 26 along with this program; if not, write to the Free Software 27 Foundation, Inc., 59 Temple Place - Suite 330, 28 Boston, MA 02111-1307, USA. 29 */ 29 30 package org.proteios.action.omssa; 30 31 31 32 import java.io.InputStream; 32 33 import java.util.ArrayList; 34 import java.util.HashMap; 35 import java.util.Hashtable; 33 36 import java.util.List; 37 import java.util.Map; 34 38 import org.proteios.ActionLink; 35 39 import org.proteios.action.ProteiosAction; … … 47 51 import se.lu.thep.waf.constraints.InvalidParameterValue; 48 52 import se.lu.thep.waf.constraints.VInteger; 53 import se.lu.thep.waf.constraints.VString; 49 54 50 55 /** 51 * @author olle52 56 * @author olle 57 */ 53 58 public class ViewActiveOMSSAParameterSetStorage 54 59 extends ProteiosAction<ViewActiveOMSSAParameterSetStorage> 55 60 { 56 public static final VInteger VOMSSAPARAMETERSETSTORAGEID = new VInteger( 57 "active.omssaparametersetstorage.id", 1, false); 58 59 60 @Override 61 public void runMe() 62 throws ActionException, InvalidParameterValue 63 { 64 /*********************************************************************** 65 * Properties 66 */ 67 // Get the OMSSAParameterSetStorage item to use for the search 68 Integer omssapssId = getValidInteger(VOMSSAPARAMETERSETSTORAGEID); 69 log.debug("omssaParameterSetStorageId from VOMSSAPARAMETERSETSTORAGEID = " + omssapssId); 70 // Get the OMSSAParameterSetStorage item to use for the search 71 Boolean useWebInterfaceFlag = getValidBoolean(SearchOMSSA.VOMSSAUSEWEBINTERFACEFLAG); 72 log.debug("useWebInterfaceFlag from SearchOMSSA.VOMSSAUSEWEBINTERFACEFLAG = " + useWebInterfaceFlag); 73 if (useWebInterfaceFlag == null) 74 { 75 useWebInterfaceFlag = false; 76 } 77 log.debug("useWebInterfaceFlag = " + useWebInterfaceFlag); 78 // SearchOMSSA.VOMSSAUSEWEBINTERFACEFLAG 79 // Make sure an OMSSA parameter set has been selected 80 if (omssapssId == null || omssapssId == 0) 81 { 82 List<Integer> omssapssIds = getValidIntegerList(FormFactory.VID); 83 log.debug("omssapssIds from FormFactory.VID = " + omssapssIds); 84 // Make sure at least one file has been selected 85 if (omssapssIds == null || omssapssIds.size() == 0) 86 { 87 setError("Please select an OMSSA parameter set"); 88 return; 89 } 90 // Use first file in list 91 omssapssId = omssapssIds.get(0); 92 } 93 log.debug("omssapssId = " + omssapssId); 94 // Get the spectrum file items to use for the search 95 List<Integer> spectrumFileIds = getValidIntegerList(SearchOMSSA.VSPECTRUMFILEID); 96 log.debug("spectrumFileIds = " + spectrumFileIds); 97 // 98 DbControl dc = newDbControl(); 99 ItemFactory factory = getItemFactory(dc); 100 OMSSAParameterSetStorage omssapss = factory.getById(OMSSAParameterSetStorage.class, omssapssId); 101 // Get OMSSA parameter data from xml file 102 OMSSAParameterFileUtil omssaParameterFileUtil = new OMSSAParameterFileUtil(); 103 InputStream iStream = omssapss.getParameterFile().getDownloadStream(0); 104 omssaParameterFileUtil.setXMLInputStream(iStream); 105 OMSSAParameterSet omssaParameterSet = omssaParameterFileUtil.fetchOMSSAParameterSet(); 106 // Get OMSSA parameter set option alternatives 107 // Get OMSSAParameterSetOptionsUtil instance 108 OMSSAParameterSetOptionsUtil omssaParameterSetOptionUtil = new OMSSAParameterSetOptionsUtil(); 109 omssaParameterSetOptionUtil.setWebInterfaceUsed(useWebInterfaceFlag); 110 // Get enzyme option data 111 List<String> enzymeStringList = omssaParameterSetOptionUtil.fetchEnzymeStringList(); 112 List<Option> enzymeOptionList = stringListToOptionList(enzymeStringList); 113 // Get sequence library option data 114 List<String> sequenceLibraryStringList = omssaParameterSetOptionUtil.fetchSequenceLibraryStringList(); 115 List<Option> sequenceLibraryOptionList = stringListToOptionList(sequenceLibraryStringList); 116 // Get species option data 117 List<String> speciesStringList = omssaParameterSetOptionUtil.fetchSpeciesStringList(); 118 List<Option> speciesOptionList = stringListToOptionList(speciesStringList); 119 // Get fixed modifications option data 120 List<String> fixedModsStringList = omssaParameterSetOptionUtil.fetchModificationStringList(); 121 List<Option> fixedModsOptionList = stringListToOptionList(fixedModsStringList); 122 // Get variable modifications option data 123 List<String> variableModsStringList = omssaParameterSetOptionUtil.fetchModificationStringList(); 124 List<Option> variableModsOptionList = stringListToOptionList(variableModsStringList); 125 // OMSSA parameter set form 126 Form omssaParameterSetForm = getFormFactory().getOMSSAParameterSetForm(omssaParameterSet, 127 enzymeOptionList, 128 sequenceLibraryOptionList, 129 speciesOptionList, 130 fixedModsOptionList, 131 variableModsOptionList); 132 /*********************************************************************** 133 * Annotations table 134 */ 135 /* 136 Annotator anna = new Annotator(getItemFactory(dc)); 137 TableFactory tableFactory = getTableFactory(); 138 tableFactory.reset(); 139 tableFactory.setItemClass(Annotation.class); 140 ItemQuery<Annotation> annotationQuery = anna.getAnnotationSet(omssapss) 141 .getAnnotations(); 142 tableFactory.setQuery(annotationQuery); 143 tableFactory.setMaxResults(100); 144 Table annotationsTable = tableFactory.build(); 145 */ 146 /*********************************************************************** 147 * Toolbar 148 */ 149 Toolbar toolbar = new Toolbar(); 150 if (spectrumFileIds == null) 151 { 152 // Save OMSSA parameter set button 153 ActionLink save = getActionLink(SaveOMSSAParameterSetStorage.class, "Save"); 154 save.addParameter(VOMSSAPARAMETERSETSTORAGEID, omssapssId); 155 save.addParameter(SearchOMSSA.VSAVEOMSSAPARAMETERSETFLAG, true); 156 save.addParameter(ForwardField.VPARAM, ViewActiveOMSSAParameterSetStorage.class.getName()); 157 toolbar.add(save); 158 // "Save As" OMSSA parameter set button 159 ActionLink saveAs = getActionLink(SaveOMSSAParameterSetStorage.class, "SaveAs"); 160 saveAs.addParameter(VOMSSAPARAMETERSETSTORAGEID, omssapssId); 161 saveAs.addParameter(SearchOMSSA.VSAVEOMSSAPARAMETERSETFLAG, false); 162 saveAs.addParameter(SearchOMSSA.VSAVEASOMSSAPARAMETERSETFLAG, true); 163 saveAs.addParameter(ForwardField.VPARAM, ListOMSSAParameterSetStorage.class.getName()); 164 toolbar.add(saveAs); 165 } 166 else 167 { 168 // Save and Search OMSSA 169 ActionLink searchOMSSA = getActionLink(SaveOMSSAParameterSetStorage.class, "SaveAndSearchOMSSA"); 170 searchOMSSA.addParameter(VOMSSAPARAMETERSETSTORAGEID, omssapssId); 171 searchOMSSA.addParameter(SearchOMSSA.VSAVEOMSSAPARAMETERSETFLAG, true); 172 searchOMSSA.addParameter(ForwardField.VPARAM, SearchOMSSA.class.getName()); 173 for (Integer spectrumFileId : spectrumFileIds) 174 { 175 searchOMSSA.addParameter(SearchOMSSA.VSPECTRUMFILEID, spectrumFileId); 176 } 177 searchOMSSA.addParameter(SearchOMSSA.VOMSSAUSEWEBINTERFACEFLAG, useWebInterfaceFlag); 178 toolbar.add(searchOMSSA); 179 // "Save As" and Search OMSSA 180 ActionLink saveAsAndSearchOMSSA = getActionLink(SaveOMSSAParameterSetStorage.class, "SaveAsAndSearchOMSSA"); 181 saveAsAndSearchOMSSA.addParameter(VOMSSAPARAMETERSETSTORAGEID, omssapssId); 182 saveAsAndSearchOMSSA.addParameter(SearchOMSSA.VSAVEOMSSAPARAMETERSETFLAG, false); 183 saveAsAndSearchOMSSA.addParameter(SearchOMSSA.VSAVEASOMSSAPARAMETERSETFLAG, true); 184 saveAsAndSearchOMSSA.addParameter(ForwardField.VPARAM, SearchOMSSA.class.getName()); 185 for (Integer spectrumFileId : spectrumFileIds) 186 { 187 saveAsAndSearchOMSSA.addParameter(SearchOMSSA.VSPECTRUMFILEID, spectrumFileId); 188 } 189 saveAsAndSearchOMSSA.addParameter(SearchOMSSA.VOMSSAUSEWEBINTERFACEFLAG, useWebInterfaceFlag); 190 toolbar.add(saveAsAndSearchOMSSA); 191 } 192 omssaParameterSetForm.setToolbar(toolbar); 193 /*********************************************************************** 194 * Layout 195 */ 196 RowLayout layout = getLayoutFactory().getRowLayout(); 197 Title title = new Title("OMSSAParameterSet"); 198 title.setSubtitle(omssapss.getName()); 199 layout.add(title); 200 // 201 /* 202 Tab annotations = new Tab("OtherSettings", "annotationsTab"); 203 annotations.setGuiElement(annotationsTable); 204 ts.add(annotations); 205 */ 206 layout.add(omssaParameterSetForm); 207 setLayout(layout); 208 } 209 210 211 /** 212 * Converts a list of alternating key and value strings 213 * into a list of options. 214 * 215 * @param stringList List<String> A list of alternating key and value strings. 216 * @return List<Option> A list of options 217 */ 218 private List<Option> stringListToOptionList(List<String> stringList) 219 { 220 if (stringList == null) 221 { 222 return null; 223 } 224 List<Option> optionList = new ArrayList<Option>(0); 225 for (int i = 0; i < stringList.size(); i = i + 2) 226 { 227 String key = stringList.get(i); 228 String value = stringList.get(i + 1); 229 /* 230 * Note that the option "value" corresponds 231 * to the "key" in the key-value string pair, 232 * while the option "content" corresponds 233 * to the "value" in the key-value string pair. 234 */ 235 Option option = new Option(key, value); 236 optionList.add(option); 237 } 238 return optionList; 239 } 61 public static final VInteger VOMSSAPARAMETERSETSTORAGEID = new VInteger( 62 "active.omssaparametersetstorage.id", 1, false); 63 64 @Override 65 public void runMe() 66 throws ActionException, InvalidParameterValue 67 { 68 // Get the OMSSAParameterSetStorage item to use for the search 69 Integer omssapssId = getValidInteger(VOMSSAPARAMETERSETSTORAGEID); 70 log.debug("omssaParameterSetStorageId from VOMSSAPARAMETERSETSTORAGEID = " + omssapssId); 71 // Get the OMSSAParameterSetStorage item to use for the search 72 Boolean useWebInterfaceFlag = getValidBoolean(SearchOMSSA.VOMSSAUSEWEBINTERFACEFLAG); 73 log.debug("useWebInterfaceFlag from SearchOMSSA.VOMSSAUSEWEBINTERFACEFLAG = " + useWebInterfaceFlag); 74 if (useWebInterfaceFlag == null) 75 { 76 useWebInterfaceFlag = false; 77 } 78 log.debug("useWebInterfaceFlag = " + useWebInterfaceFlag); 79 // SearchOMSSA.VOMSSAUSEWEBINTERFACEFLAG 80 // Make sure an OMSSA parameter set has been selected 81 if (omssapssId == null || omssapssId == 0) 82 { 83 List<Integer> omssapssIds = getValidIntegerList(FormFactory.VID); 84 log.debug("omssapssIds from FormFactory.VID = " + omssapssIds); 85 // Make sure at least one file has been selected 86 if (omssapssIds == null || omssapssIds.size() == 0) 87 { 88 setError("Please select an OMSSA parameter set"); 89 return; 90 } 91 // Use first file in list 92 omssapssId = omssapssIds.get(0); 93 } 94 log.debug("omssapssId = " + omssapssId); 95 // Get the spectrum file items to use for the search 96 List<Integer> spectrumFileIds = getValidIntegerList(SearchOMSSA.VSPECTRUMFILEID); 97 log.debug("spectrumFileIds = " + spectrumFileIds); 98 // 99 DbControl dc = newDbControl(); 100 ItemFactory factory = getItemFactory(dc); 101 OMSSAParameterSetStorage omssapss = factory.getById(OMSSAParameterSetStorage.class, omssapssId); 102 // Get OMSSA parameter data from xml file 103 OMSSAParameterFileUtil omssaParameterFileUtil = new OMSSAParameterFileUtil(); 104 InputStream iStream = omssapss.getParameterFile().getDownloadStream(0); 105 omssaParameterFileUtil.setXMLInputStream(iStream); 106 OMSSAParameterSet omssaParameterSet = omssaParameterFileUtil.fetchOMSSAParameterSet(); 107 // Get OMSSA parameter set option alternatives 108 // Get OMSSAParameterSetOptionsUtil instance 109 OMSSAParameterSetOptionsUtil omssaParameterSetOptionUtil = new OMSSAParameterSetOptionsUtil(); 110 omssaParameterSetOptionUtil.setWebInterfaceUsed(useWebInterfaceFlag); 111 // Get enzyme option data 112 List<String> enzymeStringList = omssaParameterSetOptionUtil.fetchEnzymeStringList(); 113 List<Option> enzymeOptionList = stringListToOptionList(enzymeStringList); 114 // Get sequence library option data 115 List<String> sequenceLibraryStringList = omssaParameterSetOptionUtil.fetchSequenceLibraryStringList(); 116 List<Option> sequenceLibraryOptionList = stringListToOptionList(sequenceLibraryStringList); 117 // Get species option data 118 List<String> speciesStringList = omssaParameterSetOptionUtil.fetchSpeciesStringList(); 119 List<Option> speciesOptionList = stringListToOptionList(speciesStringList); 120 // Get fixed modifications option data 121 List<String> fixedModsStringList = omssaParameterSetOptionUtil.fetchModificationStringList(); 122 List<Option> fixedModsOptionList = stringListToOptionList(fixedModsStringList); 123 // Get variable modifications option data 124 List<String> variableModsStringList = omssaParameterSetOptionUtil.fetchModificationStringList(); 125 List<Option> variableModsOptionList = stringListToOptionList(variableModsStringList); 126 // OMSSA parameter set form 127 Form omssaParameterSetForm = getOMSSAParameterSetForm(omssaParameterSet, 128 enzymeOptionList, 129 sequenceLibraryOptionList, 130 speciesOptionList, 131 fixedModsOptionList, 132 variableModsOptionList); 133 /*********************************************************************** 134 * Toolbar 135 */ 136 Toolbar toolbar = new Toolbar(); 137 if (spectrumFileIds == null) 138 { 139 // Save OMSSA parameter set button 140 ActionLink save = getActionLink(SaveOMSSAParameterSetStorage.class, "Save"); 141 save.addParameter(VOMSSAPARAMETERSETSTORAGEID, omssapssId); 142 save.addParameter(SearchOMSSA.VSAVEOMSSAPARAMETERSETFLAG, true); 143 save.addParameter(ForwardField.VPARAM, ViewActiveOMSSAParameterSetStorage.class.getName()); 144 toolbar.add(save); 145 // "Save As" OMSSA parameter set button 146 ActionLink saveAs = getActionLink(SaveOMSSAParameterSetStorage.class, "SaveAs"); 147 saveAs.addParameter(VOMSSAPARAMETERSETSTORAGEID, omssapssId); 148 saveAs.addParameter(SearchOMSSA.VSAVEOMSSAPARAMETERSETFLAG, false); 149 saveAs.addParameter(SearchOMSSA.VSAVEASOMSSAPARAMETERSETFLAG, true); 150 saveAs.addParameter(ForwardField.VPARAM, ListOMSSAParameterSetStorage.class.getName()); 151 toolbar.add(saveAs); 152 } 153 else 154 { 155 // Save and Search OMSSA 156 ActionLink searchOMSSA = getActionLink(SaveOMSSAParameterSetStorage.class, "SaveAndSearchOMSSA"); 157 searchOMSSA.addParameter(VOMSSAPARAMETERSETSTORAGEID, omssapssId); 158 searchOMSSA.addParameter(SearchOMSSA.VSAVEOMSSAPARAMETERSETFLAG, true); 159 searchOMSSA.addParameter(ForwardField.VPARAM, SearchOMSSA.class.getName()); 160 for (Integer spectrumFileId : spectrumFileIds) 161 { 162 searchOMSSA.addParameter(SearchOMSSA.VSPECTRUMFILEID, spectrumFileId); 163 } 164 searchOMSSA.addParameter(SearchOMSSA.VOMSSAUSEWEBINTERFACEFLAG, useWebInterfaceFlag); 165 toolbar.add(searchOMSSA); 166 // "Save As" and Search OMSSA 167 ActionLink saveAsAndSearchOMSSA = getActionLink(SaveOMSSAParameterSetStorage.class, "SaveAsAndSearchOMSSA"); 168 saveAsAndSearchOMSSA.addParameter(VOMSSAPARAMETERSETSTORAGEID, omssapssId); 169 saveAsAndSearchOMSSA.addParameter(SearchOMSSA.VSAVEOMSSAPARAMETERSETFLAG, false); 170 saveAsAndSearchOMSSA.addParameter(SearchOMSSA.VSAVEASOMSSAPARAMETERSETFLAG, true); 171 saveAsAndSearchOMSSA.addParameter(ForwardField.VPARAM, SearchOMSSA.class.getName()); 172 for (Integer spectrumFileId : spectrumFileIds) 173 { 174 saveAsAndSearchOMSSA.addParameter(SearchOMSSA.VSPECTRUMFILEID, spectrumFileId); 175 } 176 saveAsAndSearchOMSSA.addParameter(SearchOMSSA.VOMSSAUSEWEBINTERFACEFLAG, useWebInterfaceFlag); 177 toolbar.add(saveAsAndSearchOMSSA); 178 } 179 omssaParameterSetForm.setToolbar(toolbar); 180 /*********************************************************************** 181 * Layout 182 */ 183 RowLayout layout = getLayoutFactory().getRowLayout(); 184 Title title = new Title("OMSSAParameterSet"); 185 title.setSubtitle(omssapss.getName()); 186 layout.add(title); 187 // 188 layout.add(omssaParameterSetForm); 189 setLayout(layout); 190 } 191 192 public Form getOMSSAParameterSetForm(OMSSAParameterSet omssaParameterSet, 193 List<Option> enzymeOptionList, 194 List<Option> sequenceLibraryOptionList, 195 List<Option> speciesOptionList, List<Option> fixedModsOptionList, 196 List<Option> variableModsOptionList) 197 { 198 OMSSAParameterFileUtil omssaParameterFileUtil = new OMSSAParameterFileUtil(); 199 // String delimRegex = new String(",\\ "); 200 String delimRegex = new String(","); 201 // Fetch help hash tables to find attribute strings 202 Hashtable<String, String> searchTypeHT = omssaParameterFileUtil 203 .fetchSearchTypeAttributeHashtable(); 204 Hashtable<String, String> ionTypeHT = omssaParameterFileUtil 205 .fetchIonTypeAttributeHashtable(); 206 Hashtable<String, String> zDependenceHT = omssaParameterFileUtil 207 .fetchZDependenceAttributeHashtable(); 208 Hashtable<String, String> enzymeHT = omssaParameterFileUtil 209 .fetchEnzymeAttributeHashtable(); 210 Hashtable<String, String> speciesHT = omssaParameterFileUtil 211 .fetchSpeciesAttributeHashtable(); 212 Hashtable<String, String> modificationHT = omssaParameterFileUtil 213 .fetchModificationAttributeHashtable(); 214 // Fetch help lists to find menu alternatives 215 List<String> searchTypeL = omssaParameterFileUtil 216 .fetchSearchTypeAlternativesList(); 217 List<String> ionTypeL = omssaParameterFileUtil 218 .fetchIonTypeAlternativesList(); 219 List<String> zDependenceL = omssaParameterFileUtil 220 .fetchZDependenceAlternativesList(); 221 List<String> enzymeL = omssaParameterFileUtil 222 .fetchEnzymeAlternativesList(); 223 List<String> speciesL = omssaParameterFileUtil 224 .fetchSpeciesAlternativesList(); 225 List<String> modificationL = omssaParameterFileUtil 226 .fetchModificationAlternativesList(); 227 // DbControl dc = project.getDbControl(); 228 Form form = new Form("OMSSAParameterSetForm"); 229 /* 230 * String select box variables 231 */ 232 VString validStringParam = null; 233 List<String> stringList = null; 234 List<Option> optionList = null; 235 String selected = null; 236 List<String> selectedList = null; 237 /* 238 * General field set 239 */ 240 Fieldset generalFS = new Fieldset(); 241 generalFS.setTitle("OMSSAParameterSetGeneral"); 242 form.addFieldset(generalFS); 243 // General, enzyme 244 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_ENZYME; 245 optionList = new ArrayList<Option>(); 246 for (String key : enzymeL) 247 { 248 optionList.add(new Option(key, enzymeHT.get(key))); 249 } 250 // Use input enzyme option list if present 251 if (enzymeOptionList != null && enzymeOptionList.size() >= optionList 252 .size()) 253 { 254 optionList = enzymeOptionList; 255 } 256 selected = omssaParameterSet.getEnzyme(); 257 Select<VString> enzymeSelectBox = new Select<VString>(validStringParam, 258 optionList); 259 enzymeSelectBox.selectOption( selected); 260 enzymeSelectBox.setLabel("OMSSAEnzymeSelect"); 261 generalFS.add(enzymeSelectBox); 262 // General, maximum missed cleavages 263 TextField<String> maxMissedCleavages = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MISSED_CLEAVE); 264 maxMissedCleavages.setValue(omssaParameterSet.getMissedCleave()); 265 generalFS.add(maxMissedCleavages); 266 // General, sequence library 267 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_DB; 268 optionList = new ArrayList<Option>(); 269 optionList.add(new Option("nr", "nr")); 270 optionList.add(new Option("refseq_protein", "refseq_protein")); 271 // Use input sequence library option list if present 272 if (sequenceLibraryOptionList != null && sequenceLibraryOptionList 273 .size() >= optionList.size()) 274 { 275 optionList = sequenceLibraryOptionList; 276 } 277 selected = omssaParameterSet.getDb(); 278 Select<VString> sequenceLibrarySelectBox = new Select<VString>( 279 validStringParam, optionList); 280 sequenceLibrarySelectBox.selectOption( selected); 281 sequenceLibrarySelectBox.setLabel("OMSSASequenceLibrarySelect"); 282 generalFS.add(sequenceLibrarySelectBox); 283 // General, species 284 /* 285 * Species selection has one peculiarity: 1. It supports selection of 286 * multiple items. The multiple selection items are stored in XML as a 287 * string with items separated by ", ". 288 */ 289 // Species 290 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_SPECIES; 291 optionList = new ArrayList<Option>(); 292 for (String key : speciesL) 293 { 294 optionList.add(new Option(key, speciesHT.get(key))); 295 } 296 // Use input species option list if present 297 if (speciesOptionList != null && speciesOptionList.size() >= optionList.size()) 298 { 299 optionList = speciesOptionList; 300 } 301 selected = omssaParameterSet.getSpecies(); 302 selectedList = listStringToStringList(selected, delimRegex); 303 Select<VString> species = new Select<VString>(validStringParam, 304 optionList, selectedList); 305 species.setLabel("OMSSASpecies"); 306 species.setMultiple(true); 307 species.setSize(7); 308 generalFS.add(species); 309 // General, hit list max length 310 TextField<String> hitListMaxLength = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_HIT_LIST_LEN); 311 hitListMaxLength.setValue(omssaParameterSet.getHitListLen()); 312 generalFS.add(hitListMaxLength); 313 // General, e-value cutoff 314 TextField<String> eValueCutoff = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_CUTOFF); 315 eValueCutoff.setValue(omssaParameterSet.getCutoff()); 316 generalFS.add(eValueCutoff); 317 // General, fixed modifications 318 /* 319 * Fixed modifications selection has one peculiarity: 1. It supports 320 * selection of multiple items. The multiple selection items are stored 321 * in XML as a string with items separated by ", ". 322 */ 323 // Fixed mods 324 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_FIXED; 325 optionList = new ArrayList<Option>(); 326 for (String key : modificationL) 327 { 328 optionList.add(new Option(key, modificationHT.get(key))); 329 } 330 // Use input fixed mods option list if present 331 if (fixedModsOptionList != null && fixedModsOptionList.size() >= optionList 332 .size()) 333 { 334 optionList = fixedModsOptionList; 335 } 336 selected = omssaParameterSet.getFixed(); 337 selectedList = listStringToStringList(selected, delimRegex); 338 Select<VString> fixedMods = new Select<VString>(validStringParam, optionList, selectedList); 339 fixedMods.setLabel("OMSSAFixedMods"); 340 fixedMods.setMultiple(true); 341 fixedMods.setSize(7); 342 generalFS.add(fixedMods); 343 // General, variable modifications 344 /* 345 * Variable modifications selection has one peculiarity: 1. It supports 346 * selection of multiple items. The multiple selection items are stored 347 * in XML as a string with items separated by ", ". 348 */ 349 // Variable mods 350 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_VARIABLE; 351 optionList = new ArrayList<Option>(); 352 for (String key : modificationL) 353 { 354 optionList.add(new Option(key, modificationHT.get(key))); 355 } 356 // Use input variable mods option list if present 357 if (variableModsOptionList != null && variableModsOptionList.size() >= optionList.size()) 358 { 359 optionList = variableModsOptionList; 360 } 361 selected = omssaParameterSet.getVariable(); 362 selectedList = listStringToStringList(selected, delimRegex); 363 Select<VString> variableMods = new Select<VString>( 364 validStringParam, optionList, selectedList); 365 variableMods.setLabel("OMSSAVariableMods"); 366 variableMods.setMultiple(true); 367 variableMods.setSize(7); 368 generalFS.add(variableMods); 369 // General, maximum variable mod combinations searched per peptide 370 TextField<String> maxMods = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MAX_MODS); 371 maxMods.setValue(omssaParameterSet.getMaxMods()); 372 generalFS.add(maxMods); 373 // General, precursor mass tolerance (Da) 374 TextField<String> precursorMassTolerance = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_PEP_TOL); 375 precursorMassTolerance.setValue(omssaParameterSet.getPepTol()); 376 generalFS.add(precursorMassTolerance); 377 // General, product mass tolerance (Da) 378 TextField<String> productMassTolerance = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MSMS_TOL); 379 productMassTolerance.setValue(omssaParameterSet.getMsMsTol()); 380 generalFS.add(productMassTolerance); 381 // General, precursor mass search type 382 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_PRECURSOR_SEARCH_TYPE; 383 optionList = new ArrayList<Option>(); 384 for (String key : searchTypeL) 385 { 386 optionList.add(new Option(key, searchTypeHT.get(key))); 387 } 388 selected = omssaParameterSet.getPrecursorSearchType(); 389 Select<VString> precursorMassSearchTypeSelectBox = new Select<VString>( 390 validStringParam, optionList); 391 precursorMassSearchTypeSelectBox.selectOption( selected); 392 precursorMassSearchTypeSelectBox.setLabel("OMSSAPrecursorMassSearchTypeSelect"); 393 generalFS.add(precursorMassSearchTypeSelectBox); 394 // General, product mass search type 395 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_PRODUCT_SEARCH_TYPE; 396 optionList = new ArrayList<Option>(); 397 for (String key : searchTypeL) 398 { 399 optionList.add(new Option(key, searchTypeHT.get(key))); 400 } 401 selected = omssaParameterSet.getProductSearchType(); 402 Select<VString> productMassSearchTypeSelectBox = new Select<VString>( 403 validStringParam, optionList); 404 productMassSearchTypeSelectBox.selectOption( selected); 405 productMassSearchTypeSelectBox 406 .setLabel("OMSSAProductMassSearchTypeSelect"); 407 generalFS.add(productMassSearchTypeSelectBox); 408 // General, lower bound of precursor charge 409 TextField<String> minPrecursorCharge = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MIN_CHARGE); 410 minPrecursorCharge.setValue(omssaParameterSet.getMinCharge()); 411 generalFS.add(minPrecursorCharge); 412 // General, upper bound of precursor charge 413 TextField<String> maxPrecursorCharge = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MAX_CHARGE); 414 maxPrecursorCharge.setValue(omssaParameterSet.getMaxCharge()); 415 generalFS.add(maxPrecursorCharge); 416 // General, minimum charge to start using multiply charged products 417 TextField<String> minChargeConsiderMult = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_CONSIDER_MULT); 418 minChargeConsiderMult.setValue(omssaParameterSet.getConsiderMult()); 419 generalFS.add(minChargeConsiderMult); 420 // General, fraction of product peaks below precursor to determine +1 421 // precursor 422 TextField<String> fracProdPeaksPlusOne = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_PLUS_ONE); 423 fracProdPeaksPlusOne.setValue(omssaParameterSet.getPlusOne()); 424 generalFS.add(fracProdPeaksPlusOne); 425 // General, peak low intensity cutoff (fraction of most intense) 426 TextField<String> peakLowIntensityCutoff = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_CUTLO); 427 peakLowIntensityCutoff.setValue(omssaParameterSet.getCutLo()); 428 generalFS.add(peakLowIntensityCutoff); 429 // General, number of top intensity peaks in first pass 430 TextField<String> numTopIntensityPeaks = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_TOP_HIT_NUM); 431 numTopIntensityPeaks.setValue(omssaParameterSet.getTopHitNum()); 432 generalFS.add(numTopIntensityPeaks); 433 // General, ions to search 1 434 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_IONS_TO_SEARCH_1; 435 optionList = new ArrayList<Option>(); 436 for (String key : ionTypeL) 437 { 438 optionList.add(new Option(key, ionTypeHT.get(key))); 439 } 440 selected = omssaParameterSet.getIonsToSearch1(); 441 Select<VString> ionsToSearch1SelectBox = new Select<VString>(validStringParam, optionList); 442 ionsToSearch1SelectBox.selectOption( selected); 443 ionsToSearch1SelectBox.setLabel("OMSSAIonsToSearch1Select"); 444 generalFS.add(ionsToSearch1SelectBox); 445 // General, ions to search 2 446 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_IONS_TO_SEARCH_2; 447 optionList = new ArrayList<Option>(); 448 for (String key : ionTypeL) 449 { 450 optionList.add(new Option(key, ionTypeHT.get(key))); 451 } 452 selected = omssaParameterSet.getIonsToSearch2(); 453 Select<VString> ionsToSearch2SelectBox = new Select<VString>(validStringParam, optionList); 454 ionsToSearch2SelectBox.selectOption( selected); 455 ionsToSearch2SelectBox.setLabel("OMSSAIonsToSearch2Select"); 456 generalFS.add(ionsToSearch2SelectBox); 457 /* 458 * Extra field set 459 */ 460 Fieldset extraFS = new Fieldset(); 461 extraFS.setTitle("OMSSAParameterSetExtra"); 462 form.addFieldset(extraFS); 463 // Extra, z dependence 464 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_ZDEP; 465 optionList = new ArrayList<Option>(); 466 for (String key : zDependenceL) 467 { 468 optionList.add(new Option(key, zDependenceHT.get(key))); 469 } 470 selected = omssaParameterSet.getZDep(); 471 Select<VString> zDepSelectBox = new Select<VString>(validStringParam, optionList); 472 zDepSelectBox.selectOption( selected); 473 zDepSelectBox.setLabel("OMSSAZDepSelect"); 474 extraFS.add(zDepSelectBox); 475 // Extra, peak high intensity cutoff (fraction of most intense) 476 TextField<String> peakHighIntensityCutoff = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_CUTHI); 477 peakHighIntensityCutoff.setValue(omssaParameterSet.getCutHi()); 478 extraFS.add(peakHighIntensityCutoff); 479 // Extra, peak intensity cutoff increment (fraction of most intense) 480 TextField<String> peakIntensityCutInc = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_CUTINC); 481 peakIntensityCutInc.setValue(omssaParameterSet.getCutInc()); 482 extraFS.add(peakIntensityCutInc); 483 // Extra, single win 484 TextField<String> singleWin = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SINGLE_WIN); 485 singleWin.setValue(omssaParameterSet.getSingleWin()); 486 extraFS.add(singleWin); 487 // Extra, double win 488 TextField<String> doubleWin = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_DOUBLE_WIN); 489 doubleWin.setValue(omssaParameterSet.getDoubleWin()); 490 extraFS.add(doubleWin); 491 // Extra, single num 492 TextField<String> singleNum = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SINGLE_NUM); 493 singleNum.setValue(omssaParameterSet.getSingleNum()); 494 extraFS.add(singleNum); 495 // Extra, double num 496 TextField<String> doubleNum = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_DOUBLE_NUM); 497 doubleNum.setValue(omssaParameterSet.getDoubleNum()); 498 extraFS.add(doubleNum); 499 // Extra, min hit 500 TextField<String> minHit = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MIN_HIT); 501 minHit.setValue(omssaParameterSet.getMinHit()); 502 extraFS.add(minHit); 503 // Extra, min spectra 504 TextField<String> minSpectra = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MIN_SPECTRA); 505 minSpectra.setValue(omssaParameterSet.getMinSpectra()); 506 extraFS.add(minSpectra); 507 // Extra, scale 508 TextField<String> scale = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SCALE); 509 scale.setValue(omssaParameterSet.getScale()); 510 extraFS.add(scale); 511 // Extra, ms calc plus one 512 TextField<String> msCalcPlusOne = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MS_CALC_PLUS_ONE); 513 msCalcPlusOne.setValue(omssaParameterSet.getMsCalcPlusOne()); 514 extraFS.add(msCalcPlusOne); 515 // Extra, ms calc charge 516 TextField<String> msCalcCharge = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MS_CALC_CHARGE); 517 msCalcCharge.setValue(omssaParameterSet.getMsCalcCharge()); 518 extraFS.add(msCalcCharge); 519 // Extra, max product charge 520 TextField<String> maxProductCharge = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MAX_PRODUCT_CHARGE); 521 maxProductCharge.setValue(omssaParameterSet.getMaxProductCharge()); 522 extraFS.add(maxProductCharge); 523 // Extra, pseudo count 524 TextField<String> pseudoCount = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_PSEUDO_COUNT); 525 pseudoCount.setValue(omssaParameterSet.getPseudoCount()); 526 extraFS.add(pseudoCount); 527 // Extra, search b1 528 TextField<String> searchB1 = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SEARCH_B1); 529 searchB1.setValue(omssaParameterSet.getSearchB1()); 530 extraFS.add(searchB1); 531 // Extra, search C terminus product 532 TextField<String> searchCTermProduct = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SEARCH_C_TERM_PRODUCT); 533 searchCTermProduct.setValue(omssaParameterSet.getSearchCTermProduct()); 534 extraFS.add(searchCTermProduct); 535 // Extra, max productions 536 TextField<String> maxProductions = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MAX_PRODUCTIONS); 537 maxProductions.setValue(omssaParameterSet.getMaxProductions()); 538 extraFS.add(maxProductions); 539 // Extra, min no enzyme 540 TextField<String> minNoEnzyme = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MIN_NO_ENZYME); 541 minNoEnzyme.setValue(omssaParameterSet.getMinNoEnzyme()); 542 extraFS.add(minNoEnzyme); 543 // Extra, max no enzyme 544 TextField<String> maxNoEnzyme = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MAX_NO_ENZYME); 545 maxNoEnzyme.setValue(omssaParameterSet.getMaxNoEnzyme()); 546 extraFS.add(maxNoEnzyme); 547 // Extra, exact mass 548 TextField<String> exactMass = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_EXACT_MASS); 549 exactMass.setValue(omssaParameterSet.getExactMass()); 550 extraFS.add(exactMass); 551 // Extra, setting id 552 TextField<String> settingId = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SETTING_ID); 553 settingId.setValue(omssaParameterSet.getSettingId()); 554 extraFS.add(settingId); 555 // Extra, research threshold 556 TextField<String> researchThreshold = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_RESEARCH_THRESH); 557 researchThreshold.setValue(omssaParameterSet.getResearchThresh()); 558 extraFS.add(researchThreshold); 559 // Extra, subset threshold 560 TextField<String> subsetThreshold = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SUBSET_THRESH); 561 subsetThreshold.setValue(omssaParameterSet.getSubsetThresh()); 562 extraFS.add(subsetThreshold); 563 // Extra, replace threshold 564 TextField<String> replaceThreshold = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_REPLACE_THRESH); 565 replaceThreshold.setValue(omssaParameterSet.getReplaceThresh()); 566 extraFS.add(replaceThreshold); 567 // Extra, precursor cull 568 TextField<String> precursorCull = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_PRECURSOR_CULL); 569 precursorCull.setValue(omssaParameterSet.getPrecursorCull()); 570 extraFS.add(precursorCull); 571 // Extra, no correlation score 572 TextField<String> noCorrelationScore = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_NO_CORRELATION_SCORE); 573 noCorrelationScore.setValue(omssaParameterSet.getNoCorrelationScore()); 574 extraFS.add(noCorrelationScore); 575 // Extra, prob following ion 576 TextField<String> probFollowingIon = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_PROB_FOLLOWING_ION); 577 probFollowingIon.setValue(omssaParameterSet.getProbFollowingIon()); 578 extraFS.add(probFollowingIon); 579 // Extra, nMethionine 580 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_NMETHIONINE_ATTRIBUTE; 581 optionList = new ArrayList<Option>(); 582 optionList.add(new Option("true", "true")); 583 optionList.add(new Option("false", "false")); 584 selected = omssaParameterSet.getNMethionineAttribute(); 585 Select<VString> nMethionineSelectBox = new Select<VString>(validStringParam, optionList); 586 nMethionineSelectBox.selectOption( selected); 587 nMethionineSelectBox.setLabel("OMSSANMethionineSelect"); 588 extraFS.add(nMethionineSelectBox); 589 // Extra, auto mass adjust 590 TextField<String> autoMassAdjust = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_AUTO_MASS_ADJUST); 591 autoMassAdjust.setValue(omssaParameterSet.getAutoMassAdjust()); 592 extraFS.add(autoMassAdjust); 593 // 594 return form; 595 } 596 597 /** 598 * Converts a list of alternating key and value strings 599 * into a list of options. 600 * 601 * @param stringList List<String> A list of alternating key and value strings. 602 * @return List<Option> A list of options 603 */ 604 private List<Option> stringListToOptionList(List<String> stringList) 605 { 606 if (stringList == null) 607 { 608 return null; 609 } 610 List<Option> optionList = new ArrayList<Option>(0); 611 for (int i = 0; i < stringList.size(); i = i + 2) 612 { 613 String key = stringList.get(i); 614 String value = stringList.get(i + 1); 615 /* 616 * Note that the option "value" corresponds 617 * to the "key" in the key-value string pair, 618 * while the option "content" corresponds 619 * to the "value" in the key-value string pair. 620 */ 621 Option option = new Option(key, value); 622 optionList.add(option); 623 } 624 return optionList; 625 } 626 627 /** 628 * Converts a list String to a list with String elements. If the list string 629 * contains two delimiter strings directly after each other, an empty string 630 * element will be added to the list in the corresponding place. Example: 631 * List string "one, two, three" will be converted to a list with the three 632 * String elements "one", "two", and "three" using delimiter regular 633 * expression ",\\ ". 634 * 635 * @param listString String A string with a list 636 * @param delimiterRegex String A regular expression for the delimiter 637 * between list elements 638 * @return List<String> A list of String elements 639 */ 640 private List<String> listStringToStringList(String listString, 641 String delimiterRegex) 642 { 643 List<String> stringList = null; 644 if (listString != null) 645 { 646 stringList = new ArrayList<String>(0); 647 for (String part : listString.split(delimiterRegex, -1)) 648 { 649 // Add list part if not already in list 650 if (part != null && !stringList.contains(part)) 651 { 652 stringList.add(part); 653 } 654 } 655 } 656 return stringList; 657 } 658 240 659 } -
trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java
r3866 r3867 2288 2288 2289 2289 //Cleaning up from here 2290 2291 public Form getOMSSAParameterSetForm(OMSSAParameterSet omssaParameterSet,2292 List<Option> enzymeOptionList,2293 List<Option> sequenceLibraryOptionList,2294 List<Option> speciesOptionList, List<Option> fixedModsOptionList,2295 List<Option> variableModsOptionList)2296 {2297 OMSSAParameterFileUtil omssaParameterFileUtil = new OMSSAParameterFileUtil();2298 // String delimRegex = new String(",\\ ");2299 String delimRegex = new String(",");2300 // Fetch help hash tables to find attribute strings2301 Hashtable<String, String> searchTypeHT = omssaParameterFileUtil2302 .fetchSearchTypeAttributeHashtable();2303 Hashtable<String, String> ionTypeHT = omssaParameterFileUtil2304 .fetchIonTypeAttributeHashtable();2305 Hashtable<String, String> zDependenceHT = omssaParameterFileUtil2306 .fetchZDependenceAttributeHashtable();2307 Hashtable<String, String> enzymeHT = omssaParameterFileUtil2308 .fetchEnzymeAttributeHashtable();2309 Hashtable<String, String> speciesHT = omssaParameterFileUtil2310 .fetchSpeciesAttributeHashtable();2311 Hashtable<String, String> modificationHT = omssaParameterFileUtil2312 .fetchModificationAttributeHashtable();2313 // Fetch help lists to find menu alternatives2314 List<String> searchTypeL = omssaParameterFileUtil2315 .fetchSearchTypeAlternativesList();2316 List<String> ionTypeL = omssaParameterFileUtil2317 .fetchIonTypeAlternativesList();2318 List<String> zDependenceL = omssaParameterFileUtil2319 .fetchZDependenceAlternativesList();2320 List<String> enzymeL = omssaParameterFileUtil2321 .fetchEnzymeAlternativesList();2322 List<String> speciesL = omssaParameterFileUtil2323 .fetchSpeciesAlternativesList();2324 List<String> modificationL = omssaParameterFileUtil2325 .fetchModificationAlternativesList();2326 // DbControl dc = project.getDbControl();2327 Form form = new Form("OMSSAParameterSetForm");2328 /*2329 * String select box variables2330 */2331 VString validStringParam = null;2332 List<String> stringList = null;2333 List<Option> optionList = null;2334 String selected = null;2335 List<String> selectedList = null;2336 /*2337 * General field set2338 */2339 Fieldset generalFS = new Fieldset();2340 generalFS.setTitle("OMSSAParameterSetGeneral");2341 form.addFieldset(generalFS);2342 // General, enzyme2343 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_ENZYME;2344 optionList = new ArrayList<Option>();2345 for (String key : enzymeL)2346 {2347 optionList.add(new Option(key, enzymeHT.get(key)));2348 }2349 // Use input enzyme option list if present2350 if (enzymeOptionList != null && enzymeOptionList.size() >= optionList2351 .size())2352 {2353 optionList = enzymeOptionList;2354 }2355 selected = omssaParameterSet.getEnzyme();2356 Select<VString> enzymeSelectBox = new Select<VString>(validStringParam,2357 optionList);2358 enzymeSelectBox.selectOption( selected);2359 enzymeSelectBox.setLabel("OMSSAEnzymeSelect");2360 generalFS.add(enzymeSelectBox);2361 // General, maximum missed cleavages2362 TextField<String> maxMissedCleavages = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MISSED_CLEAVE);2363 maxMissedCleavages.setValue(omssaParameterSet.getMissedCleave());2364 generalFS.add(maxMissedCleavages);2365 // General, sequence library2366 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_DB;2367 optionList = new ArrayList<Option>();2368 optionList.add(new Option("nr", "nr"));2369 optionList.add(new Option("refseq_protein", "refseq_protein"));2370 // Use input sequence library option list if present2371 if (sequenceLibraryOptionList != null && sequenceLibraryOptionList2372 .size() >= optionList.size())2373 {2374 optionList = sequenceLibraryOptionList;2375 }2376 selected = omssaParameterSet.getDb();2377 Select<VString> sequenceLibrarySelectBox = new Select<VString>(2378 validStringParam, optionList);2379 sequenceLibrarySelectBox.selectOption( selected);2380 sequenceLibrarySelectBox.setLabel("OMSSASequenceLibrarySelect");2381 generalFS.add(sequenceLibrarySelectBox);2382 // General, species2383 /*2384 * Species selection has one peculiarity: 1. It supports selection of2385 * multiple items. The multiple selection items are stored in XML as a2386 * string with items separated by ", ".2387 */2388 // Species2389 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_SPECIES;2390 optionList = new ArrayList<Option>();2391 for (String key : speciesL)2392 {2393 optionList.add(new Option(key, speciesHT.get(key)));2394 }2395 // Use input species option list if present2396 if (speciesOptionList != null && speciesOptionList.size() >= optionList.size())2397 {2398 optionList = speciesOptionList;2399 }2400 selected = omssaParameterSet.getSpecies();2401 selectedList = listStringToStringList(selected, delimRegex);2402 Select<VString> species = new Select<VString>(validStringParam,2403 optionList, selectedList);2404 species.setLabel("OMSSASpecies");2405 species.setMultiple(true);2406 species.setSize(7);2407 generalFS.add(species);2408 // General, hit list max length2409 TextField<String> hitListMaxLength = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_HIT_LIST_LEN);2410 hitListMaxLength.setValue(omssaParameterSet.getHitListLen());2411 generalFS.add(hitListMaxLength);2412 // General, e-value cutoff2413 TextField<String> eValueCutoff = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_CUTOFF);2414 eValueCutoff.setValue(omssaParameterSet.getCutoff());2415 generalFS.add(eValueCutoff);2416 // General, fixed modifications2417 /*2418 * Fixed modifications selection has one peculiarity: 1. It supports2419 * selection of multiple items. The multiple selection items are stored2420 * in XML as a string with items separated by ", ".2421 */2422 // Fixed mods2423 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_FIXED;2424 optionList = new ArrayList<Option>();2425 for (String key : modificationL)2426 {2427 optionList.add(new Option(key, modificationHT.get(key)));2428 }2429 // Use input fixed mods option list if present2430 if (fixedModsOptionList != null && fixedModsOptionList.size() >= optionList2431 .size())2432 {2433 optionList = fixedModsOptionList;2434 }2435 selected = omssaParameterSet.getFixed();2436 selectedList = listStringToStringList(selected, delimRegex);2437 Select<VString> fixedMods = new Select<VString>(validStringParam, optionList, selectedList);2438 fixedMods.setLabel("OMSSAFixedMods");2439 fixedMods.setMultiple(true);2440 fixedMods.setSize(7);2441 generalFS.add(fixedMods);2442 // General, variable modifications2443 /*2444 * Variable modifications selection has one peculiarity: 1. It supports2445 * selection of multiple items. The multiple selection items are stored2446 * in XML as a string with items separated by ", ".2447 */2448 // Variable mods2449 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_VARIABLE;2450 optionList = new ArrayList<Option>();2451 for (String key : modificationL)2452 {2453 optionList.add(new Option(key, modificationHT.get(key)));2454 }2455 // Use input variable mods option list if present2456 if (variableModsOptionList != null && variableModsOptionList.size() >= optionList.size())2457 {2458 optionList = variableModsOptionList;2459 }2460 selected = omssaParameterSet.getVariable();2461 selectedList = listStringToStringList(selected, delimRegex);2462 Select<VString> variableMods = new Select<VString>(2463 validStringParam, optionList, selectedList);2464 variableMods.setLabel("OMSSAVariableMods");2465 variableMods.setMultiple(true);2466 variableMods.setSize(7);2467 generalFS.add(variableMods);2468 // General, maximum variable mod combinations searched per peptide2469 TextField<String> maxMods = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MAX_MODS);2470 maxMods.setValue(omssaParameterSet.getMaxMods());2471 generalFS.add(maxMods);2472 // General, precursor mass tolerance (Da)2473 TextField<String> precursorMassTolerance = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_PEP_TOL);2474 precursorMassTolerance.setValue(omssaParameterSet.getPepTol());2475 generalFS.add(precursorMassTolerance);2476 // General, product mass tolerance (Da)2477 TextField<String> productMassTolerance = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MSMS_TOL);2478 productMassTolerance.setValue(omssaParameterSet.getMsMsTol());2479 generalFS.add(productMassTolerance);2480 // General, precursor mass search type2481 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_PRECURSOR_SEARCH_TYPE;2482 optionList = new ArrayList<Option>();2483 for (String key : searchTypeL)2484 {2485 optionList.add(new Option(key, searchTypeHT.get(key)));2486 }2487 selected = omssaParameterSet.getPrecursorSearchType();2488 Select<VString> precursorMassSearchTypeSelectBox = new Select<VString>(2489 validStringParam, optionList);2490 precursorMassSearchTypeSelectBox.selectOption( selected);2491 precursorMassSearchTypeSelectBox.setLabel("OMSSAPrecursorMassSearchTypeSelect");2492 generalFS.add(precursorMassSearchTypeSelectBox);2493 // General, product mass search type2494 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_PRODUCT_SEARCH_TYPE;2495 optionList = new ArrayList<Option>();2496 for (String key : searchTypeL)2497 {2498 optionList.add(new Option(key, searchTypeHT.get(key)));2499 }2500 selected = omssaParameterSet.getProductSearchType();2501 Select<VString> productMassSearchTypeSelectBox = new Select<VString>(2502 validStringParam, optionList);2503 productMassSearchTypeSelectBox.selectOption( selected);2504 productMassSearchTypeSelectBox2505 .setLabel("OMSSAProductMassSearchTypeSelect");2506 generalFS.add(productMassSearchTypeSelectBox);2507 // General, lower bound of precursor charge2508 TextField<String> minPrecursorCharge = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MIN_CHARGE);2509 minPrecursorCharge.setValue(omssaParameterSet.getMinCharge());2510 generalFS.add(minPrecursorCharge);2511 // General, upper bound of precursor charge2512 TextField<String> maxPrecursorCharge = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MAX_CHARGE);2513 maxPrecursorCharge.setValue(omssaParameterSet.getMaxCharge());2514 generalFS.add(maxPrecursorCharge);2515 // General, minimum charge to start using multiply charged products2516 TextField<String> minChargeConsiderMult = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_CONSIDER_MULT);2517 minChargeConsiderMult.setValue(omssaParameterSet.getConsiderMult());2518 generalFS.add(minChargeConsiderMult);2519 // General, fraction of product peaks below precursor to determine +12520 // precursor2521 TextField<String> fracProdPeaksPlusOne = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_PLUS_ONE);2522 fracProdPeaksPlusOne.setValue(omssaParameterSet.getPlusOne());2523 generalFS.add(fracProdPeaksPlusOne);2524 // General, peak low intensity cutoff (fraction of most intense)2525 TextField<String> peakLowIntensityCutoff = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_CUTLO);2526 peakLowIntensityCutoff.setValue(omssaParameterSet.getCutLo());2527 generalFS.add(peakLowIntensityCutoff);2528 // General, number of top intensity peaks in first pass2529 TextField<String> numTopIntensityPeaks = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_TOP_HIT_NUM);2530 numTopIntensityPeaks.setValue(omssaParameterSet.getTopHitNum());2531 generalFS.add(numTopIntensityPeaks);2532 // General, ions to search 12533 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_IONS_TO_SEARCH_1;2534 optionList = new ArrayList<Option>();2535 for (String key : ionTypeL)2536 {2537 optionList.add(new Option(key, ionTypeHT.get(key)));2538 }2539 selected = omssaParameterSet.getIonsToSearch1();2540 Select<VString> ionsToSearch1SelectBox = new Select<VString>(validStringParam, optionList);2541 ionsToSearch1SelectBox.selectOption( selected);2542 ionsToSearch1SelectBox.setLabel("OMSSAIonsToSearch1Select");2543 generalFS.add(ionsToSearch1SelectBox);2544 // General, ions to search 22545 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_IONS_TO_SEARCH_2;2546 optionList = new ArrayList<Option>();2547 for (String key : ionTypeL)2548 {2549 optionList.add(new Option(key, ionTypeHT.get(key)));2550 }2551 selected = omssaParameterSet.getIonsToSearch2();2552 Select<VString> ionsToSearch2SelectBox = new Select<VString>(validStringParam, optionList);2553 ionsToSearch2SelectBox.selectOption( selected);2554 ionsToSearch2SelectBox.setLabel("OMSSAIonsToSearch2Select");2555 generalFS.add(ionsToSearch2SelectBox);2556 /*2557 * Extra field set2558 */2559 Fieldset extraFS = new Fieldset();2560 extraFS.setTitle("OMSSAParameterSetExtra");2561 form.addFieldset(extraFS);2562 // Extra, z dependence2563 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_ZDEP;2564 optionList = new ArrayList<Option>();2565 for (String key : zDependenceL)2566 {2567 optionList.add(new Option(key, zDependenceHT.get(key)));2568 }2569 selected = omssaParameterSet.getZDep();2570 Select<VString> zDepSelectBox = new Select<VString>(validStringParam, optionList);2571 zDepSelectBox.selectOption( selected);2572 zDepSelectBox.setLabel("OMSSAZDepSelect");2573 extraFS.add(zDepSelectBox);2574 // Extra, peak high intensity cutoff (fraction of most intense)2575 TextField<String> peakHighIntensityCutoff = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_CUTHI);2576 peakHighIntensityCutoff.setValue(omssaParameterSet.getCutHi());2577 extraFS.add(peakHighIntensityCutoff);2578 // Extra, peak intensity cutoff increment (fraction of most intense)2579 TextField<String> peakIntensityCutInc = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_CUTINC);2580 peakIntensityCutInc.setValue(omssaParameterSet.getCutInc());2581 extraFS.add(peakIntensityCutInc);2582 // Extra, single win2583 TextField<String> singleWin = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SINGLE_WIN);2584 singleWin.setValue(omssaParameterSet.getSingleWin());2585 extraFS.add(singleWin);2586 // Extra, double win2587 TextField<String> doubleWin = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_DOUBLE_WIN);2588 doubleWin.setValue(omssaParameterSet.getDoubleWin());2589 extraFS.add(doubleWin);2590 // Extra, single num2591 TextField<String> singleNum = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SINGLE_NUM);2592 singleNum.setValue(omssaParameterSet.getSingleNum());2593 extraFS.add(singleNum);2594 // Extra, double num2595 TextField<String> doubleNum = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_DOUBLE_NUM);2596 doubleNum.setValue(omssaParameterSet.getDoubleNum());2597 extraFS.add(doubleNum);2598 // Extra, min hit2599 TextField<String> minHit = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MIN_HIT);2600 minHit.setValue(omssaParameterSet.getMinHit());2601 extraFS.add(minHit);2602 // Extra, min spectra2603 TextField<String> minSpectra = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MIN_SPECTRA);2604 minSpectra.setValue(omssaParameterSet.getMinSpectra());2605 extraFS.add(minSpectra);2606 // Extra, scale2607 TextField<String> scale = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SCALE);2608 scale.setValue(omssaParameterSet.getScale());2609 extraFS.add(scale);2610 // Extra, ms calc plus one2611 TextField<String> msCalcPlusOne = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MS_CALC_PLUS_ONE);2612 msCalcPlusOne.setValue(omssaParameterSet.getMsCalcPlusOne());2613 extraFS.add(msCalcPlusOne);2614 // Extra, ms calc charge2615 TextField<String> msCalcCharge = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MS_CALC_CHARGE);2616 msCalcCharge.setValue(omssaParameterSet.getMsCalcCharge());2617 extraFS.add(msCalcCharge);2618 // Extra, max product charge2619 TextField<String> maxProductCharge = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MAX_PRODUCT_CHARGE);2620 maxProductCharge.setValue(omssaParameterSet.getMaxProductCharge());2621 extraFS.add(maxProductCharge);2622 // Extra, pseudo count2623 TextField<String> pseudoCount = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_PSEUDO_COUNT);2624 pseudoCount.setValue(omssaParameterSet.getPseudoCount());2625 extraFS.add(pseudoCount);2626 // Extra, search b12627 TextField<String> searchB1 = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SEARCH_B1);2628 searchB1.setValue(omssaParameterSet.getSearchB1());2629 extraFS.add(searchB1);2630 // Extra, search C terminus product2631 TextField<String> searchCTermProduct = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SEARCH_C_TERM_PRODUCT);2632 searchCTermProduct.setValue(omssaParameterSet.getSearchCTermProduct());2633 extraFS.add(searchCTermProduct);2634 // Extra, max productions2635 TextField<String> maxProductions = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MAX_PRODUCTIONS);2636 maxProductions.setValue(omssaParameterSet.getMaxProductions());2637 extraFS.add(maxProductions);2638 // Extra, min no enzyme2639 TextField<String> minNoEnzyme = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MIN_NO_ENZYME);2640 minNoEnzyme.setValue(omssaParameterSet.getMinNoEnzyme());2641 extraFS.add(minNoEnzyme);2642 // Extra, max no enzyme2643 TextField<String> maxNoEnzyme = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_MAX_NO_ENZYME);2644 maxNoEnzyme.setValue(omssaParameterSet.getMaxNoEnzyme());2645 extraFS.add(maxNoEnzyme);2646 // Extra, exact mass2647 TextField<String> exactMass = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_EXACT_MASS);2648 exactMass.setValue(omssaParameterSet.getExactMass());2649 extraFS.add(exactMass);2650 // Extra, setting id2651 TextField<String> settingId = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SETTING_ID);2652 settingId.setValue(omssaParameterSet.getSettingId());2653 extraFS.add(settingId);2654 // Extra, research threshold2655 TextField<String> researchThreshold = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_RESEARCH_THRESH);2656 researchThreshold.setValue(omssaParameterSet.getResearchThresh());2657 extraFS.add(researchThreshold);2658 // Extra, subset threshold2659 TextField<String> subsetThreshold = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_SUBSET_THRESH);2660 subsetThreshold.setValue(omssaParameterSet.getSubsetThresh());2661 extraFS.add(subsetThreshold);2662 // Extra, replace threshold2663 TextField<String> replaceThreshold = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_REPLACE_THRESH);2664 replaceThreshold.setValue(omssaParameterSet.getReplaceThresh());2665 extraFS.add(replaceThreshold);2666 // Extra, precursor cull2667 TextField<String> precursorCull = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_PRECURSOR_CULL);2668 precursorCull.setValue(omssaParameterSet.getPrecursorCull());2669 extraFS.add(precursorCull);2670 // Extra, no correlation score2671 TextField<String> noCorrelationScore = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_NO_CORRELATION_SCORE);2672 noCorrelationScore.setValue(omssaParameterSet.getNoCorrelationScore());2673 extraFS.add(noCorrelationScore);2674 // Extra, prob following ion2675 TextField<String> probFollowingIon = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_PROB_FOLLOWING_ION);2676 probFollowingIon.setValue(omssaParameterSet.getProbFollowingIon());2677 extraFS.add(probFollowingIon);2678 // Extra, nMethionine2679 validStringParam = SaveOMSSAParameterSetStorage.VOMSSA_NMETHIONINE_ATTRIBUTE;2680 optionList = new ArrayList<Option>();2681 optionList.add(new Option("true", "true"));2682 optionList.add(new Option("false", "false"));2683 selected = omssaParameterSet.getNMethionineAttribute();2684 Select<VString> nMethionineSelectBox = new Select<VString>(validStringParam, optionList);2685 nMethionineSelectBox.selectOption( selected);2686 nMethionineSelectBox.setLabel("OMSSANMethionineSelect");2687 extraFS.add(nMethionineSelectBox);2688 // Extra, auto mass adjust2689 TextField<String> autoMassAdjust = new TextField<String>(SaveOMSSAParameterSetStorage.VOMSSA_AUTO_MASS_ADJUST);2690 autoMassAdjust.setValue(omssaParameterSet.getAutoMassAdjust());2691 extraFS.add(autoMassAdjust);2692 //2693 return form;2694 }2695 2290 2696 2291
Note: See TracChangeset
for help on using the changeset viewer.