Changeset 20738


Ignore:
Timestamp:
26/02/10 16:10:04 (2 years ago)
Author:
julie
Message:

remove local version of StringUtils?.getEmpty(). we should use the apache commons one isntead

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/bio/postprocess/main/src/org/intermine/bio/postprocess/CreateFlankingRegions.java

    r20462 r20738  
    1616import java.util.Map; 
    1717 
     18import org.apache.commons.lang.StringUtils; 
    1819import org.apache.log4j.Logger; 
    1920import org.intermine.bio.util.BioQueries; 
     
    3031import org.intermine.objectstore.query.ResultsRow; 
    3132import org.intermine.util.DynamicUtil; 
    32 import org.intermine.util.StringUtil; 
    3333 
    3434/** 
     
    134134        // submissions.  This should work by DataSet but WormBase chado isn't setting a DataSet 
    135135        // correctly 
    136         if (StringUtil.isEmpty(gene.getSymbol())) { 
     136        if (StringUtils.isEmpty(gene.getSymbol())) { 
    137137            return; 
    138138        } 
  • trunk/bio/sources/chado-db/main/src/org/intermine/bio/dataconversion/FlyBaseProcessor.java

    r20679 r20738  
    3939import org.intermine.objectstore.ObjectStoreException; 
    4040import org.intermine.util.IntPresentSet; 
    41 import org.intermine.util.StringUtil; 
    4241import org.intermine.util.XmlUtil; 
    4342import org.intermine.xml.full.Item; 
     
    17421741                // make a synonym for the protein we're about to discard 
    17431742                if (protein != null) { 
    1744                     if (!StringUtil.isEmpty(uniqueName) 
     1743                    if (StringUtils.isNotEmpty(uniqueName) 
    17451744                                    && !protein.getExistingSynonyms().contains(uniqueName)) { 
    17461745                        Item synonym = createSynonym(protein, "identifier", uniqueName, true, 
     
    17481747                        store(synonym); 
    17491748                    } 
    1750                     if (!StringUtil.isEmpty(name) 
     1749                    if (StringUtils.isNotEmpty(name) 
    17511750                                    && !protein.getExistingSynonyms().contains(name)) { 
    17521751                        Item synonym = createSynonym(protein, "name", name, false, null); 
  • trunk/bio/sources/chado-db/main/src/org/intermine/bio/dataconversion/ModEncodeFeatureProcessor.java

    r20658 r20738  
    2626import org.apache.commons.collections.keyvalue.MultiKey; 
    2727import org.apache.commons.collections.map.MultiKeyMap; 
     28import org.apache.commons.lang.StringUtils; 
    2829import org.apache.log4j.Logger; 
    2930import org.intermine.bio.chado.config.ConfigAction; 
     
    3132import org.intermine.bio.util.OrganismData; 
    3233import org.intermine.objectstore.ObjectStoreException; 
    33 import org.intermine.util.StringUtil; 
    3434import org.intermine.util.TypeUtil; 
    3535import org.intermine.xml.full.Attribute; 
     
    5050    private final List<Integer> dataList; 
    5151    private final String title; 
    52      
     52 
    5353    private Set<String> commonFeatureInterMineTypes = new HashSet<String>(); 
    5454 
    5555    private static final String SUBFEATUREID_TEMP_TABLE_NAME = "modmine_subfeatureid_temp"; 
    56  
    5756 
    5857    // feature type to query from the feature table 
     
    9190     *                             i.e. the labItemIdentifier 
    9291     * @param dataList             the list of data ids to be used in the subquery 
    93      * @param title                the title            
     92     * @param title                the title 
    9493     */ 
    9594 
     
    102101        this.dataList = dataList; 
    103102        this.title = title; 
    104          
     103 
    105104        for (String chromosomeType : getChromosomeFeatureTypes()) { 
    106105            commonFeatureInterMineTypes.add( 
     
    184183        // (and merge the methods) 
    185184        // also: add match to query and do everything here 
    186          
     185 
    187186        // process indirect locations via match features and featureloc feature<->match<->feature 
    188187        ResultSet matchLocRes = getMatchLocResultSet(connection); 
     
    199198            processLocationTable(connection, matchTypeLocRes); 
    200199        } 
    201                  
     200 
    202201        // adding scores 
    203202        processFeatureScores(connection); 
     
    207206    /** 
    208207     * Method to set the source for gene 
    209      * for modencode datasources it will add the title  
     208     * for modencode datasources it will add the title 
    210209     * @param imObjectId the im object id 
    211210     * @param dataSourceName the data source 
     
    214213     */ 
    215214    @Override 
    216     protected void setGeneSource(Integer imObjectId, String dataSourceName)  
     215    protected void setGeneSource(Integer imObjectId, String dataSourceName) 
    217216    throws ObjectStoreException { 
    218217        String source = dataSourceName + "-" + title; 
     
    236235    } 
    237236 
    238     private List<String> getMatchTypes(Connection connection) throws SQLException, 
    239     ObjectStoreException { 
     237    private List<String> getMatchTypes(Connection connection) throws SQLException { 
    240238        List<String> types = new ArrayList<String>(); 
    241239        ResultSet res = getMatchTypesResultSet(connection); 
     
    250248 
    251249    /** 
    252      * Return the match types, used to determine which additional query to run  
     250     * Return the match types, used to determine which additional query to run 
    253251     * This is a protected method so that it can be overriden for testing 
    254252     * @param connection the db connection 
     
    264262        ResultSet res = stmt.executeQuery(query); 
    265263        LOG.debug("QUERY TIME feature match types: " + (System.currentTimeMillis() - bT)); 
    266         return res;   
    267     } 
    268      
    269      
    270     /** 
    271      * Return the interesting feature (EST, UST, RST, other?) matches  
     264        return res; 
     265    } 
     266 
     267 
     268    /** 
     269     * Return the interesting feature (EST, UST, RST, other?) matches 
    272270     * from the featureloc and feature tables. 
    273      *  
     271     * 
    274272     * feature<->featureloc<->match_feature<->featureloc<->feature 
    275273     * This is a protected method so that it can be overriden for testing 
     
    306304        return res; 
    307305    } 
    308      
     306 
    309307 
    310308    /** 
     
    369367                Thread.currentThread().setContextClassLoader(currentClassLoader); 
    370368            } 
    371         } else { 
    372             DataSetStoreHook.setDataSets(getModel(), item, dataSetIdentifier, dataSourceIdentifier); 
    373         } 
    374     } 
    375  
    376      
     369        } 
     370        DataSetStoreHook.setDataSets(getModel(), item, dataSetIdentifier, dataSourceIdentifier); 
     371    } 
     372 
     373 
    377374    /** 
    378375     * {@inheritDoc} 
     
    481478                if (uniqueName.startsWith("chr")) { 
    482479                    // this is to fix some data problem with sub 146 in modmine 
    483                     // where there are duplicated chromosome_arm features, with  
     480                    // where there are duplicated chromosome_arm features, with 
    484481                    // and without a 'chr' prefix (e.g. 3R and chr3R) 
    485482                    // The chr ones are not the location for any other feature. 
     
    489486        } 
    490487        Item feature = getChadoDBConverter().createItem(realInterMineType); 
    491    
     488 
    492489        return feature; 
    493490    } 
     
    589586        String name = fdat.getChadoFeatureName(); 
    590587        String type = fdat.getInterMineType(); 
    591          
     588 
    592589        if (identifier.equalsIgnoreCase(uniqueName)) { 
    593590            if (type.equalsIgnoreCase(CHROMOSOME)) { 
     
    600597                } 
    601598            } 
    602              
    603             // Piano submissions have Gene: and Transcript:  
     599 
     600            // Piano submissions have Gene: and Transcript: 
    604601            // in front of gene and transcript identifiers 
    605602            if (type.equalsIgnoreCase("Gene")) { 
     
    610607        } 
    611608 
    612         if (StringUtil.isEmpty(identifier)) { 
    613             if (StringUtil.isEmpty(name)) { 
     609        if (StringUtils.isEmpty(identifier)) { 
     610            if (StringUtils.isEmpty(name)) { 
    614611                String fixedName = uniqueName.substring(uniqueName.lastIndexOf('.') + 1); 
    615612                return fixedName; 
     
    618615            } 
    619616        } 
    620         return identifier;     
    621     } 
    622      
     617        return identifier; 
     618    } 
     619 
    623620    private void processFeatureScores(Connection connection) throws SQLException, 
    624621    ObjectStoreException { 
  • trunk/bio/sources/chado-db/main/src/org/intermine/bio/dataconversion/ModEncodeMetaDataProcessor.java

    r20734 r20738  
    7878        new HashMap<Integer, AppliedData>(); 
    7979 
    80  
    8180    // project/lab/experiment/submission maps 
    8281    // -------------------------------------- 
     
    104103    private Map<Integer, String> protocolItemIds = new HashMap<Integer, String>(); 
    105104    private Map<String, Integer> protocolItemToObjectId = new HashMap<String, Integer>(); 
    106      
     105 
    107106    private Map<Integer, Integer> publicationIdMap = new HashMap<Integer, Integer>(); 
    108107    private Map<Integer, String> publicationIdRefMap = new HashMap<Integer, String>(); 
    109      
    110      
    111      
     108 
     109 
     110 
    112111    private Map<Integer, String> protocolTypesMap = new HashMap<Integer, String>(); 
    113112    private Map<Integer, Integer> appliedProtocolIdMap = new HashMap<Integer, Integer>(); 
     
    139138    private IdResolverFactory wormResolverFactory = null; 
    140139    private Map<String, String> geneToItemIdentifier = new HashMap<String, String>(); 
    141      
     140 
    142141    private Map<DatabaseRecordKey, String> dbRecords = new HashMap<DatabaseRecordKey, String>(); 
    143142 
    144      
     143 
    145144    private static class SubmissionDetails 
    146145    { 
     
    198197    } 
    199198 
    200      
    201      
     199 
     200 
    202201    /** 
    203202     * Create a new ChadoProcessor object 
     
    233232        setSubmissionExperimetRefs(connection); 
    234233        setDAGRefs(connection); 
    235          
     234 
    236235        // create DatabaseRecords where necessary for each submission 
    237236        createDatabaseRecords(connection); 
     
    250249    } 
    251250 
    252      
     251 
    253252    /** 
    254253     * 
     
    307306            String queryList = StringUtil.join(thisSubmissionDataIds, ","); 
    308307            processDataFeatureTable(connection, subFeatureMap, chadoExperimentId, queryList); 
    309              
     308 
    310309            // read any genes that have been created so we can re-use the same item identifiers 
    311310            // when creating antibody/strain target genes later 
     
    315314    } 
    316315 
    317     private void extractGenesFromSubFeatureMap(ModEncodeFeatureProcessor processor,  
     316    private void extractGenesFromSubFeatureMap(ModEncodeFeatureProcessor processor, 
    318317            Map<Integer, FeatureData> subFeatureMap) { 
    319318        for (FeatureData fData : subFeatureMap.values()) { 
     
    324323        } 
    325324    } 
    326      
     325 
    327326    /** 
    328327     * @param connection 
     
    343342            Integer dataId = new Integer(res.getInt("data_id")); 
    344343            Integer featureId = new Integer(res.getInt("feature_id")); 
    345              
     344 
    346345            FeatureData featureData = featureMap.get(featureId); 
    347346            if (featureData == null) { 
     
    355354            // TODO: it needs correction: here stores only the last submission reference. 
    356355            Integer featureObjectId = featureData.getIntermineObjectId(); 
    357              
     356 
    358357            collection = new ReferenceList(); 
    359358            collection.setName("submissions"); 
     
    10591058                    value = value.substring(value.indexOf(':') + 1); 
    10601059                } 
    1061                  
     1060 
    10621061                Item pub = getChadoDBConverter().createItem("Publication"); 
    10631062                pub.setAttribute(fieldName, value); 
    10641063                Integer intermineObjectId = getChadoDBConverter().store(pub); 
    1065                  
     1064 
    10661065                publicationIdMap.put(submissionId, intermineObjectId); 
    10671066                publicationIdRefMap.put(submissionId, pub.getIdentifier()); 
    10681067                continue; 
    10691068            } 
    1070              
     1069 
    10711070            setAttribute(submissionMap.get(submissionId).interMineObjectId, fieldName, value); 
    10721071            count++; 
     
    11001099     * ========================== 
    11011100     * 
    1102      *     
     1101     * 
    11031102     * @param connection 
    11041103     * @throws SQLException 
     
    11151114        ExperimentalFactor ef = null; 
    11161115        String name = null; 
    1117          
     1116 
    11181117        while (res.next()) { 
    11191118            Integer submissionId = new Integer(res.getInt("experiment_id")); 
    11201119            Integer rank = new Integer(res.getInt("rank")); 
    11211120            String  value    = res.getString("value"); 
    1122              
     1121 
    11231122            // the data is alternating between EF types and names, in order. 
    11241123            if (submissionId != prevSub) { 
     
    11501149        } 
    11511150        res.close(); 
    1152         LOG.info("created " + count + " experimental factors");         
     1151        LOG.info("created " + count + " experimental factors"); 
    11531152        LOG.info("PROCESS TIME experimental factors: " + (System.currentTimeMillis() - bT)); 
    11541153} 
     
    12081207    } 
    12091208 
    1210      
     1209 
    12111210    private String createProtocol(Integer chadoId, String name, String description, String wikiLink, 
    12121211            Integer version) throws ObjectStoreException { 
     
    12191218            protocol.setAttribute("version", "" + version); 
    12201219            Integer intermineObjectId = getChadoDBConverter().store(protocol); 
    1221              
    1222              
     1220 
     1221 
    12231222            protocolItemId = protocol.getIdentifier(); 
    12241223            protocolItemToObjectId.put(protocolItemId, intermineObjectId); 
     
    12321231        return protocolItemToObjectId.get(protocolItemIds.get(chadoId)); 
    12331232    } 
    1234      
    1235      
     1233 
     1234 
    12361235    /** 
    12371236     * Return the rows needed from the protocol table. 
     
    15501549    // first value in the list of synonyms is the 'preferred' value 
    15511550    private static String[][] synonyms = new String[][]{ 
    1552             new String[] {"developmental stage", "stage",  
     1551            new String[] {"developmental stage", "stage", 
    15531552                    "developmental_stage", "dev stage", "devstage"}, 
    15541553                    new String[] {"strain", "strain_or_line"}, 
     
    15831582        return unified; 
    15841583    } 
    1585      
    1586      
     1584 
     1585 
    15871586    private class SubmissionReference 
    15881587    { 
     
    15941593        private String dataValue; 
    15951594    } 
    1596      
     1595 
    15971596    // process new query 
    15981597    // get DCC id 
     
    16221621        Integer lastDataId = new Integer(-1); 
    16231622        Map<String, SubmissionProperty> props = new HashMap <String, SubmissionProperty>(); 
    1624          
    1625         Map<Integer, Map<String, List<SubmissionProperty>>> subToTypes =  
     1623 
     1624        Map<Integer, Map<String, List<SubmissionProperty>>> subToTypes = 
    16261625            new HashMap<Integer, Map<String, List<SubmissionProperty>>>(); 
    16271626 
    16281627        submissionRefs = new HashMap<Integer, SubmissionReference>(); 
    1629          
     1628 
    16301629        while (res.next()) { 
    16311630            Integer dataId = new Integer(res.getInt("data_id")); 
     
    16381637            String attValue = res.getString("att_value"); 
    16391638            String attDbxref = res.getString("att_dbxref"); 
    1640              
     1639 
    16411640            Integer submissionId = dataSubmissionMap.get(dataId); 
    16421641            LOG.debug("DCC fetch: " + submissionId + ", " + dccIdMap.get(submissionId)); 
    16431642            String dccId = dccIdMap.get(submissionId); 
    16441643 
    1645             writer.write(dccId + comma + dataHeading + comma + dataName + comma  
    1646                     + wikiPageUrl + comma + cvTerm + comma + attHeading + comma + attName  
     1644            writer.write(dccId + comma + dataHeading + comma + dataName + comma 
     1645                    + wikiPageUrl + comma + cvTerm + comma + attHeading + comma + attName 
    16471646                    + comma + attValue + comma + attDbxref + System.getProperty("line.separator")); 
    16481647 
     
    16551654                Integer referencedSubId = getSubmissionIdFromDccId(attValue); 
    16561655                if (referencedSubId != null) { 
    1657                     SubmissionReference subRef =  
     1656                    SubmissionReference subRef = 
    16581657                        new SubmissionReference(referencedSubId, wikiPageUrl); 
    16591658                    submissionRefs.put(submissionId, subRef); 
     
    16671666                    buildSubProperty = null; 
    16681667                } else { 
    1669                     buildSubProperty =  
     1668                    buildSubProperty = 
    16701669                        new SubmissionProperty(getPreferredSynonym(dataName), wikiPageUrl); 
    16711670                    props.put(wikiPageUrl, buildSubProperty); 
     
    16871686        // properties here 
    16881687        addSubmissionPropsFromCharacteristics(subToTypes, connection); 
    1689   
     1688 
    16901689        // some submissions use reagents created in reference submissions, find the properties 
    16911690        // of the reagents and add to referencing submission 
    16921691        addSubmissionPropsFromReferencedSubmissions(subToTypes, props, submissionRefs); 
    1693              
     1692 
    16941693        // create and store properties of submission 
    16951694        for (Integer submissionId : subToTypes.keySet()) { 
    16961695            Integer storedSubmissionId = submissionMap.get(submissionId).interMineObjectId; 
    1697              
     1696 
    16981697            Map<String, List<SubmissionProperty>> typeToProp = subToTypes.get(submissionId); 
    16991698 
    17001699            String dccId = dccIdMap.get(submissionId); 
    1701              
     1700 
    17021701            ExperimentalFactor ef = submissionEFMap.get(submissionId); 
    17031702            if (ef == null) { 
     
    17051704                continue; 
    17061705            } 
    1707             Set<String> exFactorNames = unifyFactorNames(ef.efNames);             
     1706            Set<String> exFactorNames = unifyFactorNames(ef.efNames); 
    17081707            LOG.info("PROPERTIES " + dccId + " typeToProp keys: " + typeToProp.keySet()); 
    1709              
     1708 
    17101709            List<Item> allPropertyItems = new ArrayList<Item>(); 
    1711              
     1710 
    17121711            // DEVELOPMENTAL STAGE 
    17131712            List<Item> devStageItems = new ArrayList<Item>(); 
    1714             devStageItems.addAll(createFromWikiPage(dccId, "DevelopmentalStage", typeToProp,  
     1713            devStageItems.addAll(createFromWikiPage(dccId, "DevelopmentalStage", typeToProp, 
    17151714                    makeLookupList("developmental stage"))); 
    17161715            if (devStageItems.isEmpty()) { 
     
    17241723                        })); 
    17251724                if (!devStageItems.isEmpty()) { 
    1726                  }                 
     1725                 } 
    17271726            } 
    17281727            storeSubmissionCollection(storedSubmissionId, "developmentalStages", devStageItems); 
     
    17311730                exFactorNames.remove("developmental stage"); 
    17321731            } 
    1733             allPropertyItems.addAll(devStageItems);             
    1734              
     1732            allPropertyItems.addAll(devStageItems); 
     1733 
    17351734            // STRAIN 
    17361735            List<Item> strainItems = new ArrayList<Item>(); 
    17371736            strainItems.addAll(createFromWikiPage( 
    17381737                    dccId, "Strain", typeToProp, makeLookupList("strain"))); 
    1739              
     1738 
    17401739            storeSubmissionCollection(storedSubmissionId, "strains", strainItems); 
    17411740            if (!strainItems.isEmpty() && exFactorNames.contains("strain")) { 
     
    17431742                exFactorNames.remove("strain"); 
    17441743            } 
    1745             allPropertyItems.addAll(strainItems);             
    1746              
    1747              
     1744            allPropertyItems.addAll(strainItems); 
     1745 
     1746 
    17481747            // ARRAY 
    17491748            List<Item> arrayItems = new ArrayList<Item>(); 
     
    17571756                        })); 
    17581757                if (!arrayItems.isEmpty()) { 
    1759                     LOG.debug("Attribute found in other wiki pages: "  
    1760                             + dccId + " ARRAY ");                     
     1758                    LOG.debug("Attribute found in other wiki pages: " 
     1759                            + dccId + " ARRAY "); 
    17611760                } 
    17621761            } 
     
    17661765                exFactorNames.remove("array"); 
    17671766            } 
    1768             allPropertyItems.addAll(arrayItems);             
    1769              
     1767            allPropertyItems.addAll(arrayItems); 
     1768 
    17701769            // CELL LINE 
    17711770            List<Item> lineItems = new ArrayList<Item>(); 
    1772             lineItems.addAll(createFromWikiPage(dccId, "CellLine", typeToProp,  
     1771            lineItems.addAll(createFromWikiPage(dccId, "CellLine", typeToProp, 
    17731772                    makeLookupList("cell line"))); 
    17741773            storeSubmissionCollection(storedSubmissionId, "cellLines", lineItems); 
     
    17771776                exFactorNames.remove("cell line"); 
    17781777            } 
    1779             allPropertyItems.addAll(lineItems);             
    1780              
     1778            allPropertyItems.addAll(lineItems); 
     1779 
    17811780            // RNAi REAGENT 
    17821781            List<Item> reagentItems = new ArrayList<Item>(); 
    1783             reagentItems.addAll(createFromWikiPage(dccId, "SubmissionProperty", typeToProp,  
     1782            reagentItems.addAll(createFromWikiPage(dccId, "SubmissionProperty", typeToProp, 
    17841783                    makeLookupList("dsRNA"))); 
    17851784            if (!reagentItems.isEmpty() && exFactorNames.contains("RNAi reagent")) { 
     
    17871786                exFactorNames.remove("RNAi reagent"); 
    17881787            } 
    1789             allPropertyItems.addAll(reagentItems);       
    1790              
     1788            allPropertyItems.addAll(reagentItems); 
     1789 
    17911790            // ANTIBODY 
    17921791            List<Item> antibodyItems = new ArrayList<Item>(); 
    1793             antibodyItems.addAll(createFromWikiPage(dccId, "Antibody", typeToProp,  
     1792            antibodyItems.addAll(createFromWikiPage(dccId, "Antibody", typeToProp, 
    17941793                    makeLookupList("antibody"))); 
    17951794            if (antibodyItems.isEmpty()) { 
     
    18001799                        })); 
    18011800                if (!antibodyItems.isEmpty()) { 
    1802                     LOG.debug("Attribute found in other wiki pages: "  
    1803                             + dccId + " ANTIBODY ");                     
     1801                    LOG.debug("Attribute found in other wiki pages: " 
     1802                            + dccId + " ANTIBODY "); 
    18041803                } 
    18051804            } 
     
    18091808                exFactorNames.remove("antibody"); 
    18101809            } 
    1811             allPropertyItems.addAll(antibodyItems);             
    1812  
    1813              
     1810            allPropertyItems.addAll(antibodyItems); 
     1811 
     1812 
    18141813            // TISSUE 
    18151814            List<Item> tissueItems = new ArrayList<Item>(); 
     
    18241823                        })); 
    18251824                if (!tissueItems.isEmpty()) { 
    1826                     LOG.info("Attribute found in other wiki pages: "  
    1827                             + dccId + " TISSUE");                     
    1828                 }  
     1825                    LOG.info("Attribute found in other wiki pages: " 
     1826                            + dccId + " TISSUE"); 
     1827                } 
    18291828            } 
    18301829            storeSubmissionCollection(storedSubmissionId, "tissues", tissueItems); 
     
    18331832                exFactorNames.remove("tissue"); 
    18341833            } 
    1835             allPropertyItems.addAll(tissueItems);             
    1836  
    1837              
    1838              
     1834            allPropertyItems.addAll(tissueItems); 
     1835 
     1836 
     1837 
    18391838            // There may be some other experimental factors that require SubmissionProperty objects 
    18401839            // but don't fall into the categories above.  Create them here and set experimental 
     
    18431842            for (String exFactor : extraPropNames) { 
    18441843                List<Item> extraPropItems = new ArrayList<Item>(); 
    1845                 extraPropItems.addAll(lookForAttributesInOtherWikiPages("SubmissionProperty",  
     1844                extraPropItems.addAll(lookForAttributesInOtherWikiPages("SubmissionProperty", 
    18461845                        typeToProp, new String[] {exFactor})); 
    1847                 allPropertyItems.addAll(extraPropItems);  
     1846                allPropertyItems.addAll(extraPropItems); 
    18481847                createExperimentalFactors(submissionId, exFactor, extraPropItems); 
    18491848                exFactorNames.remove(exFactor); 
    18501849            } 
    18511850 
    1852              
     1851 
    18531852            // Store Submission.properties/ SubmissionProperty.submissions 
    18541853            storeSubmissionCollection(storedSubmissionId, "properties", allPropertyItems); 
    1855              
     1854 
    18561855            // deal with remaining factor names (e.g. the ones for which we did 
    18571856            // not find a corresponding attribute 
     
    18591858                String type = ef.efTypes.get(exFactor); 
    18601859                createEFItem(submissionId, type, exFactor, null); 
    1861             }         
     1860            } 
    18621861        } 
    18631862        LOG.info("PROCESS TIME submission properties: " + (System.currentTimeMillis() - bT)); 
     
    18651864 
    18661865    // Traverse DAG following previous applied protocol links to build a list of all AppliedData 
    1867     private void findAppliedProtocolsAndDataFromEarlierInDag(Integer startDataId,  
     1866    private void findAppliedProtocolsAndDataFromEarlierInDag(Integer startDataId, 
    18681867            List<AppliedData> foundAppliedData, List<AppliedProtocol> foundAppliedProtocols) { 
    18691868        AppliedData aData = appliedDataMap.get(startDataId); 
     
    18711870            foundAppliedData.add(aData); 
    18721871        } 
    1873          
     1872 
    18741873        for (Integer previousAppliedProtocolId : aData.previousAppliedProtocols) { 
    18751874            AppliedProtocol ap = appliedProtocolMap.get(previousAppliedProtocolId); 
     
    18811880                        foundAppliedProtocols); 
    18821881            } 
    1883         }             
    1884     } 
    1885      
    1886      
    1887     private void createExperimentalFactors(Integer submissionId, String type,  
     1882        } 
     1883    } 
     1884 
     1885 
     1886    private void createExperimentalFactors(Integer submissionId, String type, 
    18881887            Collection<Item> items) throws ObjectStoreException { 
    18891888        for (Item item : items) { 
    1890             createEFItem(submissionId, type, item.getAttribute("name").getValue(),  
     1889            createEFItem(submissionId, type, item.getAttribute("name").getValue(), 
    18911890                    item.getIdentifier()); 
    18921891        } 
    18931892    } 
    1894      
    1895      
     1893 
     1894 
    18961895    private void createEFItem(Integer current, String type, 
    18971896            String efName, String propertyIdentifier) throws ObjectStoreException { 
     
    19161915 
    19171916 
    1918     private void addToSubToTypes(Map<Integer, Map<String, List<SubmissionProperty>>> subToTypes,  
     1917    private void addToSubToTypes(Map<Integer, Map<String, List<SubmissionProperty>>> subToTypes, 
    19191918            Integer submissionId, SubmissionProperty prop) { 
    19201919     // submissionId -> [type -> SubmissionProperty] 
     
    19281927            subProps = new ArrayList<SubmissionProperty>(); 
    19291928            typeToSubProp.put(prop.type, subProps); 
    1930         }  
     1929        } 
    19311930        subProps.add(prop); 
    19321931    } 
    1933      
    1934      
     1932 
     1933 
    19351934    private void addSubmissionPropsFromCharacteristics( 
    1936             Map<Integer, Map<String, List<SubmissionProperty>>> subToTypes,  
    1937             Connection connection)  
     1935            Map<Integer, Map<String, List<SubmissionProperty>>> subToTypes, 
     1936            Connection connection) 
    19381937    throws SQLException { 
    1939          
     1938 
    19401939        ResultSet res = getAppliedDataCharacteristics(connection); 
    19411940 
     
    19461945        Integer currentSubId = null;   // we need those to attach the property to the correct sub 
    19471946        Integer previousSubId = null; 
    1948          
     1947 
    19491948        while (res.next()) { 
    19501949            Integer dataId = new Integer(res.getInt("data_id")); 
     
    19531952            String attValue = res.getString("att_value"); 
    19541953            Integer attDbxref = new Integer(res.getInt("att_dbxref")); 
    1955              
     1954 
    19561955            currentSubId = dataSubmissionMap.get(dataId); 
    19571956 
    1958             LOG.debug("XXX " + currentSubId + ":" + dataId + "|" + attValue + "|" +attDbxref);             
     1957            LOG.debug("XXX " + currentSubId + ":" + dataId + "|" + attValue 
     1958                    + "|" +attDbxref); 
    19591959            if (attDbxref.intValue() != lastAttDbXref.intValue() || 
    1960                     currentSubId != previousSubId) {                 
     1960                    currentSubId != previousSubId) { 
    19611961                // store the last build property if created, type is set only if we found an 
    19621962                // attHeading of Characteristics 
    19631963                // note: dbxref can remain the same in different subs -> or 
    19641964                if (buildSubProperty != null && buildSubProperty.type != null) { 
    1965                     createdProps.put(lastAttDbXref, buildSubProperty);     
     1965                    createdProps.put(lastAttDbXref, buildSubProperty); 
    19661966                    addToSubToTypes(subToTypes, previousSubId, buildSubProperty); 
    19671967                } 
    1968                 // set up for next attDbxref  
     1968                // set up for next attDbxref 
    19691969                if (createdProps.containsKey(attDbxref) && isValidCharacteristic) { 
    19701970                    // seen this property before so just add for this submission, don't build again 
     
    19771977                } 
    19781978            } 
    1979              
     1979 
    19801980            if (attHeading.startsWith("Characteristic")) { 
    1981                 isValidCharacteristic = true;                 
    1982             } 
    1983              
     1981                isValidCharacteristic = true; 
     1982            } 
     1983 
    19841984            if (buildSubProperty != null) { 
    19851985                if (attHeading.startsWith("Characteristic")) { 
     
    19981998 
    19991999        if (buildSubProperty != null && buildSubProperty.type != null) { 
    2000             createdProps.put(lastAttDbXref, buildSubProperty);     
     2000            createdProps.put(lastAttDbXref, buildSubProperty); 
    20012001            addToSubToTypes(subToTypes, currentSubId, buildSubProperty); 
    20022002        } 
    20032003    } 
    2004      
     2004 
    20052005    // Some submission mention e.g. an RNA Sample but the details of how that sample was created, 
    20062006    // stage, strain, etc are in a previous submission.  There are references to previous submission 
     
    20132013            Map<String, SubmissionProperty> props, 
    20142014            Map<Integer, SubmissionReference> submissionRefs) { 
    2015          
     2015 
    20162016        for (Map.Entry<Integer, SubmissionReference> entry : submissionRefs.entrySet()) { 
    20172017            Integer submissionId = entry.getKey(); 
    20182018            SubmissionReference subRef = entry.getValue(); 
    2019              
    2020              
     2019 
     2020 
    20212021            List<AppliedData> refAppliedData = findAppliedDataFromReferencedSubmission(subRef); 
    20222022            for (AppliedData aData : refAppliedData) { 
     
    20292029        } 
    20302030    } 
    2031      
     2031 
    20322032    private List<AppliedData> findAppliedDataFromReferencedSubmission(SubmissionReference subRef) { 
    20332033        List<AppliedData> foundAppliedData = new ArrayList<AppliedData>(); 
     
    20352035        return foundAppliedData; 
    20362036    } 
    2037      
     2037 
    20382038    private List<AppliedProtocol> findAppliedProtocolsFromReferencedSubmission( 
    20392039            SubmissionReference subRef) { 
     
    20422042        return foundAppliedProtocols; 
    20432043    } 
    2044      
     2044 
    20452045    private void findAppliedProtocolsAndDataFromReferencedSubmission( 
    20462046            SubmissionReference subRef, 
     
    20552055 
    20562056            if (refDataValue.equals(currentDataValue) && refSubId.equals(currentDataSubId)) { 
    2057                 LOG.info("REFSUBS found a matching data value: " + currentDataValue + " in sub "  
    2058                         + dccIdMap.get(currentDataSubId) + " ref sub = "  
     2057                LOG.info("REFSUBS found a matching data value: " + currentDataValue + " in sub " 
     2058                        + dccIdMap.get(currentDataSubId) + " ref sub = " 
    20592059                        + dccIdMap.get(refSubId)); 
    2060                  
     2060 
    20612061                Integer foundDataId = aData.dataId; 
    20622062 
     
    20662066        } 
    20672067    } 
    2068      
    2069      
    2070     private List<Item> createFromWikiPage(String dccId, String clsName,  
    2071             Map<String, List<SubmissionProperty>> typeToProp, List<String> types)  
     2068 
     2069 
     2070    private List<Item> createFromWikiPage(String dccId, String clsName, 
     2071            Map<String, List<SubmissionProperty>> typeToProp, List<String> types) 
    20722072            throws ObjectStoreException { 
    20732073        List<Item> items = new ArrayList<Item>(); 
     
    20842084 
    20852085    private void storeSubmissionCollection(Integer storedSubmissionId, String name, 
    2086             List<Item> items)  
     2086            List<Item> items) 
    20872087    throws ObjectStoreException { 
    20882088        if (!items.isEmpty()) { 
     
    20912091        } 
    20922092    } 
    2093      
     2093 
    20942094    private List<String> getIdentifiersFromItems(Collection<Item> items) { 
    20952095        List<String> ids = new ArrayList<String>(); 
     
    20992099        return ids; 
    21002100    } 
    2101      
    2102     private List<Item> createItemsForSubmissionProperties(String dccId, String clsName,  
     2101 
     2102    private List<Item> createItemsForSubmissionProperties(String dccId, String clsName, 
    21032103            List<SubmissionProperty> subProps) 
    21042104    throws ObjectStoreException { 
     
    21122112        return items; 
    21132113    } 
    2114          
    2115      
     2114 
     2115 
    21162116 
    21172117    private Item getItemForSubmissionProperty(String clsName, SubmissionProperty prop, String dccId) 
     
    21282128                } 
    21292129                if (checkOfficialName == null) { 
    2130                     LOG.info("Official name - missing for property: "  
     2130                    LOG.info("Official name - missing for property: " 
    21312131                            + prop.type + ", " + prop.wikiPageUrl); 
    21322132                    return null; 
    21332133                } else if (checkOfficialName.size() != 1) { 
    2134                     LOG.info("Official name - multiple times for property: "  
    2135                             + prop.type + ", " + prop.wikiPageUrl + ", "  
     2134                    LOG.info("Official name - multiple times for property: " 
     2135                            + prop.type + ", " + prop.wikiPageUrl + ", " 
    21362136                            + checkOfficialName); 
    21372137                } 
     
    21412141                propItem.setAttribute("type", getPreferredSynonym(prop.type)); 
    21422142                propItem.setAttribute("wikiLink", WIKI_URL + prop.wikiPageUrl); 
    2143                 if (clsName.equals("DevelopmentalStage")) {                     
     2143                if (clsName.equals("DevelopmentalStage")) { 
    21442144                    setAttributeOnProp(prop, propItem, "sex", "sex"); 
    2145                      
     2145 
    21462146                    List<String> devStageValues = prop.details.get("developmental stage"); 
    21472147                    if (devStageValues != null) { 
    21482148                        for (String devStageValue : devStageValues) { 
    2149                             propItem.addToCollection("ontologyTerms",  
     2149                            propItem.addToCollection("ontologyTerms", 
    21502150                                    getDevStageTerm(devStageValue)); 
    21512151                        } 
    21522152                    } else { 
    2153                         LOG.error("METADATA FAIL: no 'developmental stage' values for wiki page: "  
     2153                        LOG.error("METADATA FAIL: no 'developmental stage' values for wiki page: " 
    21542154                                + prop.wikiPageUrl); 
    21552155                    } 
     
    21652165                } else if (clsName.equals("CellLine")) { 
    21662166                    setAttributeOnProp(prop, propItem, "sex", "sex"); 
    2167                     setAttributeOnProp(prop, propItem, "short description",  
     2167                    setAttributeOnProp(prop, propItem, "short description", 
    21682168                            "description"); 
    21692169                    setAttributeOnProp(prop, propItem, "species", "species"); 
     
    21782178                    setAttributeOnProp(prop, propItem, "Description", "description"); 
    21792179                    setAttributeOnProp(prop, propItem, "details", "description"); 
    2180                      
     2180 
    21812181                    setAttributeOnProp(prop, propItem, "aliases", "name"); 
    21822182                    setAttributeOnProp(prop, propItem, "reference", "reference"); 
     
    21982198            throws ObjectStoreException { 
    21992199        String targetText = null; 
    2200         String[] possibleTypes = new String[] {"target id"};  
     2200        String[] possibleTypes = new String[] {"target id"}; 
    22012201 
    22022202        for (String targetType : possibleTypes) { 
    22032203            if (prop.details.containsKey(targetType)) { 
    22042204                if (prop.details.get(targetType).size() != 1) { 
    2205                      
    2206                     // we used to complain if multiple values, now only  
     2205 
     2206                    // we used to complain if multiple values, now only 
    22072207                    // if they don't have the same value 
    22082208                    checkIfSameValue(prop, source, targetType); 
     
    22322232    private void checkIfSameValue(SubmissionProperty prop, String source, 
    22332233            String targetType) throws RuntimeException { 
    2234         String value = prop.details.get(targetType).get(0);                     
     2234        String value = prop.details.get(targetType).get(0); 
    22352235        for (int i = 1; i < prop.details.get(targetType).size(); i++) { 
    22362236            String newValue = prop.details.get(targetType).get(i); 
    22372237            if (!newValue.equals(value)) { 
    2238               throw new RuntimeException(source + " should only have one value for '" + targetType  
    2239               + "' field: " + prop.details.get(targetType));                             
    2240             } 
    2241         } 
    2242     } 
    2243  
    2244  
    2245     private void setAttributeOnProp(SubmissionProperty subProp, Item item, String metadataName,  
     2238              throw new RuntimeException(source + " should only have one value for '" + targetType 
     2239              + "' field: " + prop.details.get(targetType)); 
     2240            } 
     2241        } 
     2242    } 
     2243 
     2244 
     2245    private void setAttributeOnProp(SubmissionProperty subProp, Item item, String metadataName, 
    22462246            String attributeName) { 
    22472247 
     
    22582258                    } 
    22592259                } 
    2260             } else if (metadataName.equalsIgnoreCase("description")  
     2260            } else if (metadataName.equalsIgnoreCase("description") 
    22612261                    || metadataName.equalsIgnoreCase("details")) { 
    22622262                // description is often split in more than 1 line 
     
    22672267                } 
    22682268                item.setAttribute(attributeName, all); 
    2269                  
     2269 
    22702270            } else { 
    22712271                String value = subProp.details.get(metadataName).get(0); 
     
    22732273            } 
    22742274        } 
    2275     }        
    2276  
    2277      
     2275    } 
     2276 
     2277 
    22782278    private String getTargetGeneItemIdentfier(String geneTargetIdText, String dccId) 
    22792279    throws ObjectStoreException { 
    22802280        String taxonId = ""; 
    22812281        String originalId = null; 
    2282          
     2282 
    22832283        String flyPrefix = "fly_genes:"; 
    22842284        String wormPrefix = "worm_genes:"; 
    2285          
     2285 
    22862286        if (geneTargetIdText.startsWith(flyPrefix)) { 
    22872287            originalId = geneTargetIdText.substring(flyPrefix.length()); 
     
    22972297            taxonId = "" + or.getOrganismDataByFullName(organism).getTaxonId(); 
    22982298            originalId = geneTargetIdText; 
    2299             LOG.info("RESOLVER: found organism '" + organism + "', taxon " + taxonId  
     2299            LOG.info("RESOLVER: found organism '" + organism + "', taxon " + taxonId 
    23002300                    + " for submission " + dccId); 
    23012301        } 
     
    23072307            resolver = wormResolverFactory.getIdResolver(); 
    23082308        } else { 
    2309             LOG.info("RESOLVER: unable to work out organism for target id text: "  
     2309            LOG.info("RESOLVER: unable to work out organism for target id text: " 
    23102310                    + geneTargetIdText); 
    23112311        } 
     
    23372337                    + " found ids: " + resolver.resolveId(taxonId, originalId) + "."); 
    23382338        } else { 
    2339             primaryIdentifier =  
     2339            primaryIdentifier = 
    23402340                resolver.resolveId(taxonId, originalId).iterator().next(); 
    2341             LOG.info("RESOLVER found gene " + primaryIdentifier  
     2341            LOG.info("RESOLVER found gene " + primaryIdentifier 
    23422342                    + " for original id: " + originalId); 
    23432343        } 
    23442344        return primaryIdentifier; 
    23452345    } 
    2346      
     2346 
    23472347 
    23482348    private List<Item> lookForAttributesInOtherWikiPages(String clsName, 
    2349             Map<String, List<SubmissionProperty>> typeToProp, String[] lookFor)  
     2349            Map<String, List<SubmissionProperty>> typeToProp, String[] lookFor) 
    23502350            throws ObjectStoreException { 
    23512351 
     
    23592359 
    23602360                if (typeToProp.containsKey(type)) { 
    2361                     for (SubmissionProperty subProp : typeToProp.get(type)) {  
     2361                    for (SubmissionProperty subProp : typeToProp.get(type)) { 
    23622362                        if (subProp.details.containsKey(propName)) { 
    23632363                            for (String value : subProp.details.get(propName)) { 
    2364                                 items.add(createNonWikiSubmissionPropertyItem(clsName,  
    2365                                         getPreferredSynonym(propName),  
     2364                                items.add(createNonWikiSubmissionPropertyItem(clsName, 
     2365                                        getPreferredSynonym(propName), 
    23662366                                        correctAttrValue(value))); 
    23672367                            } 
     
    23762376                // which probably won't be a wiki page 
    23772377                if (typeToProp.containsKey(typeProp)) { 
    2378                     for (SubmissionProperty subProp : typeToProp.get(typeProp)) {  
     2378                    for (SubmissionProperty subProp : typeToProp.get(typeProp)) { 
    23792379 
    23802380                        String value = subProp.wikiPageUrl; 
    2381                          
     2381 
    23822382                        // This is an ugly special case to deal with 'exposure time/24 hours' 
    23832383                        if (subProp.details.containsKey("Unit")) { 
     
    23852385                            value = value + " " + unit + (unit.endsWith("s") ? "" : "s"); 
    23862386                        } 
    2387                          
    2388                         items.add(createNonWikiSubmissionPropertyItem(clsName, subProp.type,  
     2387 
     2388                        items.add(createNonWikiSubmissionPropertyItem(clsName, subProp.type, 
    23892389                                correctAttrValue(value))); 
    23902390                    } 
     
    23942394        return items; 
    23952395    } 
    2396    
     2396 
    23972397    private String correctAttrValue(String value) { 
    23982398        if (value == null) { 
     
    24002400        } 
    24012401        value = value.replace("–", "-"); 
    2402         return value;   
    2403     } 
    2404  
    2405      
    2406     private Item createNonWikiSubmissionPropertyItem(String clsName, String type, String name)  
     2402        return value; 
     2403    } 
     2404 
     2405 
     2406    private Item createNonWikiSubmissionPropertyItem(String clsName, String type, String name) 
    24072407    throws ObjectStoreException { 
    24082408        if (clsName.equals("DevelopmentalStage")) { 
    24092409            name = correctDevStageTerm(name); 
    24102410        } 
    2411          
     2411 
    24122412        Item item = nonWikiSubmissionProperties.get(name); 
    2413         if (item == null) {     
     2413        if (item == null) { 
    24142414            item = createSubmissionProperty(clsName, name); 
    24152415            item.setAttribute("type", getPreferredSynonym(type)); 
    2416              
     2416 
    24172417            if (clsName.equals("DevelopmentalStage")) { 
    24182418                String ontologyTermId = getDevStageTerm(name); 
     
    24252425        return item; 
    24262426    } 
    2427      
     2427 
    24282428    private Item createSubmissionProperty(String clsName, String name) { 
    2429         Item subProp = getChadoDBConverter().createItem(clsName);         
    2430         if (name != null) {            
     2429        Item subProp = getChadoDBConverter().createItem(clsName); 
     2430        if (name != null) { 
    24312431            subProp.setAttribute("name", name); 
    24322432        } 
    2433          
     2433 
    24342434        return subProp; 
    24352435    } 
    2436      
    2437      
     2436 
     2437 
    24382438    private String getCorrectedOfficialName(SubmissionProperty prop) { 
    24392439        String preferredType = getPreferredSynonym(prop.type); 
     
    24482448            for (String lookup : makeLookupList(prop.type)) { 
    24492449                if (prop.details.containsKey(lookup)) { 
    2450                     name = prop.details.get(lookup).get(0);             
     2450                    name = prop.details.get(lookup).get(0); 
    24512451                } 
    24522452            } 
     
    24542454        return correctOfficialName(name, preferredType); 
    24552455    } 
    2456      
     2456 
    24572457    /** 
    24582458     * Unify variations on similar official names. 
     
    24652465            return null; 
    24662466        } 
    2467          
     2467 
    24682468        if (type.equals("developmental stage")) { 
    24692469            name = name.replace("_", " "); 
     
    24902490            if (name.matches(".*L\\d")) { 
    24912491                name = name + " stage larvae"; 
    2492             }             
     2492            } 
    24932493            if (name.matches("WPP.*")) { 
    24942494                name = name.replaceFirst("WPP", "White prepupae (WPP)"); 
    24952495            } 
    24962496        } 
    2497         return name;   
    2498     } 
    2499      
     2497        return name; 
     2498    } 
     2499 
    25002500 
    25012501 
    25022502    private String getDevStageTerm(String value) throws ObjectStoreException { 
    25032503        value = correctDevStageTerm(value); 
    2504          
     2504 
    25052505        String identifier = devStageTerms.get(value); 
    25062506        if (identifier == null) { 
    25072507            Item term = getChadoDBConverter().createItem("OntologyTerm"); 
    25082508            term.setAttribute("name", value); 
    2509             getChadoDBConverter().store(term);             
     2509            getChadoDBConverter().store(term); 
    25102510            devStageTerms.put(value, term.getIdentifier()); 
    25112511            identifier = term.getIdentifier(); 
     
    25232523    } 
    25242524 
    2525      
     2525 
    25262526    private Integer getSubmissionIdFromDccId(String dccId) { 
    25272527        for (Map.Entry<Integer, String> entry : dccIdMap.entrySet()) { 
     
    25442544 
    25452545        String sraAcc = "SRA acc"; 
    2546          
     2546 
    25472547        String query = "SELECT d.data_id, d.heading as data_heading," 
    25482548            + " d.name as data_name, d.value as data_value," 
     
    25842584    } 
    25852585 
    2586     private class SubmissionProperty  
     2586    private class SubmissionProperty 
    25872587    { 
    25882588        protected String type; 
     
    26042604            if (values == null) { 
    26052605                values = new ArrayList<String>(); 
    2606                 details.put(type, values);                
     2606                details.put(type, values); 
    26072607            } 
    26082608            values.add(value); 
     
    26142614    } 
    26152615 
    2616      
    2617     private class DatabaseRecordConfig  
     2616 
     2617    private class DatabaseRecordConfig 
    26182618    { 
    26192619        private Set<Pattern> patterns = new HashSet<Pattern>(); 
     
    26222622        private String dbURL; 
    26232623    } 
    2624      
     2624 
    26252625    private Set<DatabaseRecordConfig> initDatabaseRecordConfigs() { 
    26262626        Set<DatabaseRecordConfig> configs = new HashSet<DatabaseRecordConfig>(); 
     
    26452645        sra.dbName = "SRA"; 
    26462646        sra.dbDescrition = "Sequence Read Archive (NCBI)"; 
    2647         sra.dbURL =  
     2647        sra.dbURL = 
    26482648            "http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?cmd=viewer&m=data&s=viewer&run="; 
    26492649        p = Pattern.compile("SRA.*", Pattern.CASE_INSENSITIVE); 
     
    26542654    } 
    26552655 
    2656      
     2656 
    26572657    /** 
    26582658     * Query to get data attributes 
     
    27092709 
    27102710        Set<DatabaseRecordConfig> configs = initDatabaseRecordConfigs(); 
    2711          
     2711 
    27122712        for (Integer submissionId : submissionDataMap.keySet()) { 
    27132713            List<String> submissionDbRecords = new ArrayList<String>(); 
     
    27262726                if (!submissionDbRecords.isEmpty()) { 
    27272727                    ReferenceList col = new ReferenceList("databaseRecords", submissionDbRecords); 
    2728                     getChadoDBConverter().store(col,  
     2728                    getChadoDBConverter().store(col, 
    27292729                            submissionMap.get(submissionId).interMineObjectId); 
    27302730                } 
     
    27342734    } 
    27352735 
    2736      
    2737     private List<String> createDatabaseRecords(String accession, DatabaseRecordConfig config)  
     2736 
     2737    private List<String> createDatabaseRecords(String accession, DatabaseRecordConfig config) 
    27382738    throws ObjectStoreException { 
    27392739        List<String> dbRecordIds = new ArrayList<String>(); 
    27402740 
    27412741        Set<String> cleanAccessions = new HashSet<String>(); 
    2742          
     2742 
    27432743        // NOTE - this is a special case to deal with a very strange SRA accession format in some 
    27442744        // Celniker submissions.  The 'accession' is provided as e.g. 
    27452745        //   SRR013492.225322.1;SRR013492.462158.1;... 
    2746         // We just want the unique SRR ids         
     2746        // We just want the unique SRR ids 
    27472747        if (config.dbName.equals("SRA") && (accession.indexOf(';') != -1 
    27482748                || accession.indexOf('.') != -1)) { 
     
    27572757            cleanAccessions.add(accession); 
    27582758        } 
    2759          
     2759 
    27602760        for (String cleanAccession : cleanAccessions) { 
    27612761            dbRecordIds.add(createDatabaseRecord(cleanAccession, config)); 
     
    27632763        return dbRecordIds; 
    27642764    } 
    2765      
    2766      
    2767     private String createDatabaseRecord(String accession, DatabaseRecordConfig config)  
     2765 
     2766 
     2767    private String createDatabaseRecord(String accession, DatabaseRecordConfig config) 
    27682768    throws ObjectStoreException { 
    27692769        DatabaseRecordKey key = new DatabaseRecordKey(config.dbName, accession); 
     
    27732773            dbRecord.setAttribute("database", config.dbName); 
    27742774            dbRecord.setAttribute("description", config.dbDescrition); 
    2775             if (StringUtil.isEmpty(accession)) { 
     2775            if (StringUtils.isEmpty(accession)) { 
    27762776                dbRecord.setAttribute("accession", "To be confirmed"); 
    27772777            } else { 
     
    27862786        return dbRecordId; 
    27872787    } 
    2788      
    2789      
    2790     private class DatabaseRecordKey  
     2788 
     2789 
     2790    private class DatabaseRecordKey 
    27912791    { 
    27922792        private String db; 
    27932793        private String accession; 
    2794          
     2794 
    27952795        /** 
    27962796         * Construct with the database and accession 
     
    28022802            this.accession = accession; 
    28032803        } 
    2804          
     2804 
    28052805        /** 
    28062806         * {@inheritDoc} 
     
    28092809            if (o instanceof DatabaseRecordKey) { 
    28102810                DatabaseRecordKey otherKey = (DatabaseRecordKey) o; 
    2811                 if (!StringUtil.isEmpty(accession) && !StringUtil.isEmpty(otherKey.accession)) { 
    2812                     return this.db.equals(otherKey.db) && this.accession.equals(otherKey.accession);  
     2811                if (StringUtils.isNotEmpty(accession) 
     2812                        && StringUtils.isNotEmpty(otherKey.accession)) { 
     2813                    return this.db.equals(otherKey.db) 
     2814                    && this.accession.equals(otherKey.accession); 
    28132815                } 
    28142816            } 
    28152817            return false; 
    28162818        } 
    2817          
     2819 
    28182820        /** 
    28192821         * {@inheritDoc} 
     
    28232825        } 
    28242826    } 
    2825      
     2827 
    28262828    //sub -> prot 
    28272829    private void setSubmissionProtocolsRefs(Connection connection) 
     
    28412843            Integer thisSubmissionId = subs.next(); 
    28422844            List<Integer> protocolChadoIds = submissionProtocolMap.get(thisSubmissionId); 
    2843              
     2845 
    28442846            ReferenceList collection = new ReferenceList(); 
    28452847            collection.setName("protocols"); 
     
    28492851            Integer storedSubmissionId = submissionMap.get(thisSubmissionId).interMineObjectId; 
    28502852            getChadoDBConverter().store(collection, storedSubmissionId); 
    2851              
     2853 
    28522854            // may need protocols from referenced submissions to work out experiment type 
    28532855            protocolChadoIds.addAll(findProtocolIdsFromReferencedSubmissions(thisSubmissionId)); 
    2854              
     2856 
    28552857            String piName = submissionProjectMap.get(thisSubmissionId); 
    28562858            setSubmissionExperimentType(storedSubmissionId, protocolChadoIds, piName); 
     
    28742876        } 
    28752877    } 
    2876      
     2878 
    28772879    // Fetch protocols used to create reagents that are inputs to this submission, these are 
    28782880    // found in referenced submissions 
    28792881    private List<Integer> findProtocolIdsFromReferencedSubmissions(Integer submissionId) { 
    28802882        List<Integer> protocolIds = new ArrayList<Integer>(); 
    2881          
     2883 
    28822884        if (submissionRefs == null) { 
    28832885            throw new RuntimeException("Attempting to access submissionRefs before it has been" 
     
    28852887                    + " processSubmissionProperties"); 
    28862888        } 
    2887          
     2889 
    28882890        SubmissionReference subRef = submissionRefs.get(submissionId); 
    28892891        if (subRef != null) { 
     
    28922894            } 
    28932895        } 
    2894          
     2896 
    28952897        return protocolIds; 
    28962898    } 
    2897      
    2898     /**  
     2899 
     2900    /** 
    28992901     * Work out an experiment type give the combination of protocols used for the 
    29002902     * submussion.  e.g. *immunoprecipitation + hybridization = chIP-chip 
    29012903     * @param protocolTypes the protocal types 
     2904     * @param piName name of PI 
    29022905     * @return a short experiment type 
    29032906     */ 
     
    29152918            } 
    29162919        } 
    2917          
     2920 
    29182921        // reverse transcription + PCR + RACE = RACE 
    29192922        // reverse transcription + PCR - RACE = RTPCR 
     
    29262929            } 
    29272930        } 
    2928          
     2931 
    29292932        // ChIP + hybridization = ChIP-chip 
    29302933        // ChIP - hybridization = ChIP-seq 
     
    29342937            } else { 
    29352938                return "ChIP-seq"; 
    2936             }            
    2937         } 
    2938          
     2939            } 
     2940        } 
     2941 
    29392942        // hybridization - ChIP = 
    29402943        //    Celniker:  RNA tiling array 
     
    29522955 
    29532956        } 
    2954          
     2957 
    29552958        // annotation = Computational annotation 
    29562959        if (containsMatch(protocolTypes, "annotation")) { 
    29572960            return "Computational annotation"; 
    29582961        } 
    2959          
     2962 
    29602963        // If we haven't found a type yet, and there is a growth protocol, then 
    29612964        // this is probably an RNA sample creation experiment from Celniker 
     
    29632966            return "RNA sample creation"; 
    29642967        } 
    2965          
     2968 
    29662969        return null; 
    29672970    } 
    2968      
     2971 
    29692972    // utility method for looking up in a set by regular expression 
    29702973    private boolean containsMatch(Set<String> testSet, String regex) { 
     
    29792982        return matches; 
    29802983    } 
    2981      
     2984 
    29822985    //sub -> exp 
    29832986    private void setSubmissionExperimetRefs(Connection connection) 
     
    30303033            } 
    30313034        } 
    3032         LOG.info("TIME setting submission-exFactors references: "  
     3035        LOG.info("TIME setting submission-exFactors references: " 
    30333036                + (System.currentTimeMillis() - bT)); 
    30343037    } 
     
    30503053                    submissionMap.get(thisSubmissionId).interMineObjectId); 
    30513054            } 
    3052         LOG.info("TIME setting submission-publication references: "  
     3055        LOG.info("TIME setting submission-publication references: " 
    30533056                + (System.currentTimeMillis() - bT)); 
    30543057    } 
    30553058 
    3056      
    3057      
    3058      
     3059 
     3060 
     3061 
    30593062 
    30603063    /** 
     
    30883091            } 
    30893092        } 
    3090         LOG.info("TIME setting DAG references: " + (System.currentTimeMillis() - bT));         
     3093        LOG.info("TIME setting DAG references: " + (System.currentTimeMillis() - bT)); 
    30913094    } 
    30923095 
     
    31933196        dataSubmissionMap.put(dataId, submissionId); 
    31943197    } 
    3195      
     3198 
    31963199    /** 
    31973200     * ===================== 
     
    31993202     * ===================== 
    32003203     */ 
    3201      
     3204 
    32023205    /** 
    32033206     * method to wrap the execution of a query, without log info 
     
    32333236    } 
    32343237 
    3235      
     3238 
    32363239    /** 
    32373240     * adds an element to a list which is the value of a map 
     
    32713274        } 
    32723275    } 
    3273      
    3274      
     3276 
     3277 
    32753278    /** 
    32763279     * adds an element to a list which is the value of a map 
  • trunk/bio/sources/chado-db/main/src/org/intermine/bio/dataconversion/WormBaseProcessor.java

    r20655 r20738  
    1717import org.apache.commons.collections.keyvalue.MultiKey; 
    1818import org.apache.commons.collections.map.MultiKeyMap; 
     19import org.apache.commons.lang.StringUtils; 
    1920import org.apache.log4j.Logger; 
    2021import org.intermine.bio.chado.config.ConfigAction; 
    2122import org.intermine.bio.chado.config.SetFieldConfigAction; 
    2223import org.intermine.objectstore.ObjectStoreException; 
    23 import org.intermine.util.StringUtil; 
    2424import org.intermine.xml.full.Item; 
    2525 
     
    5050        return itemId; 
    5151    } 
    52      
     52 
    5353    /** 
    5454     * Method to add dataSets and DataSources to items before storing 
     
    7878                                     converter.getDataSourceItem().getIdentifier()); 
    7979    } 
    80      
    81      
     80 
    8281    /** 
    8382     * {@inheritDoc} 
     
    132131    @Override 
    133132    protected String fixIdentifier(FeatureData fdat, String identifier) { 
    134          
     133 
    135134        String uniqueName = fdat.getChadoFeatureUniqueName(); 
    136135        String type = fdat.getInterMineType(); 
    137136 
    138         // the function is used without check for null only for uniquename and name  
     137        // the function is used without check for null only for uniquename and name 
    139138        // in SequenceProcessor. 
    140139        // so we assume that uniquename is never null and that if null it is a name. 
    141         if (StringUtil.isEmpty(identifier)) { 
     140        if (StringUtils.isEmpty(identifier)) { 
    142141                identifier = uniqueName; 
    143142                LOG.debug("Found NULL name for feature: " + uniqueName); 
    144             }  
    145          
     143            } 
     144 
    146145        if (identifier.startsWith(type + ":")) { 
    147146            return identifier.substring(type.length() + 1); 
    148         } else { 
    149             return identifier; 
    150147        } 
     148        return identifier; 
    151149    } 
    152      
     150 
    153151    /** 
    154152     * Wormbase chado has pmid prefixed to pubmed identifiers 
    155      * @param string pubmed id fetched from databaase 
     153     * @param pubmedStr id fetched from databaase 
    156154     * @return the pubmed id 
    157155     */ 
  • trunk/bio/sources/flymine/flyatlas/main/src/org/intermine/bio/dataconversion/FlyAtlasConverter.java

    r20462 r20738  
    2222import org.intermine.objectstore.ObjectStoreException; 
    2323import org.intermine.util.FormattedTextParser; 
    24 import org.intermine.util.StringUtil; 
    2524import org.intermine.xml.full.Item; 
    2625 
     
    6766                String probeId = line[0]; 
    6867                // there seems to be some empty lines at the end of the file 
    69                 if (StringUtil.isEmpty(probeId)) { 
     68                if (StringUtils.isEmpty(probeId)) { 
    7069                    break; 
    7170                } 
  • trunk/intermine/integrate/main/src/org/intermine/xml/full/Item.java

    r20462 r20738  
    1919import java.util.Set; 
    2020 
     21import org.apache.commons.lang.StringUtils; 
    2122import org.intermine.metadata.ClassDescriptor; 
    2223import org.intermine.metadata.Model; 
     
    414415     */ 
    415416    public void addToCollection(String name, String refId) { 
    416         if (StringUtil.isEmpty(refId)) { 
     417        if (StringUtils.isEmpty(refId)) { 
    417418            throw new RuntimeException("empty string added to collection for: " + name); 
    418419        } 
     
    613614 
    614615                for (String clsName : bits) { 
    615                     if (!StringUtil.isEmpty(clsName)) { 
     616                    if (!StringUtils.isEmpty(clsName)) { 
    616617                        implementationClassDescriptors.add(getClassDescriptorByName(clsName)); 
    617618                    } 
  • trunk/intermine/objectstore/main/src/org/intermine/util/StringUtil.java

    r20669 r20738  
    462462        } 
    463463        return "a"; 
    464     } 
    465  
    466  
    467     /** 
    468      * Returns true if the given String is null or the empty String. 
    469      * 
    470      * @param str checked string 
    471      * @return true if string is null or empty 
    472      */ 
    473     public static boolean isEmpty(String str) { 
    474         if (str == null) { 
    475             return true; 
    476         } 
    477         return str.length() == 0; 
    478464    } 
    479465 
  • trunk/intermine/pathquery/main/src/org/intermine/pathquery/PathQuery.java

    r20593 r20738  
    2727import java.util.regex.Pattern; 
    2828 
     29import org.apache.commons.lang.StringUtils; 
    2930import org.apache.log4j.Logger; 
    3031import org.intermine.metadata.ClassDescriptor; 
     
    3536import org.intermine.objectstore.query.ConstraintOp; 
    3637import org.intermine.util.CollectionUtil; 
    37 import org.intermine.util.StringUtil; 
    3838 
    3939/** 
     
    820820        } 
    821821        for (Iterator<String> iter = codes.iterator(); iter.hasNext(); ) { 
    822             if (!StringUtil.isEmpty(logic)) { 
     822            if (StringUtils.isNotEmpty(logic)) { 
    823823                logic += " " + operator + " "; 
    824824            } 
  • trunk/intermine/web/main/src/org/intermine/web/logic/session/SessionMethods.java

    r20593 r20738  
    446446 
    447447    /** 
    448      * Get the COLLAPSED map from the session. If the attribute is not present then a new 
    449      * map will be created. 
    450      * 
    451      * @param session the curren session 
    452      * @return the COLLAPSED map attribute 
    453      */ 
    454     public static Map getCollapsedMap(HttpSession session) { 
    455         Map collapsed = (Map) session.getAttribute(Constants.COLLAPSED); 
    456         if (collapsed == null) { 
    457             collapsed = new HashMap(); 
    458             session.setAttribute(Constants.COLLAPSED, collapsed); 
    459         } 
    460         return collapsed; 
    461     } 
    462  
    463     /** 
    464448     * Return the displayObjects Map from the session or create and return it if it doesn't exist. 
    465449     * 
  • trunk/intermine/web/main/src/org/intermine/web/struts/HtmlHeadController.java

    r20462 r20738  
    1515import javax.servlet.http.HttpSession; 
    1616 
     17import org.apache.commons.lang.StringUtils; 
    1718import org.apache.log4j.Logger; 
    1819import org.apache.struts.action.ActionForm; 
     
    2930import org.intermine.objectstore.ObjectStore; 
    3031import org.intermine.util.DynamicUtil; 
    31 import org.intermine.util.StringUtil; 
    3232import org.intermine.web.logic.results.DisplayObject; 
    3333import org.intermine.web.logic.results.DisplayObjectFactory; 
     
    5454     * @exception Exception if an error occurs 
    5555     */ 
    56     public ActionForward execute(@SuppressWarnings("unused") ComponentContext context, 
    57                                  @SuppressWarnings("unused") ActionMapping mapping, 
    58                                  @SuppressWarnings("unused") ActionForm form, 
     56    public ActionForward execute(ComponentContext context, 
     57                                 ActionMapping mapping, 
     58                                 ActionForm form, 
    5959                                 HttpServletRequest request, 
    60                                  @SuppressWarnings("unused") HttpServletResponse response) 
     60                                 HttpServletResponse response) 
    6161        throws Exception { 
    6262 
     
    116116                return null; 
    117117            } 
    118             DisplayObject dobj = (DisplayObject) displayObjects.get(object); 
     118            DisplayObject dobj = displayObjects.get(object); 
    119119 
    120120            String className = DynamicUtil.getFriendlyName(dobj.getObject().getClass()); 
     
    133133 
    134134            // TODO use the class keys instead of hardcoding which fields should be used 
    135             if (StringUtil.isEmpty(idForPageTitle) 
     135            if (StringUtils.isEmpty(idForPageTitle) 
    136136                            && dobj.getAttributes().get("secondaryIdentifier") != null) { 
    137137                idForPageTitle = dobj.getAttributes().get("secondaryIdentifier").toString(); 
    138138            } 
    139             if (StringUtil.isEmpty(idForPageTitle) 
     139            if (StringUtils.isEmpty(idForPageTitle) 
    140140                            && dobj.getAttributes().get("identifier") != null) { 
    141141                idForPageTitle = dobj.getAttributes().get("identifier").toString(); 
    142142            } 
    143             if (StringUtil.isEmpty(idForPageTitle) 
     143            if (StringUtils.isEmpty(idForPageTitle) 
    144144                            && dobj.getAttributes().get("symbol") != null) { 
    145145                idForPageTitle = dobj.getAttributes().get("symbol").toString(); 
    146146            } 
    147147 
    148             if (!StringUtil.isEmpty(idForPageTitle)) { 
     148            if (StringUtils.isNotEmpty(idForPageTitle)) { 
    149149                htmlPageTitle = className + " report for " + idForPageTitle; 
    150150            } 
Note: See TracChangeset for help on using the changeset viewer.