Changeset 16246
- Timestamp:
- 17/07/08 10:26:44 (1 month ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bio/sources/pdb/main/src/org/intermine/bio/dataconversion/PdbConverter.java
r16245 r16246 20 20 import java.util.Map; 21 21 22 import org.apache.commons.lang.StringUtils; 22 23 import org.apache.log4j.Logger; 23 24 import org.biojava.bio.structure.Structure; … … 37 38 private static final Logger LOG = Logger.getLogger(PdbConverter.class); 38 39 protected static final String ENDL = System.getProperty("line.separator"); 40 private Map<String, String> synonyms = new HashMap(); 39 41 40 42 /** … … 68 70 for (String accnum: dbrefs) { 69 71 Item protein = getAndStoreItemOnce("Protein", "primaryAccession", accnum); 72 createSynonym(protein.getIdentifier(), "accession", accnum); 70 73 proteins.add(protein.getIdentifier()); 71 74 } … … 98 101 } 99 102 } 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 100 121 101 122 /** trunk/bio/sources/pdb/resources/pdb_keys.properties
r13341 r16246 2 2 DataSet=key_title 3 3 DataSource=key_name 4 Synonym=key_synonym trunk/bio/sources/pdb/test/resources/PdbConverterTest_tgt.xml
r16245 r16246 25 25 <attribute name="name" value="PDB"/> 26 26 </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> 27 41 </items>
