Changeset 20780


Ignore:
Timestamp:
03/03/10 13:56:16 (2 years ago)
Author:
contrino
Message:

modmine web: temporary fix until primers are taken out of exp. factors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modmine/webapp/src/org/modmine/web/FeaturesAction.java

    r20774 r20780  
    6262     */ 
    6363 
    64 //    private static final Logger LOG = Logger.getLogger(MetadataCache.class); 
     64    //    private static final Logger LOG = Logger.getLogger(MetadataCache.class); 
    6565 
    6666    public ActionForward execute(ActionMapping mapping, 
     
    8282        PathQuery q = new PathQuery(model); 
    8383 
     84        boolean hasPrimer = false; 
     85 
    8486        if (type.equals("experiment")) { 
    8587            experimentName = (String) request.getParameter("experiment"); 
     
    8991            Set<String> allUnlocated = new HashSet<String>(); 
    9092 
    91             for (String subId : expSubsIds){ 
    92                 if (MetadataCache.getUnlocatedFeatureTypes(os).containsKey(new Integer(subId))){ 
    93                     allUnlocated.addAll(MetadataCache.getUnlocatedFeatureTypes(os).get(new Integer(subId))); 
    94                 } 
    95             } 
    96  
    97             if (allUnlocated.contains(featureType)){ 
    98                 q.addView(featureType + ".primaryIdentifier"); 
    99                 q.addView(featureType + ".score"); 
    100                 q.addView(featureType + ".submissions:experimentalFactors.type"); 
    101                 q.addView(featureType + ".submissions:experimentalFactors.name"); 
    102                 q.addConstraint(featureType + ".submissions.experiment.name",  
    103                         Constraints.eq(experimentName)); 
    104  
    105             } else { 
    106                 q.addView(featureType + ".primaryIdentifier"); 
    107                 q.addView(featureType + ".score"); 
    108                 q.addView(featureType + ".chromosome.primaryIdentifier"); 
    109                 q.addView(featureType + ".chromosomeLocation.start"); 
    110                 q.addView(featureType + ".chromosomeLocation.end"); 
    111                 q.addView(featureType + ".chromosomeLocation.strand"); 
    112                 q.addView(featureType + ".submissions:experimentalFactors.type"); 
    113                 q.addView(featureType + ".submissions:experimentalFactors.name"); 
    114                 q.addConstraint(featureType + ".submissions.experiment.name",  
    115                         Constraints.eq(experimentName)); 
    116                 q.addOrderBy(featureType + ".chromosome.primaryIdentifier");  
    117                 q.addOrderBy(featureType + ".chromosomeLocation.start");  
    118  
    119             } 
     93            hasPrimer = false; 
    12094 
    12195            String ef = getFactors(exp);             
     96            if (ef.contains("primer")){ 
     97                hasPrimer = true; 
     98            } 
     99 
     100 
    122101            String description = "All " + featureType + " features generated by experiment '" 
    123102            + exp.getName() + "' in " + StringUtil.prettyList(exp.getOrganisms())  
     
    125104            q.setDescription(description); 
    126105 
     106 
     107            for (String subId : expSubsIds){ 
     108                if (MetadataCache.getUnlocatedFeatureTypes(os).containsKey(new Integer(subId))){ 
     109                    allUnlocated.addAll(MetadataCache.getUnlocatedFeatureTypes(os).get(new Integer(subId))); 
     110                } 
     111            } 
     112 
     113            if (allUnlocated.contains(featureType)){ 
     114                // temporary until we remove primers from factors 
     115                if (hasPrimer){ 
     116                    q.addView(featureType + ".primaryIdentifier"); 
     117                    q.addView(featureType + ".score"); 
     118                    q.addConstraint(featureType + ".submissions.experiment.name",  
     119                            Constraints.eq(experimentName)); 
     120                } else { 
     121                    q.addView(featureType + ".primaryIdentifier"); 
     122                    q.addView(featureType + ".score"); 
     123                    q.addView(featureType + ".submissions:experimentalFactors.type"); 
     124                    q.addView(featureType + ".submissions:experimentalFactors.name"); 
     125                    q.addConstraint(featureType + ".submissions.experiment.name",  
     126                            Constraints.eq(experimentName));                     
     127                } 
     128            } else { 
     129 
     130                if (hasPrimer){ 
     131 
     132                    q.addView(featureType + ".primaryIdentifier"); 
     133                    q.addView(featureType + ".score"); 
     134                    q.addView(featureType + ".chromosome.primaryIdentifier"); 
     135                    q.addView(featureType + ".chromosomeLocation.start"); 
     136                    q.addView(featureType + ".chromosomeLocation.end"); 
     137                    q.addView(featureType + ".chromosomeLocation.strand"); 
     138                    q.addConstraint(featureType + ".submissions.experiment.name",  
     139                            Constraints.eq(experimentName)); 
     140                    q.addOrderBy(featureType + ".chromosome.primaryIdentifier");  
     141                    q.addOrderBy(featureType + ".chromosomeLocation.start");  
     142                } else { 
     143                    q.addView(featureType + ".primaryIdentifier"); 
     144                    q.addView(featureType + ".score"); 
     145                    q.addView(featureType + ".chromosome.primaryIdentifier"); 
     146                    q.addView(featureType + ".chromosomeLocation.start"); 
     147                    q.addView(featureType + ".chromosomeLocation.end"); 
     148                    q.addView(featureType + ".chromosomeLocation.strand"); 
     149                    q.addView(featureType + ".submissions:experimentalFactors.type"); 
     150                    q.addView(featureType + ".submissions:experimentalFactors.name"); 
     151                    q.addConstraint(featureType + ".submissions.experiment.name",  
     152                            Constraints.eq(experimentName)); 
     153                    q.addOrderBy(featureType + ".chromosome.primaryIdentifier");  
     154                    q.addOrderBy(featureType + ".chromosomeLocation.start");  
     155 
     156                } 
     157            } 
     158 
    127159        } else if (type.equals("submission")) { 
    128160            dccId = (String) request.getParameter("submission"); 
    129161            Submission sub = MetadataCache.getSubmissionByDccId(os, new Integer(dccId)); 
    130  
    131162            List<String>  unlocFeatures = MetadataCache.getUnlocatedFeatureTypes(os).get(new Integer(dccId)); 
    132163 
    133             if (!unlocFeatures.contains(featureType)){ 
    134                 q.addView(featureType + ".primaryIdentifier"); 
    135                 q.addView(featureType + ".score"); 
    136                 q.addView(featureType + ".chromosome.primaryIdentifier"); 
    137                 q.addView(featureType + ".chromosomeLocation.start"); 
    138                 q.addView(featureType + ".chromosomeLocation.end"); 
    139                 q.addView(featureType + ".chromosomeLocation.strand"); 
    140                 q.addView(featureType + ".submissions:experimentalFactors.type"); 
    141                 q.addView(featureType + ".submissions:experimentalFactors.name"); 
    142                 q.addConstraint(featureType + ".submissions.DCCid", Constraints.eq(new Integer(dccId))); 
    143                 q.addOrderBy(featureType + ".chromosome.primaryIdentifier");  
    144                 q.addOrderBy(featureType + ".chromosomeLocation.start");  
    145  
    146             } else { 
    147  
    148                 q.addView(featureType + ".primaryIdentifier"); 
    149                 q.addView(featureType + ".score"); 
    150                 q.addView(featureType + ".submissions:experimentalFactors.type"); 
    151                 q.addView(featureType + ".submissions:experimentalFactors.name"); 
    152                 q.addConstraint(featureType + ".submissions.DCCid", Constraints.eq(new Integer(dccId))); 
    153             } 
    154  
     164            hasPrimer = false; 
     165 
     166            // to build the query description 
    155167            String experimentType = ""; 
    156168            if (sub.getExperimentType() != null) { 
     
    162174            if (SubmissionHelper.getExperimentalFactorString(sub).length() > 1){ 
    163175                efSub = " using " + SubmissionHelper.getExperimentalFactorString(sub); 
     176                if (efSub.contains("primer")){ 
     177                    hasPrimer = true; 
     178                    efSub = ""; 
     179                } 
    164180            } 
    165181 
     
    169185            + " (" + sub.getProject().getSurnamePI() + ")."; 
    170186            q.setDescription(description); 
     187 
     188            if (unlocFeatures == null || unlocFeatures.contains(featureType)){ 
     189                if (hasPrimer){ 
     190                    q.addView(featureType + ".primaryIdentifier"); 
     191                    q.addView(featureType + ".score"); 
     192                    q.addConstraint(featureType + ".submissions.DCCid", Constraints.eq(new Integer(dccId))); 
     193 
     194                } else { 
     195                    q.addView(featureType + ".primaryIdentifier"); 
     196                    q.addView(featureType + ".score"); 
     197                    q.addView(featureType + ".submissions:experimentalFactors.type"); 
     198                    q.addView(featureType + ".submissions:experimentalFactors.name"); 
     199                    q.addConstraint(featureType + ".submissions.DCCid", Constraints.eq(new Integer(dccId))); 
     200                } 
     201 
     202            } else { 
     203 
     204                // temporary until we remove primers from factors 
     205                if (hasPrimer){ 
     206                    q.addView(featureType + ".primaryIdentifier"); 
     207                    q.addView(featureType + ".score"); 
     208                    q.addView(featureType + ".chromosome.primaryIdentifier"); 
     209                    q.addView(featureType + ".chromosomeLocation.start"); 
     210                    q.addView(featureType + ".chromosomeLocation.end"); 
     211                    q.addView(featureType + ".chromosomeLocation.strand"); 
     212                    q.addConstraint(featureType + ".submissions.DCCid", Constraints.eq(new Integer(dccId))); 
     213                    q.addOrderBy(featureType + ".chromosome.primaryIdentifier");  
     214                    q.addOrderBy(featureType + ".chromosomeLocation.start");  
     215                } else { 
     216 
     217                    q.addView(featureType + ".primaryIdentifier"); 
     218                    q.addView(featureType + ".score"); 
     219                    q.addView(featureType + ".chromosome.primaryIdentifier"); 
     220                    q.addView(featureType + ".chromosomeLocation.start"); 
     221                    q.addView(featureType + ".chromosomeLocation.end"); 
     222                    q.addView(featureType + ".chromosomeLocation.strand"); 
     223                    q.addView(featureType + ".submissions:experimentalFactors.type"); 
     224                    q.addView(featureType + ".submissions:experimentalFactors.name"); 
     225                    q.addConstraint(featureType + ".submissions.DCCid", Constraints.eq(new Integer(dccId))); 
     226                    q.addOrderBy(featureType + ".chromosome.primaryIdentifier");  
     227                    q.addOrderBy(featureType + ".chromosomeLocation.start");  
     228                } 
     229            } 
    171230        } 
    172231 
Note: See TracChangeset for help on using the changeset viewer.