Changeset 16246

Show
Ignore:
Timestamp:
17/07/08 10:26:44 (1 month ago)
Author:
julie
Message:

for PDB, set synonym for protein

Files:

Legend:

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

    r16245 r16246  
    2020import java.util.Map; 
    2121 
     22import org.apache.commons.lang.StringUtils; 
    2223import org.apache.log4j.Logger; 
    2324import org.biojava.bio.structure.Structure; 
     
    3738    private static final Logger LOG = Logger.getLogger(PdbConverter.class); 
    3839    protected static final String ENDL = System.getProperty("line.separator"); 
     40    private Map<String, String> synonyms = new HashMap(); 
    3941 
    4042    /** 
     
    6870            for (String accnum: dbrefs) { 
    6971                Item protein = getAndStoreItemOnce("Protein", "primaryAccession", accnum); 
     72                createSynonym(protein.getIdentifier(), "accession", accnum); 
    7073                proteins.add(protein.getIdentifier()); 
    7174            } 
     
    98101        } 
    99102    } 
     103 
     104    private Item createSynonym(String subjectId, String type, String value) throws Exception { 
     105        String key = subjectId + type + value; 
     106        if (StringUtils.isEmpty(value)) { 
     107            return null; 
     108        } 
     109        if (!synonyms.containsKey(key)) { 
     110            Item syn = createItem("Synonym"); 
     111            syn.setReference("subject", subjectId); 
     112            syn.setAttribute("type", type); 
     113            syn.setAttribute("value", value); 
     114            store(syn); 
     115            synonyms.put(key, syn.getIdentifier()); 
     116            return syn; 
     117        } 
     118        return null; 
     119    } 
     120 
    100121 
    101122    /** 
  • trunk/bio/sources/pdb/resources/pdb_keys.properties

    r13341 r16246  
    22DataSet=key_title 
    33DataSource=key_name 
     4Synonym=key_synonym 
  • trunk/bio/sources/pdb/test/resources/PdbConverterTest_tgt.xml

    r16245 r16246  
    2525<attribute name="name" value="PDB"/> 
    2626</item> 
     27<item id="4_1" class="http://www.flymine.org/model/genomic#Synonym"> 
     28<attribute name="type" value="accession"/> 
     29<attribute name="value" value="P29354"/> 
     30<reference name="source" ref_id="0_1"/> 
     31<reference name="subject" ref_id="3_1"/> 
     32<collection name="dataSets"><reference ref_id="1_1"/></collection> 
     33</item> 
     34<item id="4_2" class="http://www.flymine.org/model/genomic#Synonym"> 
     35<attribute name="type" value="accession"/> 
     36<attribute name="value" value="P26675"/> 
     37<reference name="source" ref_id="0_1"/> 
     38<reference name="subject" ref_id="3_2"/> 
     39<collection name="dataSets"><reference ref_id="1_1"/></collection> 
     40</item> 
    2741</items>