Changeset 22806
- Timestamp:
- 08/09/10 17:43:30 (17 months ago)
- Location:
- branches/mnw21/pathquery_refactor
- Files:
-
- 4 edited
-
bio/postprocess/main/src/org/intermine/bio/postprocess/TransferSequences.java (modified) (4 diffs)
-
intermine/api/test/src/org/intermine/api/template/TemplatePopulatorTest.java (modified) (6 diffs)
-
modmine/webapp/src/org/modmine/web/FeaturesAction.java (modified) (18 diffs)
-
modmine/webapp/src/org/modmine/web/logic/ModMineUtil.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/mnw21/pathquery_refactor/bio/postprocess/main/src/org/intermine/bio/postprocess/TransferSequences.java
r22799 r22806 17 17 18 18 import org.apache.log4j.Logger; 19 import org.biojava.bio.seq.DNATools;20 19 import org.biojava.bio.symbol.IllegalAlphabetException; 21 20 import org.biojava.bio.symbol.IllegalSymbolException; 22 import org.biojava.bio.symbol.SymbolList;23 21 import org.intermine.bio.util.ClobAccessReverseComplement; 24 22 import org.intermine.bio.util.Constants; … … 309 307 } 310 308 311 if ( locationOnChr.getStrand().equals("-1")) {309 if ("-1".equals(locationOnChr.getStrand())) { 312 310 subSeqString = new ClobAccessReverseComplement(subSeqString); 313 311 } … … 397 395 Transcript transcript = (Transcript) rr.get(0); 398 396 399 if (currentTranscript == null || !transcript.equals(currentTranscript)) {400 if (currentTranscript != null) {401 storeNewSequence(currentTranscript,402 new PendingClob(currentTranscriptBases.toString()));403 i++;404 if (i % 100 == 0) {405 long now = System.currentTimeMillis();406 LOG.info("Set sequences for " + i + " Transcripts"397 if (currentTranscript == null || !transcript.equals(currentTranscript)) { 398 if (currentTranscript != null) { 399 storeNewSequence(currentTranscript, 400 new PendingClob(currentTranscriptBases.toString())); 401 i++; 402 if (i % 100 == 0) { 403 long now = System.currentTimeMillis(); 404 LOG.info("Set sequences for " + i + " Transcripts" 407 405 + " (avg = " + ((60000L * i) / (now - start)) + " per minute)"); 408 406 } … … 415 413 Location location = (Location) rr.get(3); 416 414 417 if (location.getStrand() != null && location.getStrand().equals("-1")) {415 if (location.getStrand() != null && "-1".equals(location.getStrand())) { 418 416 currentTranscriptBases.insert(0, exonSequence.getResidues()); 419 417 } else { -
branches/mnw21/pathquery_refactor/intermine/api/test/src/org/intermine/api/template/TemplatePopulatorTest.java
r21131 r22806 71 71 PathConstraint age = new PathConstraintAttribute("Employee.age", ConstraintOp.EQUALS, "30"); 72 72 TemplateValue value = new TemplateValue(age, ConstraintOp.EQUALS, "21", 73 TemplateValue.ValueType.SIMPLE_VALUE );73 TemplateValue.ValueType.SIMPLE_VALUE, SwitchOffAbility.LOCKED); 74 74 values.put("Employee.age", Arrays.asList(new TemplateValue[] {value})); 75 75 try { … … 83 83 PathConstraint nameCon = simple.getEditableConstraints("Employee.name").get(0); 84 84 TemplateValue value1 = new TemplateValue(nameCon, ConstraintOp.EQUALS, "name", 85 TemplateValue.ValueType.SIMPLE_VALUE );85 TemplateValue.ValueType.SIMPLE_VALUE, SwitchOffAbility.LOCKED); 86 86 TemplateValue value2 = new TemplateValue(nameCon, ConstraintOp.EQUALS, "other name", 87 TemplateValue.ValueType.SIMPLE_VALUE );87 TemplateValue.ValueType.SIMPLE_VALUE, SwitchOffAbility.LOCKED); 88 88 values.put("Employee.name", Arrays.asList(new TemplateValue[] {value1, value2})); 89 89 try { … … 97 97 PathConstraint ageCon = twoConstraints.getEditableConstraints("Employee.age").get(0); 98 98 TemplateValue value = new TemplateValue(ageCon, ConstraintOp.EQUALS, "21", 99 TemplateValue.ValueType.SIMPLE_VALUE );99 TemplateValue.ValueType.SIMPLE_VALUE, SwitchOffAbility.LOCKED); 100 100 values.put("Employee.age", Arrays.asList(new TemplateValue[] {value})); 101 101 try { … … 109 109 PathConstraint nameCon = simple.getEditableConstraints("Employee.name").get(0); 110 110 TemplateValue value = new TemplateValue(nameCon, ConstraintOp.NOT_EQUALS, 111 "Kevin Bacon", TemplateValue.ValueType.SIMPLE_VALUE );111 "Kevin Bacon", TemplateValue.ValueType.SIMPLE_VALUE, SwitchOffAbility.LOCKED); 112 112 values.put("Employee.name", Arrays.asList(new TemplateValue[] {value})); 113 113 TemplateQuery res = TemplatePopulator.getPopulatedTemplate(simple, values); … … 121 121 PathConstraint nameCon = simple.getEditableConstraints("Employee.name").get(0); 122 122 TemplateValue value = new TemplateValue(nameCon, ConstraintOp.IN, "bag1", 123 TemplateValue.ValueType.BAG_VALUE );123 TemplateValue.ValueType.BAG_VALUE, SwitchOffAbility.LOCKED); 124 124 values.put("Employee.name", Arrays.asList(new TemplateValue[] {value})); 125 125 TemplateQuery res = TemplatePopulator.getPopulatedTemplate(simple, values); … … 209 209 PathConstraint nameCon = simple.getEditableConstraints("Employee.name").get(0); 210 210 TemplateValue value = new TemplateValue(nameCon, ConstraintOp.GREATER_THAN, "bag1", 211 TemplateValue.ValueType.BAG_VALUE );211 TemplateValue.ValueType.BAG_VALUE, SwitchOffAbility.LOCKED); 212 212 values.put("Employee.name", Arrays.asList(new TemplateValue[] {value})); 213 213 try { -
branches/mnw21/pathquery_refactor/modmine/webapp/src/org/modmine/web/FeaturesAction.java
r22799 r22806 22 22 import javax.servlet.http.HttpSession; 23 23 24 import org.apache.log4j.Logger;25 24 import org.apache.struts.action.ActionForm; 26 25 import org.apache.struts.action.ActionForward; … … 37 36 import org.intermine.objectstore.ObjectStore; 38 37 import org.intermine.pathquery.Constraints; 39 import org.intermine.pathquery. PathNode;40 import org.intermine.pathquery. OldPathQuery;38 import org.intermine.pathquery.OrderDirection; 39 import org.intermine.pathquery.PathQuery; 41 40 import org.intermine.util.StringUtil; 42 41 import org.intermine.web.logic.bag.BagHelper; … … 96 95 Set<Integer> taxIds = new HashSet<Integer>(); 97 96 98 OldPathQuery q = new OldPathQuery(model);97 PathQuery q = new PathQuery(model); 99 98 100 99 boolean hasPrimer = false; 101 100 102 if ( type.equals("experiment")) {101 if ("experiment".equals(type)) { 103 102 experimentName = (String) request.getParameter("experiment"); 104 103 DisplayExperiment exp = MetadataCache.getExperimentByName(os, experimentName); … … 118 117 } 119 118 120 q.addConstraint( rootChoice + ".submissions.experiment.name",121 Constraints.eq(experimentName));119 q.addConstraint(Constraints.eq(rootChoice + ".submissions.experiment.name", 120 experimentName)); 122 121 } else { 123 122 … … 145 144 q.addView(featureType + ".primaryIdentifier"); 146 145 q.addView(featureType + ".score"); 147 if ( action.equals("results")) {146 if ("results".equals(action)) { 148 147 // we don't want this field on exports 149 148 q.addView(featureType + ":scoreProtocol.name"); 150 149 } 151 q.addConstraint( featureType + ".submissions.experiment.name",152 Constraints.eq(experimentName));150 q.addConstraint(Constraints.eq(featureType + ".submissions.experiment.name", 151 experimentName)); 153 152 154 153 if (allUnlocated.contains(featureType)) { … … 162 161 } 163 162 164 else if ( type.equals("submission")) {163 else if ("submission".equals(type)) { 165 164 dccId = (String) request.getParameter("submission"); 166 165 Submission sub = MetadataCache.getSubmissionByDccId(os, new Integer(dccId)); … … 181 180 } 182 181 183 q.addConstraint(rootChoice + ".submissions.DCCid", 184 Constraints.eq(new Integer(dccId))); 182 q.addConstraint(Constraints.eq(rootChoice + ".submissions.DCCid", dccId)); 185 183 } else { 186 184 … … 210 208 q.addView(featureType + ".primaryIdentifier"); 211 209 q.addView(featureType + ".score"); 212 if ( action.equals("results")) {210 if ("results".equals(action)) { 213 211 q.addView(featureType + ":scoreProtocol.name"); 214 212 } 215 q.addConstraint(featureType + ".submissions.DCCid", 216 Constraints.eq(new Integer(dccId))); 213 q.addConstraint(Constraints.eq(featureType + ".submissions.DCCid", dccId)); 217 214 218 215 if (unlocFeatures == null || !unlocFeatures.contains(featureType)) { … … 229 226 230 227 // For the expression levels 231 else if ( type.equals("subEL")) {228 else if ("subEL".equals(type)) { 232 229 dccId = (String) request.getParameter("submission"); 233 PathNode node = q.addNode("Submission.features");234 node.setType(featureType); 230 q.addConstraint(Constraints.type("Submission.features", featureType)); 231 235 232 String path = "Submission.features.expressionLevels"; 236 237 233 q.addView(path + ".name"); 238 234 q.addView(path + ".value"); … … 243 239 q.addView(path + ".predictionStatus"); 244 240 245 q.addConstraint("Submission.DCCid", 246 Constraints.eq(new Integer(dccId))); 247 } 248 else if (type.equals("expEL")) { 241 q.addConstraint(Constraints.eq("Submission.DCCid", dccId)); 242 } 243 else if ("expEL".equals(type)) { 249 244 String eName = (String) request.getParameter("experiment"); 250 245 251 PathNode node = q.addNode("Experiment.submissions.features");252 node.setType(featureType); 246 q.addConstraint(Constraints.type("Experiment.submissions.features", featureType)); 247 253 248 String path = "Experiment.submissions.features.expressionLevels"; 254 255 249 q.addView(path + ".name"); 256 250 q.addView(path + ".value"); … … 261 255 q.addView(path + ".predictionStatus"); 262 256 263 q.addConstraint("Experiment.name", 264 Constraints.eq(eName)); 265 } 266 267 if (action.equals("results")) { 257 q.addConstraint(Constraints.eq("Experiment.name", eName)); 258 } 259 260 if ("results".equals(action)) { 268 261 String qid = SessionMethods.startQueryWithTimeout(request, false, q); 269 262 Thread.sleep(200); … … 272 265 .addParameter("qid", qid) 273 266 .forward(); 274 } else if ( action.equals("export")) {267 } else if ("export".equals(action)) { 275 268 String format = request.getParameter("format"); 276 269 … … 293 286 294 287 TableExportForm exportForm = null; 295 if ( format.equals("gff3")) {288 if ("gff3".equals(format)) { 296 289 exportForm = new GFF3ExportForm(); 297 290 exportForm.setDoGzip(doGzip); … … 305 298 return null; 306 299 307 } else if ( action.equals("list")) {300 } else if ("list".equals(action)) { 308 301 // need to select just id of featureType to create list 309 q. setView(featureType + ".id");302 q.addView(featureType + ".id"); 310 303 311 304 Profile profile = SessionMethods.getProfile(session); … … 382 375 * @param hasPrimer 383 376 */ 384 private void addEFactorToQuery( OldPathQuery q, String featureType,377 private void addEFactorToQuery(PathQuery q, String featureType, 385 378 boolean hasPrimer) { 386 379 if (!hasPrimer) { … … 395 388 * @param featureType the feature type 396 389 */ 397 private void addLocationToQuery( OldPathQuery q, String featureType) {390 private void addLocationToQuery(PathQuery q, String featureType) { 398 391 q.addView(featureType + ".chromosome.primaryIdentifier"); 399 392 q.addView(featureType + ".chromosomeLocation.start"); … … 402 395 q.addView(featureType + ".submissions.DCCid"); 403 396 404 q.addOrderBy(featureType + ".chromosome.primaryIdentifier" );405 q.addOrderBy(featureType + ".chromosomeLocation.start" );397 q.addOrderBy(featureType + ".chromosome.primaryIdentifier", OrderDirection.ASC); 398 q.addOrderBy(featureType + ".chromosomeLocation.start", OrderDirection.ASC); 406 399 } 407 400 … … 431 424 return taxIds; 432 425 } 433 434 435 436 426 } 437 427 -
branches/mnw21/pathquery_refactor/modmine/webapp/src/org/modmine/web/logic/ModMineUtil.java
r22684 r22806 32 32 * @author Fengyuan Hu 33 33 */ 34 public class ModMineUtil34 public final class ModMineUtil 35 35 { 36 private ModMineUtil() { 37 } 38 36 39 /** 37 40 * For a bag of Submission objects, returns a set of Submission objects. … … 60 63 61 64 Results r = os.execute(q); 62 Iterator<ResultsRow> it = r.iterator(); 65 @SuppressWarnings("unchecked") Iterator<ResultsRow> it = (Iterator) r.iterator(); 66 63 67 Set<Submission> subs = new LinkedHashSet<Submission>(); 64 68
Note: See TracChangeset
for help on using the changeset viewer.
