Changeset 16255

Show
Ignore:
Timestamp:
18/07/08 10:13:09 (1 month ago)
Author:
julie
Message:

revert change [16242]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bio/sources/biogrid/main/src/org/intermine/bio/dataconversion/BioGridConverter.java

    r16242 r16255  
    2121import java.util.Stack; 
    2222 
    23 import org.apache.commons.lang.StringUtils; 
    2423import org.apache.log4j.Logger; 
    2524import org.intermine.dataconversion.ItemWriter; 
     
    4746    private static Map<String, String> masterList = new HashMap<String, String>(); 
    4847    protected IdResolverFactory resolverFactory; 
    49     private Map<String, Item> synonyms = new HashMap<String, Item>(); 
    5048 
    5149    /** 
     
    191189                        String identifier = attrs.getValue("id"); 
    192190                        geneIdsToIdentifiers.put(geneId, identifier); 
    193                         try { 
    194                             getGene(organismTaxonId, identifier); 
    195                         } catch (ObjectStoreException e) { 
    196                             throw new RuntimeException("error while storing: " + identifier, e); 
    197                         } 
     191                        getGene(organismTaxonId, identifier); 
    198192                    } 
    199193                } 
     
    316310                        Item gene = null; 
    317311                        if (identifier != null) { 
    318                             try { 
    319                                 gene = getGene(organismTaxonId, identifier); 
    320                             } catch (ObjectStoreException e) { 
    321                                 throw new RuntimeException("error while storing: " 
    322                                                            + identifier, e); 
    323                             } 
     312                            gene = getGene(organismTaxonId, identifier); 
    324313                        } 
    325314                        if (gene != null) { 
     
    461450        } 
    462451 
    463         private Item getGene(String taxonId, String id) throws ObjectStoreException
     452        private Item getGene(String taxonId, String id)
    464453            String identifier = id; 
    465454            // for Drosophila attempt to update to a current gene identifier 
     
    480469                item.setAttribute("primaryIdentifier", identifier); 
    481470                genes.put(identifier, item); 
    482                 createSynonym(item.getIdentifier(), "identifier", identifier); 
    483471            } 
    484472            return item; 
     
    647635        } 
    648636    } 
    649     private Item createSynonym(String subjectId, String type, String value) 
    650     throws ObjectStoreException { 
    651         String key = subjectId + type + value; 
    652         if (StringUtils.isEmpty(value)) { 
    653             return null; 
    654         } 
    655         if (!synonyms.containsKey(key)) { 
    656             Item syn = createItem("Synonym"); 
    657             syn.setReference("subject", subjectId); 
    658             syn.setAttribute("type", type); 
    659             syn.setAttribute("value", value); 
    660             synonyms.put(key, syn); 
    661             store(syn); 
    662             return syn; 
    663         } 
    664         return null; 
    665     } 
    666  
    667637} 
  • trunk/bio/sources/biogrid/test/resources/BioGridConverterTest_tgt.xml

    r16242 r16255  
    55  <item id="4_1" class="http://www.flymine.org/model/genomic#Gene"> 
    66    <attribute name="primaryIdentifier" value="FBgn001"/> 
    7     <reference name="organism" ref_id="6_1"/> 
     7    <reference name="organism" ref_id="5_1"/> 
    88    <collection name="dataSets"><reference ref_id="1_1"/></collection> 
    99  </item> 
    10   <item id="7_1" class="http://www.flymine.org/model/genomic#GeneticInteraction"> 
     10  <item id="6_1" class="http://www.flymine.org/model/genomic#GeneticInteraction"> 
    1111    <attribute name="geneRole" value="bait"/> 
    1212    <attribute name="shortName" value="FBgn0000001_FBgn0000002"/> 
     
    1717    <collection name="interactingGenes"><reference ref_id="4_2"/></collection> 
    1818  </item> 
    19   <item id="7_2" class="http://www.flymine.org/model/genomic#GeneticInteraction"> 
     19  <item id="6_2" class="http://www.flymine.org/model/genomic#GeneticInteraction"> 
    2020    <attribute name="geneRole" value="prey"/> 
    2121    <attribute name="shortName" value="FBgn0000002_FBgn0000001"/> 
     
    3131  <item id="4_2" class="http://www.flymine.org/model/genomic#Gene"> 
    3232    <attribute name="primaryIdentifier" value="FBgn002"/> 
    33     <reference name="organism" ref_id="6_1"/> 
     33    <reference name="organism" ref_id="5_1"/> 
    3434    <collection name="dataSets"><reference ref_id="1_1"/></collection> 
    3535  </item> 
     
    3838    <reference name="dataSource" ref_id="0_1"/> 
    3939  </item> 
    40   <item id="6_1" class="http://www.flymine.org/model/genomic#Organism"> 
     40  <item id="5_1" class="http://www.flymine.org/model/genomic#Organism"> 
    4141    <attribute name="taxonId" value="7227"/> 
    4242  </item> 
     
    4646    <reference name="publication" ref_id="3_1"/> 
    4747  </item> 
    48   <item id="5_1" class="http://www.flymine.org/model/genomic#Synonym"> 
    49 <attribute name="type" value="identifier"/> 
    50 <attribute name="value" value="FBgn001"/> 
    51 <reference name="source" ref_id="0_1"/> 
    52 <reference name="subject" ref_id="4_1"/> 
    53 <collection name="dataSets"><reference ref_id="1_1"/></collection> 
    54 </item> 
    55 <item id="5_2" class="http://www.flymine.org/model/genomic#Synonym"> 
    56 <attribute name="type" value="identifier"/> 
    57 <attribute name="value" value="FBgn002"/> 
    58 <reference name="source" ref_id="0_1"/> 
    59 <reference name="subject" ref_id="4_2"/> 
    60 <collection name="dataSets"><reference ref_id="1_1"/></collection> 
    61 </item> 
    6248</items>