Changeset 20768
- Timestamp:
- 02/03/10 16:25:19 (2 years ago)
- Location:
- trunk/modmine/webapp/src/org/modmine/web
- Files:
-
- 3 edited
-
DisplayExperiment.java (modified) (1 diff)
-
FeaturesAction.java (modified) (5 diffs)
-
MetadataCache.java (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modmine/webapp/src/org/modmine/web/DisplayExperiment.java
r20462 r20768 133 133 134 134 /** 135 * @return the submissions Ids 136 */ 137 public List<String> getSubmissionsDccId() { 138 List<String> subDccIds = new ArrayList<String>(); 139 for (Submission sub : submissions) { 140 subDccIds.add(sub.getdCCid().toString()); 141 } 142 return subDccIds; 143 } 144 145 /** 135 146 * @return submissions and a map of feature type to count 136 147 */ -
trunk/modmine/webapp/src/org/modmine/web/FeaturesAction.java
r20741 r20768 11 11 */ 12 12 13 import java.util.ArrayList; 14 import java.util.HashSet; 13 15 import java.util.List; 14 16 import java.util.Map; 17 import java.util.Set; 15 18 16 19 import javax.servlet.http.HttpServletRequest; … … 89 92 DisplayExperiment exp = MetadataCache.getExperimentByName(os, experimentName); 90 93 91 q.addView(featureType + ".primaryIdentifier"); 92 q.addView(featureType + ".score"); 93 q.addView(featureType + ".chromosome.primaryIdentifier"); 94 q.addView(featureType + ".chromosomeLocation.start"); 95 q.addView(featureType + ".chromosomeLocation.end"); 96 q.addView(featureType + ".chromosomeLocation.strand"); 97 q.addView(featureType + ".submissions:experimentalFactors.type"); 98 q.addView(featureType + ".submissions:experimentalFactors.name"); 99 q.addConstraint(featureType + ".submissions.experiment.name", 100 Constraints.eq(experimentName)); 101 q.addOrderBy(featureType + ".chromosome.primaryIdentifier"); 102 q.addOrderBy(featureType + ".chromosomeLocation.start"); 103 104 String ef = getFactors(exp); 105 String description = "All " + featureType + " features generated by experiment '" 106 + exp.getName() + "' in " + StringUtil.prettyList(exp.getOrganisms()) 107 + " (" + exp.getPi() + ")." + ef; 108 q.setDescription(description); 94 List<String> expSubsIds = exp.getSubmissionsDccId(); 95 List<String> notLocated = new ArrayList<String>(); 96 97 LOG.info("HERE THEY ARE: EXP " + expSubsIds + "<-"); 98 99 for (String subId : expSubsIds){ 100 101 Integer id = Integer.valueOf(subId); 102 LOG.info("HERE THEY ARE: FOR " + subId + "<->" + id +"|"); 103 104 if (MetadataCache.getUnlocatedFeatureTypes(os).containsKey(new Integer(subId))){ 105 // if (MetadataCache.getUnlocatedFeatureTypes(os).get(subId) != null) 106 LOG.info("HERE THEY ARE: LIST " + subId + "<-" ); 107 108 notLocated.addAll(MetadataCache.getUnlocatedFeatureTypes(os).get(new Integer(subId))); 109 } 110 } 111 112 Set allUnlocated = 113 new HashSet(notLocated); 114 115 LOG.info("HERE THEY ARE: UNL " + allUnlocated.toString()+ "<-"); 116 117 118 // Set<String> subWithNotLocatedFeats = MetadataCache.getUnlocatedFeatureTypes(os).keySet(); 119 // 120 // Set allExpSubs = 121 // new HashSet(expSubsIds); 122 // 123 // Set<String> intersection = new HashSet<String>(allExpSubs); 124 // intersection.retainAll(subWithNotLocatedFeats); 125 // 126 // if (!intersection.isEmpty()){ 127 // Set unLocatedFTypes = MetadataCache.getUnlocatedFeatureTypes(os).entrySet() 128 // } 129 130 131 if (allUnlocated.contains(featureType)){ 132 q.addView(featureType + ".primaryIdentifier"); 133 q.addView(featureType + ".score"); 134 q.addView(featureType + ".submissions:experimentalFactors.type"); 135 q.addView(featureType + ".submissions:experimentalFactors.name"); 136 q.addConstraint(featureType + ".submissions.experiment.name", 137 Constraints.eq(experimentName)); 138 139 String ef = getFactors(exp); 140 String description = "All " + featureType + " features generated by experiment '" 141 + exp.getName() + "' in " + StringUtil.prettyList(exp.getOrganisms()) 142 + " (" + exp.getPi() + ")." + ef; 143 q.setDescription(description); 144 145 } else { 146 q.addView(featureType + ".primaryIdentifier"); 147 q.addView(featureType + ".score"); 148 q.addView(featureType + ".chromosome.primaryIdentifier"); 149 q.addView(featureType + ".chromosomeLocation.start"); 150 q.addView(featureType + ".chromosomeLocation.end"); 151 q.addView(featureType + ".chromosomeLocation.strand"); 152 q.addView(featureType + ".submissions:experimentalFactors.type"); 153 q.addView(featureType + ".submissions:experimentalFactors.name"); 154 q.addConstraint(featureType + ".submissions.experiment.name", 155 Constraints.eq(experimentName)); 156 q.addOrderBy(featureType + ".chromosome.primaryIdentifier"); 157 q.addOrderBy(featureType + ".chromosomeLocation.start"); 158 159 String ef = getFactors(exp); 160 String description = "All " + featureType + " features generated by experiment '" 161 + exp.getName() + "' in " + StringUtil.prettyList(exp.getOrganisms()) 162 + " (" + exp.getPi() + ")." + ef; 163 q.setDescription(description); 164 165 } 166 167 168 169 // q.addView(featureType + ".primaryIdentifier"); 170 // q.addView(featureType + ".score"); 171 // q.addView(featureType + ".chromosome.primaryIdentifier"); 172 // q.addView(featureType + ".chromosomeLocation.start"); 173 // q.addView(featureType + ".chromosomeLocation.end"); 174 // q.addView(featureType + ".chromosomeLocation.strand"); 175 // q.addView(featureType + ".submissions:experimentalFactors.type"); 176 // q.addView(featureType + ".submissions:experimentalFactors.name"); 177 // q.addConstraint(featureType + ".submissions.experiment.name", 178 // Constraints.eq(experimentName)); 179 // q.addOrderBy(featureType + ".chromosome.primaryIdentifier"); 180 // q.addOrderBy(featureType + ".chromosomeLocation.start"); 181 // 182 // String ef = getFactors(exp); 183 // String description = "All " + featureType + " features generated by experiment '" 184 // + exp.getName() + "' in " + StringUtil.prettyList(exp.getOrganisms()) 185 // + " (" + exp.getPi() + ")." + ef; 186 // q.setDescription(description); 109 187 110 188 } else if (type.equals("submission")) { … … 117 195 // String qq = QQ.get(dccNr); 118 196 119 List<String> locFeatures = MetadataCache.getLocatedFeatureTypes(os).get( dccId);120 121 122 123 124 // LOG.info("HERE THEY ARE: " +QQ + "|" +qq + "<-");197 List<String> locFeatures = MetadataCache.getLocatedFeatureTypes(os).get(new Integer(dccId)); 198 199 // Map <Integer, String> QQ = MetadataCache.getLocatedFeatureTypes(os); 200 // String locFeature = MetadataCache.getLocatedFeatureTypes(os).get(ddccId); 201 202 // LOG.info("HERE THEY ARE: " +QQ + "|" +qq + "<-"); 125 203 126 204 LOG.info("HERE THEY ARE: " + dccId + "|" +locFeatures + "<-"); … … 156 234 q.setDescription(description); 157 235 158 // q.addView(featureType + ".primaryIdentifier");159 // q.addView(featureType + ".score");160 // q.addView(featureType + ".submissions:experimentalFactors.type");161 // q.addView(featureType + ".submissions:experimentalFactors.name");162 // q.addConstraint(featureType + ".submissions.DCCid", Constraints.eq(new Integer(dccId)));163 //164 // String experimentType = "";165 // if (sub.getExperimentType() != null) {166 // experimentType = StringUtil.indefiniteArticle(sub.getExperimentType())167 // + " " + sub.getExperimentType() + " experiment in";168 // }169 //170 // String efSub = "";171 // if (SubmissionHelper.getExperimentalFactorString(sub).length() > 1){172 // efSub = " using " + SubmissionHelper.getExperimentalFactorString(sub);173 // }174 //175 // String description = "All " + featureType + " features generated by submission " + dccId176 // + ", " + experimentType + " "177 // + sub.getOrganism().getShortName() + efSub178 // + " (" + sub.getProject().getSurnamePI() + ").";179 // q.setDescription(description);180 181 236 } else { 182 237 183 184 238 q.addView(featureType + ".primaryIdentifier"); 185 239 q.addView(featureType + ".score"); … … 204 258 + " (" + sub.getProject().getSurnamePI() + ")."; 205 259 q.setDescription(description); 206 207 //208 //209 //210 // q.addView(featureType + ".primaryIdentifier");211 // q.addView(featureType + ".score");212 // q.addView(featureType + ".chromosome.primaryIdentifier");213 // q.addView(featureType + ".chromosomeLocation.start");214 // q.addView(featureType + ".chromosomeLocation.end");215 // q.addView(featureType + ".chromosomeLocation.strand");216 // q.addView(featureType + ".submissions:experimentalFactors.type");217 // q.addView(featureType + ".submissions:experimentalFactors.name");218 // q.addConstraint(featureType + ".submissions.DCCid", Constraints.eq(new Integer(dccId)));219 // q.addOrderBy(featureType + ".chromosome.primaryIdentifier");220 // q.addOrderBy(featureType + ".chromosomeLocation.start");221 //222 // String experimentType = "";223 // if (sub.getExperimentType() != null) {224 // experimentType = StringUtil.indefiniteArticle(sub.getExperimentType())225 // + " " + sub.getExperimentType() + " experiment in";226 // }227 //228 // String efSub = "";229 // if (SubmissionHelper.getExperimentalFactorString(sub).length() > 1){230 // efSub = " using " + SubmissionHelper.getExperimentalFactorString(sub);231 // }232 //233 // String description = "All " + featureType + " features generated by submission " + dccId234 // + ", " + experimentType + " "235 // + sub.getOrganism().getShortName() + efSub236 // + " (" + sub.getProject().getSurnamePI() + ").";237 // q.setDescription(description);238 239 260 } 240 261 -
trunk/modmine/webapp/src/org/modmine/web/MetadataCache.java
r20741 r20768 16 16 import java.util.ArrayList; 17 17 import java.util.HashMap; 18 import java.util.HashSet; 18 19 import java.util.Iterator; 19 20 import java.util.LinkedHashMap; 20 21 import java.util.List; 21 22 import java.util.Map; 23 import java.util.Set; 22 24 import java.util.TreeMap; 23 25 … … 95 97 private static Map<Integer, List<String>> submissionFilesCache = null; 96 98 private static Map<Integer, Integer> filesPerSubmissionCache = null; 97 98 // private static Map<Integer, String> submissionLocatedFeatureTypes = null; 99 private static Map<String, List<String>> submissionLocatedFeatureTypes = null; 99 private static Map<Integer, List<String>> submissionLocatedFeatureTypes = null; 100 private static Map<Integer, List<String>> submissionUnlocatedFeatureTypes = null; 100 101 101 102 private static long lastTrackCacheRefresh = 0; … … 134 135 * @return map 135 136 */ 137 public static synchronized Map<Integer, List<String>> getUnlocatedFeatureTypes(ObjectStore os) { 138 if (submissionUnlocatedFeatureTypes == null) { 139 LOG.info("BEFORE readUNL "); 140 141 readUnlocatedFeatureTypes(os); 142 LOG.info("AFTER readUNL "); 143 } 144 return submissionUnlocatedFeatureTypes; 145 } 146 147 /** 148 * Fetch input/output file names per submission. 149 * @param os the production objectstore 150 * @return map 151 */ 136 152 public static synchronized Map<Integer, List<String>> getSubmissionFiles(ObjectStore os) { 137 153 if (submissionFilesCache == null) { … … 162 178 163 179 /** 164 * Fetch input/output file names per submission. 180 * Fetch which featureType are located for each sub 181 * TODO: the opposite (not located feature types) 165 182 * @param os the production objectstore 166 183 * @return map 167 184 */ 168 // public static synchronized Map<Integer, String> getLocatedFeatureTypes(ObjectStore os) { 169 public static synchronized Map<String, List<String>> getLocatedFeatureTypes(ObjectStore os) { 185 public static synchronized Map<Integer, List<String>> getLocatedFeatureTypes(ObjectStore os) { 170 186 if (submissionLocatedFeatureTypes == null) { 187 LOG.info("BEFORE readSubmissionLocatedFeature "); 171 188 readSubmissionLocatedFeature(os); 189 LOG.info("AFTER readSubmissionLocatedFeature "); 190 172 191 } 173 192 return submissionLocatedFeatureTypes; … … 399 418 q.addToOrderBy(qcName); 400 419 401 402 420 Results results = os.execute(q); 403 421 … … 550 568 private static void readSubmissionLocatedFeature(ObjectStore os) { 551 569 long startTime = System.currentTimeMillis(); 552 553 // submissionLocatedFeatureTypes = new LinkedHashMap<Integer, String>(); 554 submissionLocatedFeatureTypes = new LinkedHashMap<String, List<String>>(); 570 submissionLocatedFeatureTypes = new LinkedHashMap<Integer, List<String>>(); 555 571 556 572 Query q = new Query(); … … 590 606 Class feat = (Class) row.get(1); 591 607 592 addToMap(submissionLocatedFeatureTypes,sub.getdCCid().toString(), 593 feat.getName().replace("org.intermine.model.bio.", "")); 608 // addToMap(submissionLocatedFeatureTypes,sub.getdCCid(), 609 // feat.getName().replace("org.intermine.model.bio.", "")); 610 611 addToMap(submissionLocatedFeatureTypes,sub.getdCCid(), 612 TypeUtil.unqualifiedName(feat.getName())); 613 594 614 595 615 // submissionLocatedFeatureTypes.put(sub.getdCCid().toString(), … … 606 626 607 627 /** 628 * Method to obtain the map of unlocated feature types by submission id 629 * 630 * @param os the objectStore 631 * @return submissionUnlocatedFeatureTypes 632 */ 633 private static Map<Integer, List<String>> readUnlocatedFeatureTypes(ObjectStore os) { 634 try { 635 636 if (submissionUnlocatedFeatureTypes != null) { 637 return submissionUnlocatedFeatureTypes; 638 } 639 640 submissionUnlocatedFeatureTypes = new HashMap<Integer, List<String>>(); 641 642 643 if (submissionLocatedFeatureTypes == null) { 644 readSubmissionLocatedFeature(os); 645 } 646 647 if (submissionFeatureCounts == null) { 648 readSubmissionFeatureCounts(os); 649 } 650 651 LOG.info("INTO readUNL " + submissionFeatureCounts.keySet()); 652 653 654 for (Integer subId : submissionFeatureCounts.keySet()) { 655 656 Set<String> allFeatures = submissionFeatureCounts.get(subId).keySet(); 657 LOG.info("INTO readUNL SFC keys:" + submissionFeatureCounts.keySet()); 658 659 660 LOG.info("INTO readUNL difference 1 " + subId); 661 Set<String> difference = new HashSet<String>(allFeatures); 662 LOG.info("INTO readUNL difference 2 " + difference); 663 664 LOG.info("INTO readUNL difference ARG " + submissionLocatedFeatureTypes.get(subId)); 665 666 difference.removeAll(submissionLocatedFeatureTypes.get(subId)); 667 668 LOG.info("INTO readUNL difference 3 " + subId); 669 LOG.info("INTO readUNL difference-> " + difference); 670 671 if (!difference.isEmpty()){ 672 List <String> thisUnlocated = new ArrayList<String>(); 673 674 for (String fType : difference){ 675 LOG.info("INTO readUNL ftype: " + subId + "|" + fType); 676 677 thisUnlocated.add(fType); 678 } 679 submissionUnlocatedFeatureTypes.put(subId, thisUnlocated); 680 } 681 } 682 } catch (Exception err) { 683 err.printStackTrace(); 684 } 685 return submissionUnlocatedFeatureTypes; 686 } 687 688 689 /** 608 690 * adds an element to a list which is the value of a map 609 691 * @param m the map (<String, List<String>>) … … 611 693 * @param value the list 612 694 */ 613 private static void addToMap(Map< String, List<String>> m, Stringkey, String value) {695 private static void addToMap(Map<Integer, List<String>> m, Integer key, String value) { 614 696 615 697 List<String> ids = new ArrayList<String>(); … … 624 706 } 625 707 626 627 628 629 708 /** 630 709 * Method to fill the cached map of submissions (ddcId) to list of … … 646 725 + submissionTracksCache.size()); 647 726 } 648 649 727 650 728 /**
Note: See TracChangeset
for help on using the changeset viewer.
