Changeset 20743


Ignore:
Timestamp:
26/02/10 20:56:12 (2 years ago)
Author:
rns
Message:

Add some workarounds for broken DAG structure, check for adding null submissionIds to subToTypes map.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bio/sources/chado-db/main/src/org/intermine/bio/dataconversion/ModEncodeMetaDataProcessor.java

    r20738 r20743  
    521521    private void setAppliedProtocolSteps(Connection connection) 
    522522    throws ObjectStoreException { 
    523         Iterator<Integer> ap = appliedProtocolMap.keySet().iterator(); 
    524         while (ap.hasNext()) { 
    525             Integer thisAPId = ap.next(); 
    526             Attribute attr = new Attribute(); 
    527             attr.setName("step"); 
    528             attr.setValue(appliedProtocolMap.get(thisAPId).step.toString()); 
    529  
    530             getChadoDBConverter().store(attr, 
    531                     appliedProtocolIdMap.get(thisAPId)); 
     523        for (Integer appliedProtocolId : appliedProtocolMap.keySet()) { 
     524            Integer step = appliedProtocolMap.get(appliedProtocolId).step; 
     525            if (step != null) { 
     526                Attribute attr = new Attribute("step", step.toString()); 
     527                getChadoDBConverter().store(attr, appliedProtocolIdMap.get(appliedProtocolId)); 
     528            } else { 
     529                AppliedProtocol ap = appliedProtocolMap.get(appliedProtocolId); 
     530                LOG.warn("AppliedProtocol.step not set for chado id: " + appliedProtocolId 
     531                        + " sub " + ap.submissionId + " inputs " + ap.inputs + " outputs "  
     532                        + ap.outputs); 
     533            } 
    532534        } 
    533535    } 
     
    16461648                    + comma + attValue + comma + attDbxref + System.getProperty("line.separator")); 
    16471649 
     1650            if (submissionId == null) { 
     1651                LOG.warn("Failed to find a submission id for data id " + dataId + " - this probably" 
     1652                        + " means there is a problem with the applied_protocol DAG strucuture."); 
     1653                continue; 
     1654            } 
     1655             
    16481656            // Currently using attValue for referenced submission DCC id, should be dbUrl but seems 
    16491657            // to be filled in incorrectly 
     
    16571665                        new SubmissionReference(referencedSubId, wikiPageUrl); 
    16581666                    submissionRefs.put(submissionId, subRef); 
     1667                    LOG.info("Submission " + dccId + " (" + submissionId + ") has reference to " 
     1668                            + attValue + " (" + referencedSubId + ")"); 
     1669                } else { 
     1670                    LOG.warn("Could not find submission " + attValue + " referenced by " + dccId); 
    16591671                } 
    16601672            } 
     
    19181930            Integer submissionId, SubmissionProperty prop) { 
    19191931     // submissionId -> [type -> SubmissionProperty] 
     1932        if (submissionId == null) { 
     1933            throw new RuntimeException("Called addToSubToTypes with a null sub id!"); 
     1934        } 
     1935         
    19201936        Map<String, List<SubmissionProperty>> typeToSubProp = subToTypes.get(submissionId); 
    19211937        if (typeToSubProp == null) { 
Note: See TracChangeset for help on using the changeset viewer.