Changeset 1128
- Timestamp:
- Jun 15, 2009, 2:43:42 PM (14 years ago)
- Location:
- extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern/GenePattern.java
r1119 r1128 47 47 return ExtensionsControl.getHomeUrl("net.sf.basedb.genepattern.options"); 48 48 } 49 50 /** 51 Get the servlet directory URL for the GenePattern extension. 52 */ 53 public static final String getServletUrl(String servletName) 54 { 55 return ExtensionsControl.getServletUrl("net.sf.basedb.genepattern.options", 56 servletName); 57 } 49 58 50 59 } -
extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern/plugin/GenePatternAnalysisPlugin.java
r1119 r1128 9 9 import org.genepattern.webservice.WebServiceException; 10 10 11 import net.sf.basedb.clients.web.extensions.ExtensionsControl; 11 12 import net.sf.basedb.clients.web.formatter.FormatterFactory; 12 13 import net.sf.basedb.core.AnnotationType; … … 20 21 import net.sf.basedb.core.Experiment; 21 22 import net.sf.basedb.core.File; 23 import net.sf.basedb.core.FileStoreUtil; 22 24 import net.sf.basedb.core.Item; 23 25 import net.sf.basedb.core.ItemQuery; … … 109 111 try 110 112 { 111 String baseUrl = (String)configuration.getValue("baseUrl");112 gw = new FileTransferGateway(baseUrl + "/extensions/gp-integration.jar");113 114 113 // Export files and prepare parameters to GenePattern 115 114 if (progress != null) progress.display(0, "Copying files to GenePattern server"); … … 118 117 GPServer gpServer = GPServer.get(sc, (String)job.getValue("gpServer")); 119 118 119 gw = new FileTransferGateway(gpServer.getBaseUrl() + "/" + GenePattern.getServletUrl("Download")); 120 120 GPClient gp = new GPClient(gpServer); 121 121 ParameterInfo[] info = gp.getParameters(gpModule, null); … … 162 162 try 163 163 { 164 result = gp.waitFor(jobId, 5 000);164 result = gp.waitFor(jobId, 5); 165 165 } 166 166 catch (InterruptedException ex) … … 303 303 storeValue(configuration, request, ri.getParameter("gpModule")); 304 304 storeValue(configuration, request, ri.getParameter("gpServer")); 305 storeValue(configuration, request, ri.getParameter("baseUrl"));306 305 response.setContinue(CONFIGURE_GP_PARAMETERS); 307 306 } … … 319 318 for (PluginParameter<?> pp : ri.getParameters()) 320 319 { 321 storeValue(wrapper, request, pp);320 if (pp.getParameterType() != null) storeValue(wrapper, request, pp); 322 321 } 323 322 response.setDone("Configuration complete"); … … 474 473 new StringParameterType(255, null, true) 475 474 )); 476 parameters.add(new PluginParameter<String>(477 "baseUrl",478 "URL to BASE",479 "Enter the URL to your BASE server as seen from the GenePattern server. " +480 "NOTE! In the future this will be detected automatically",481 new StringParameterType(255, "http://" + Application.getHostName() + ":8080/base2", true)482 ));483 475 484 476 configurePlugin = new RequestInformation( … … 501 493 GPServer gpServer = GPServer.get(sc, 502 494 context == null ? (String)configuration.getValue("gpServer") : (String)job.getValue("gpServer")); 503 495 boolean forJob = context != null; 504 496 try 505 497 { … … 508 500 ParameterInfo[] info = gp.getParameters(gpModule, null); 509 501 List<PluginParameter<?>> parameters = new ArrayList<PluginParameter<?>>(info.length); 510 502 List<PluginParameter<?>> fileParameters = new ArrayList<PluginParameter<?>>(info.length); 503 sc.getCurrentContext(Item.FILE).setId(0); 511 504 for (ParameterInfo pi : info) 512 505 { 513 if (context != null || !pi.isInputFile()) 514 { 515 PluginParameter<?> pp = pi.createPluginParameter("gp."); 516 if (pp != null) parameters.add(pp); 517 } 506 PluginParameter<?> pp = null; 507 if (forJob) 508 { 509 Object defaultValue = configuration.getValue("gp." + pi.getName()); 510 if (pi.isInputFile()) 511 { 512 String fileType = (String)configuration.getValue("filetype." + pi.getName()); 513 DbControl dc = sc.newDbControl(); 514 BioAssaySet bioAssaySet = getCurrentBioAssaySet(dc); 515 defaultValue = FileStoreUtil.getDataFile(dc, bioAssaySet, fileType); 516 dc.close(); 517 } 518 pp = pi.createPluginParameter("gp.", defaultValue); 519 } 520 else 521 { 522 if (pi.isInputFile()) 523 { 524 List<String> options = new ArrayList<String>(); 525 options.add(GenePattern.GCT_FILE); 526 String defaultOption = null; 527 String description = pi.getDescription(); 528 if (defaultOption == null && description.contains(".gct")) 529 { 530 defaultOption = GenePattern.GCT_FILE; 531 } 532 pp = new PluginParameter<String>( 533 "filetype." + pi.getName(), 534 pi.getLabel(), 535 pi.getDescription(), 536 new StringParameterType(255, defaultOption, false, 1, 0, 0, options) 537 ); 538 } 539 else 540 { 541 pp = pi.createPluginParameter("gp.", null); 542 } 543 } 544 if (pp != null) 545 { 546 if (pi.isInputFile()) 547 { 548 fileParameters.add(pp); 549 } 550 else 551 { 552 parameters.add(pp); 553 } 554 } 555 } 556 557 if (fileParameters.size() > 0) 558 { 559 if (parameters.size() > 0) 560 { 561 parameters.add(0, new PluginParameter<String>( 562 "otherSection", 563 "Other parameters", 564 "In this section you can specify default values " + 565 "for all other parameters. The values may be overriden " + 566 "when used for an actual job.", 567 null 568 )); 569 } 570 parameters.addAll(0, fileParameters); 571 parameters.add(0, new PluginParameter<String>( 572 "filesSection", 573 "Input files", 574 "For each input file you can specify a file type " + 575 "which makes it possible for BASE to generate a sensible " + 576 "default value or automatically export a file with the data.", 577 null 578 )); 518 579 } 519 580 520 581 configureGpParameters = new RequestInformation( 521 582 CONFIGURE_GP_PARAMETERS, 522 " Default parameters values",583 "Files and default parameters values", 523 584 "Set default values for the parameters that " + 524 585 "are required by this module/pipeline.", -
extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern/servlet/Test.java
r1118 r1128 60 60 { 61 61 62 public static final String GP_EXT = "http://auster.thep.lu.se:8080/trunk/extensions/gp-integration.jar";62 public static final String DOWNLOAD_SERVLET = "http://auster.thep.lu.se:8080/trunk/extensions/servlet/gp-integration.jar/Download"; 63 63 public static final String GP_HOME = "http://kundera.thep.lu.se:8088"; 64 64 public static final String GP_LOGIN = "nicklas@thep.lu.se"; … … 78 78 final String ID = sc.getId(); 79 79 DbControl dc = sc.newDbControl(); 80 FileTransferGateway gw = new FileTransferGateway( GP_EXT);80 FileTransferGateway gw = new FileTransferGateway(DOWNLOAD_SERVLET); 81 81 try 82 82 { 83 83 /* 84 84 File gctFile = File.getByPath(dc, new Path(GCT_FILE, Path.Type.FILE), false); 85 85 File clsFile = File.getByPath(dc, new Path(CLS_FILE, Path.Type.FILE), false); … … 87 87 Parameter gctParameter = gw.addFile("input.file", new BaseFileProxy(gctFile)); 88 88 Parameter clsParameter = gw.addFile("cls.file", new BaseFileProxy(clsFile)); 89 */ 89 90 dc.close(); 90 91 91 92 GPClient gp = new GPClient(GP_HOME, GP_LOGIN, GP_PWD); 92 //AdminProxy ap = new AdminProxy(GP_HOME, GP_LOGIN, GP_PWD);93 93 94 94 TaskInfo[] tasks = gp.getModules(null); … … 116 116 117 117 118 ParameterInfo[] info = gp.getParameters(" urn:lsid:broad.mit.edu:cancer.software.genepattern.module.analysis:00044:5", null);118 ParameterInfo[] info = gp.getParameters("ImputeMissingValuesKNN", null); 119 119 //PrintWriter out = response.getWriter(); 120 120 out.println("<b>Parameters</b><br>"); … … 136 136 } 137 137 out.flush(); 138 138 /* 139 139 int jobId = gp.runAnalysisNoWait( 140 140 "urn:lsid:broad.mit.edu:cancer.software.genepattern.module.analysis:00044:5", … … 163 163 out.println("<a href=\"" + url + "\" target=\"_new\">" + f + ": " + url + "</a><br>"); 164 164 } 165 */ 165 166 166 167 } -
extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern/wrapper/ParameterInfo.java
r1115 r1128 89 89 public String getDefaultValue() 90 90 { 91 return Values.getStringOrNull(getGPParameterInfo().getDefaultValue()); 91 String d = getGPParameterInfo().getDefaultValue(); 92 if (hasChoices()) 93 { 94 Map<String, String> choices = getChoices(); 95 if (!choices.values().contains(d)) 96 { 97 d = choices.get(d); 98 } 99 } 100 return Values.getStringOrNull(d); 92 101 } 93 102 … … 168 177 */ 169 178 @SuppressWarnings("unchecked") 170 public PluginParameter <?> createPluginParameter(String prefix)179 public PluginParameter createPluginParameter(String prefix, Object defaultValue) 171 180 { 172 181 String type = getType(); 173 ParameterType<?> pt = null; 182 ParameterType<?> pt = null; 174 183 if (isInputFile()) 175 184 { … … 178 187 else if (hasChoices()) 179 188 { 180 pt = new StringParameterType(255, getDefaultValue(), !isOptional(), 181 1, 0, 0, getChoicesAsEnumeration()); 189 pt = new StringParameterType(255, getDefaultValue(), !isOptional(), 1, 0, 0, getChoicesAsEnumeration()); 182 190 } 183 191 else if (type.equals("java.lang.String")) … … 188 196 { 189 197 pt = new IntegerParameterType(null, null, 190 Values.getInteger(getDefaultValue(), null), isOptional());198 Values.getInteger(getDefaultValue(), null), !isOptional()); 191 199 } 192 200 else if (type.equals("java.lang.Float")) … … 206 214 getLabel(), 207 215 getDescription(), 216 defaultValue, 208 217 pt 209 );218 ); 210 219 return parameter; 211 220 }
Note: See TracChangeset
for help on using the changeset viewer.