Changeset 22806


Ignore:
Timestamp:
08/09/10 17:43:30 (17 months ago)
Author:
rns
Message:

Compile and checkstyle fixes.

Location:
branches/mnw21/pathquery_refactor
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/mnw21/pathquery_refactor/bio/postprocess/main/src/org/intermine/bio/postprocess/TransferSequences.java

    r22799 r22806  
    1717 
    1818import org.apache.log4j.Logger; 
    19 import org.biojava.bio.seq.DNATools; 
    2019import org.biojava.bio.symbol.IllegalAlphabetException; 
    2120import org.biojava.bio.symbol.IllegalSymbolException; 
    22 import org.biojava.bio.symbol.SymbolList; 
    2321import org.intermine.bio.util.ClobAccessReverseComplement; 
    2422import org.intermine.bio.util.Constants; 
     
    309307        } 
    310308 
    311         if (locationOnChr.getStrand().equals("-1")) { 
     309        if ("-1".equals(locationOnChr.getStrand())) { 
    312310            subSeqString = new ClobAccessReverseComplement(subSeqString); 
    313311        } 
     
    397395            Transcript transcript =  (Transcript) rr.get(0); 
    398396 
    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" 
    407405                                + " (avg = " + ((60000L * i) / (now - start)) + " per minute)"); 
    408406                    } 
     
    415413            Location  location = (Location) rr.get(3); 
    416414 
    417             if (location.getStrand() != null && location.getStrand().equals("-1")) { 
     415            if (location.getStrand() != null && "-1".equals(location.getStrand())) { 
    418416                currentTranscriptBases.insert(0, exonSequence.getResidues()); 
    419417            } else { 
  • branches/mnw21/pathquery_refactor/intermine/api/test/src/org/intermine/api/template/TemplatePopulatorTest.java

    r21131 r22806  
    7171        PathConstraint age = new PathConstraintAttribute("Employee.age", ConstraintOp.EQUALS, "30"); 
    7272        TemplateValue value = new TemplateValue(age, ConstraintOp.EQUALS, "21",  
    73                 TemplateValue.ValueType.SIMPLE_VALUE); 
     73                TemplateValue.ValueType.SIMPLE_VALUE, SwitchOffAbility.LOCKED); 
    7474        values.put("Employee.age", Arrays.asList(new TemplateValue[] {value})); 
    7575        try { 
     
    8383        PathConstraint nameCon = simple.getEditableConstraints("Employee.name").get(0); 
    8484        TemplateValue value1 = new TemplateValue(nameCon, ConstraintOp.EQUALS, "name",  
    85                 TemplateValue.ValueType.SIMPLE_VALUE); 
     85                TemplateValue.ValueType.SIMPLE_VALUE, SwitchOffAbility.LOCKED); 
    8686        TemplateValue value2 = new TemplateValue(nameCon, ConstraintOp.EQUALS, "other name",  
    87                 TemplateValue.ValueType.SIMPLE_VALUE); 
     87                TemplateValue.ValueType.SIMPLE_VALUE, SwitchOffAbility.LOCKED); 
    8888        values.put("Employee.name", Arrays.asList(new TemplateValue[] {value1, value2})); 
    8989        try { 
     
    9797        PathConstraint ageCon = twoConstraints.getEditableConstraints("Employee.age").get(0); 
    9898        TemplateValue value = new TemplateValue(ageCon, ConstraintOp.EQUALS, "21", 
    99                 TemplateValue.ValueType.SIMPLE_VALUE); 
     99                TemplateValue.ValueType.SIMPLE_VALUE, SwitchOffAbility.LOCKED); 
    100100        values.put("Employee.age", Arrays.asList(new TemplateValue[] {value})); 
    101101        try { 
     
    109109        PathConstraint nameCon = simple.getEditableConstraints("Employee.name").get(0); 
    110110        TemplateValue value = new TemplateValue(nameCon, ConstraintOp.NOT_EQUALS, 
    111                 "Kevin Bacon", TemplateValue.ValueType.SIMPLE_VALUE); 
     111                "Kevin Bacon", TemplateValue.ValueType.SIMPLE_VALUE, SwitchOffAbility.LOCKED); 
    112112        values.put("Employee.name", Arrays.asList(new TemplateValue[] {value})); 
    113113        TemplateQuery res = TemplatePopulator.getPopulatedTemplate(simple, values); 
     
    121121        PathConstraint nameCon = simple.getEditableConstraints("Employee.name").get(0); 
    122122        TemplateValue value = new TemplateValue(nameCon, ConstraintOp.IN, "bag1", 
    123                 TemplateValue.ValueType.BAG_VALUE); 
     123                TemplateValue.ValueType.BAG_VALUE, SwitchOffAbility.LOCKED); 
    124124        values.put("Employee.name", Arrays.asList(new TemplateValue[] {value})); 
    125125        TemplateQuery res = TemplatePopulator.getPopulatedTemplate(simple, values); 
     
    209209        PathConstraint nameCon = simple.getEditableConstraints("Employee.name").get(0); 
    210210        TemplateValue value = new TemplateValue(nameCon, ConstraintOp.GREATER_THAN, "bag1", 
    211                 TemplateValue.ValueType.BAG_VALUE); 
     211                TemplateValue.ValueType.BAG_VALUE, SwitchOffAbility.LOCKED); 
    212212        values.put("Employee.name", Arrays.asList(new TemplateValue[] {value})); 
    213213        try { 
  • branches/mnw21/pathquery_refactor/modmine/webapp/src/org/modmine/web/FeaturesAction.java

    r22799 r22806  
    2222import javax.servlet.http.HttpSession; 
    2323 
    24 import org.apache.log4j.Logger; 
    2524import org.apache.struts.action.ActionForm; 
    2625import org.apache.struts.action.ActionForward; 
     
    3736import org.intermine.objectstore.ObjectStore; 
    3837import org.intermine.pathquery.Constraints; 
    39 import org.intermine.pathquery.PathNode; 
    40 import org.intermine.pathquery.OldPathQuery; 
     38import org.intermine.pathquery.OrderDirection; 
     39import org.intermine.pathquery.PathQuery; 
    4140import org.intermine.util.StringUtil; 
    4241import org.intermine.web.logic.bag.BagHelper; 
     
    9695        Set<Integer> taxIds = new HashSet<Integer>(); 
    9796 
    98         OldPathQuery q = new OldPathQuery(model); 
     97        PathQuery q = new PathQuery(model); 
    9998 
    10099        boolean hasPrimer = false; 
    101100 
    102         if (type.equals("experiment")) { 
     101        if ("experiment".equals(type)) { 
    103102            experimentName = (String) request.getParameter("experiment"); 
    104103            DisplayExperiment exp = MetadataCache.getExperimentByName(os, experimentName); 
     
    118117                } 
    119118 
    120                 q.addConstraint(rootChoice + ".submissions.experiment.name", 
    121                         Constraints.eq(experimentName)); 
     119                q.addConstraint(Constraints.eq(rootChoice + ".submissions.experiment.name", 
     120                        experimentName)); 
    122121            } else { 
    123122 
     
    145144                q.addView(featureType + ".primaryIdentifier"); 
    146145                q.addView(featureType + ".score"); 
    147                 if (action.equals("results")) { 
     146                if ("results".equals(action)) { 
    148147                    // we don't want this field on exports 
    149148                    q.addView(featureType + ":scoreProtocol.name"); 
    150149                } 
    151                 q.addConstraint(featureType + ".submissions.experiment.name", 
    152                         Constraints.eq(experimentName)); 
     150                q.addConstraint(Constraints.eq(featureType + ".submissions.experiment.name", 
     151                        experimentName)); 
    153152 
    154153                if (allUnlocated.contains(featureType)) { 
     
    162161        } 
    163162 
    164         else if (type.equals("submission")) { 
     163        else if ("submission".equals(type)) { 
    165164            dccId = (String) request.getParameter("submission"); 
    166165            Submission sub = MetadataCache.getSubmissionByDccId(os, new Integer(dccId)); 
     
    181180                } 
    182181 
    183                 q.addConstraint(rootChoice + ".submissions.DCCid", 
    184                         Constraints.eq(new Integer(dccId))); 
     182                q.addConstraint(Constraints.eq(rootChoice + ".submissions.DCCid", dccId)); 
    185183            } else { 
    186184 
     
    210208                q.addView(featureType + ".primaryIdentifier"); 
    211209                q.addView(featureType + ".score"); 
    212                 if (action.equals("results")) { 
     210                if ("results".equals(action)) { 
    213211                    q.addView(featureType + ":scoreProtocol.name"); 
    214212                } 
    215                 q.addConstraint(featureType + ".submissions.DCCid", 
    216                         Constraints.eq(new Integer(dccId))); 
     213                q.addConstraint(Constraints.eq(featureType + ".submissions.DCCid", dccId)); 
    217214 
    218215                if (unlocFeatures == null || !unlocFeatures.contains(featureType)) { 
     
    229226 
    230227        // For the expression levels 
    231         else if (type.equals("subEL")) { 
     228        else if ("subEL".equals(type)) { 
    232229            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 
    235232            String path = "Submission.features.expressionLevels"; 
    236  
    237233            q.addView(path + ".name"); 
    238234            q.addView(path + ".value"); 
     
    243239            q.addView(path + ".predictionStatus"); 
    244240 
    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)) { 
    249244            String eName = (String) request.getParameter("experiment"); 
    250245 
    251             PathNode node = q.addNode("Experiment.submissions.features"); 
    252             node.setType(featureType); 
     246            q.addConstraint(Constraints.type("Experiment.submissions.features", featureType)); 
     247 
    253248            String path = "Experiment.submissions.features.expressionLevels"; 
    254  
    255249            q.addView(path + ".name"); 
    256250            q.addView(path + ".value"); 
     
    261255            q.addView(path + ".predictionStatus"); 
    262256 
    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)) { 
    268261            String qid = SessionMethods.startQueryWithTimeout(request, false, q); 
    269262            Thread.sleep(200); 
     
    272265                .addParameter("qid", qid) 
    273266                .forward(); 
    274         } else if (action.equals("export")) { 
     267        } else if ("export".equals(action)) { 
    275268            String format = request.getParameter("format"); 
    276269 
     
    293286 
    294287            TableExportForm exportForm = null; 
    295             if (format.equals("gff3")) { 
     288            if ("gff3".equals(format)) { 
    296289                exportForm = new GFF3ExportForm(); 
    297290                exportForm.setDoGzip(doGzip); 
     
    305298            return null; 
    306299 
    307         } else if (action.equals("list")) { 
     300        } else if ("list".equals(action)) { 
    308301            // need to select just id of featureType to create list 
    309             q.setView(featureType + ".id"); 
     302            q.addView(featureType + ".id"); 
    310303 
    311304            Profile profile = SessionMethods.getProfile(session); 
     
    382375     * @param hasPrimer 
    383376     */ 
    384     private void addEFactorToQuery(OldPathQuery q, String featureType, 
     377    private void addEFactorToQuery(PathQuery q, String featureType, 
    385378            boolean hasPrimer) { 
    386379        if (!hasPrimer) { 
     
    395388     * @param featureType the feature type 
    396389     */ 
    397     private void addLocationToQuery(OldPathQuery q, String featureType) { 
     390    private void addLocationToQuery(PathQuery q, String featureType) { 
    398391        q.addView(featureType + ".chromosome.primaryIdentifier"); 
    399392        q.addView(featureType + ".chromosomeLocation.start"); 
     
    402395        q.addView(featureType + ".submissions.DCCid"); 
    403396 
    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); 
    406399    } 
    407400 
     
    431424        return taxIds; 
    432425    } 
    433  
    434  
    435  
    436426} 
    437427 
  • branches/mnw21/pathquery_refactor/modmine/webapp/src/org/modmine/web/logic/ModMineUtil.java

    r22684 r22806  
    3232 * @author Fengyuan Hu 
    3333 */ 
    34 public class ModMineUtil 
     34public final class ModMineUtil 
    3535{ 
     36    private ModMineUtil() { 
     37    } 
     38 
    3639    /** 
    3740     * For a bag of Submission objects, returns a set of Submission objects. 
     
    6063 
    6164        Results r = os.execute(q); 
    62         Iterator<ResultsRow> it = r.iterator(); 
     65        @SuppressWarnings("unchecked") Iterator<ResultsRow> it = (Iterator) r.iterator(); 
     66 
    6367        Set<Submission> subs = new LinkedHashSet<Submission>(); 
    6468 
Note: See TracChangeset for help on using the changeset viewer.