Changeset 16231
- Timestamp:
- 15/07/08 15:43:01 (1 month ago)
- Files:
-
- trunk/bio/sources/miranda/resources/miranda_keys.properties (modified) (1 diff)
- trunk/bio/sources/pdb/.classpath (modified) (1 diff)
- trunk/bio/sources/pdb/main/src/org/intermine/bio/dataconversion/PdbConverter.java (modified) (7 diffs)
- trunk/bio/sources/pdb/test/resources/PdbConverterTest_tgt.xml (modified) (2 diffs)
- trunk/bio/sources/pdb/test/src/org/intermine/bio/dataconversion/PdbConverterTest.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bio/sources/miranda/resources/miranda_keys.properties
r16228 r16231 1 1 Gene=key_primaryidentifier 2 Transcript=key_secondaryidentifier 2 3 Organism=key_taxonid 3 4 DataSet=key_title trunk/bio/sources/pdb/.classpath
r13398 r16231 11 11 <classpathentry combineaccessrules="false" kind="src" path="/intermine-objectstore-main"/> 12 12 <classpathentry combineaccessrules="false" kind="src" path="/intermine-objectstore-test"/> 13 <classpathentry kind="lib" path="test/resources"/> 13 14 <classpathentry kind="output" path="bin"/> 14 15 </classpath> trunk/bio/sources/pdb/main/src/org/intermine/bio/dataconversion/PdbConverter.java
r15949 r16231 16 16 import java.io.Reader; 17 17 import java.util.ArrayList; 18 import java.util.HashMap; 18 19 import java.util.List; 20 import java.util.Map; 19 21 22 import org.apache.commons.lang.StringUtils; 20 23 import org.apache.log4j.Logger; 21 24 import org.biojava.bio.structure.Structure; … … 23 26 import org.intermine.dataconversion.ItemWriter; 24 27 import org.intermine.metadata.Model; 25 import org.intermine.objectstore.ObjectStoreException;26 28 import org.intermine.xml.full.Item; 29 27 30 28 31 /** … … 35 38 private static final Logger LOG = Logger.getLogger(PdbConverter.class); 36 39 protected static final String ENDL = System.getProperty("line.separator"); 40 private Map<String, String> synonyms = new HashMap(); 37 41 38 42 /** … … 40 44 * @param writer the ItemWriter to store the objects in 41 45 * @param model the Model 42 * @throws ObjectStoreException if there is a problem while storing43 46 */ 44 public PdbConverter(ItemWriter writer, Model model) throws ObjectStoreException{47 public PdbConverter(ItemWriter writer, Model model) { 45 48 super(writer, model, "PDB", "PDB dmel data set"); 46 49 } … … 62 65 String idCode = (String) structure.getHeader().get("idCode"); 63 66 proteinStructure.setAttribute("identifier", idCode); 67 68 createSynonym(proteinStructure.getIdentifier(), "identifier", idCode); 64 69 65 70 List<String> proteins = new ArrayList<String>(); … … 87 92 if (resolution instanceof Float) { 88 93 final Float resolutionFloat = (Float) structure.getHeader().get("resolution"); 89 proteinStructure.setAttribute("resolution", Float.toString(resolutionFloat)); 94 proteinStructure.setAttribute("resolution", 95 Float.toString(resolutionFloat.floatValue())); 90 96 } 91 97 … … 95 101 store(proteinStructure); 96 102 } 103 } 104 105 private Item createSynonym(String subjectId, String type, String value) throws Exception { 106 String key = subjectId + type + value; 107 if (StringUtils.isEmpty(value)) { 108 return null; 109 } 110 if (!synonyms.containsKey(key)) { 111 Item syn = createItem("Synonym"); 112 syn.setReference("subject", subjectId); 113 syn.setAttribute("type", type); 114 syn.setAttribute("value", value); 115 store(syn); 116 synonyms.put(key, syn.getIdentifier()); 117 return syn; 118 } 119 return null; 97 120 } 98 121 trunk/bio/sources/pdb/test/resources/PdbConverterTest_tgt.xml
r15816 r16231 1 1 <items> 2 <item id="1_1" class="http://www.flymine.org/model/genomic#DataSet">3 <attribute name="title" value="PDB data - dmel"/>4 <attribute name="url" value="http://www.rcsb.org/pdb/"/>5 </item>6 <item id=" 3_2" class="http://www.flymine.org/model/genomic#Protein">2 <item id="1_1" class="http://www.flymine.org/model/genomic#DataSet"> 3 <attribute name="title" value="PDB dmel data set"/> 4 <reference name="dataSource" ref_id="0_1"/> 5 </item> 6 <item id="4_2" class="http://www.flymine.org/model/genomic#Protein"> 7 7 <attribute name="primaryAccession" value="P26675"/> 8 <collection name="dataSets"><reference ref_id="1_1"/></collection> 8 9 </item> 9 10 <item id="2_1" class="http://www.flymine.org/model/genomic#ProteinStructure"> … … 15 16 <attribute name="title" value="NMR STRUCTURE OF THE COMPLEX BETWEEN THE C32S-Y7V MUTANT OF THE NSH3 DOMAIN OF GRB2 WITH A PEPTIDE FROM SOS, 10 STRUCTURES "/> 16 17 <collection name="dataSets"><reference ref_id="1_1"/></collection> 17 <collection name="proteins"><reference ref_id=" 3_1"/><reference ref_id="3_2"/></collection>18 <collection name="proteins"><reference ref_id="4_1"/><reference ref_id="4_2"/></collection> 18 19 </item> 19 <item id=" 3_1" class="http://www.flymine.org/model/genomic#Protein">20 <item id="4_1" class="http://www.flymine.org/model/genomic#Protein"> 20 21 <attribute name="primaryAccession" value="P29354"/> 22 <collection name="dataSets"><reference ref_id="1_1"/></collection> 21 23 </item> 24 <item id="0_1" class="http://www.flymine.org/model/genomic#DataSource"> 25 <attribute name="name" value="PDB"/> 26 </item> 27 <item id="3_1" class="http://www.flymine.org/model/genomic#Synonym"> 28 <attribute name="type" value="identifier"/> 29 <attribute name="value" value="1AZE"/> 30 <reference name="source" ref_id="0_1"/> 31 <reference name="subject" ref_id="2_1"/> 32 <collection name="dataSets"><reference ref_id="1_1"/></collection> 33 </item> 22 34 </items> trunk/bio/sources/pdb/test/src/org/intermine/bio/dataconversion/PdbConverterTest.java
r14641 r16231 48 48 converter.close(); 49 49 // uncomment to create a new target items files 50 // writeItemsFile(itemWriter.getItems(), "PdbConverterTest_tgt.xml");50 //writeItemsFile(itemWriter.getItems(), "PdbConverterTest_tgt.xml"); 51 51 Set expected = readItemSet("PdbConverterTest_tgt.xml"); 52 52 assertEquals(expected, itemWriter.getItems());
