- /**
- * Reads a file containing the reply to the EBI Fetch Uniprot data query,
- * unmarshals it to a UniprotFile object, and returns the list of UniprotEntry
- * data models (mapped from <entry> elements)
- *
- * @param fileReader
- * @return
- */
- public Vector<UniprotEntry> getUniprotEntries(Reader fileReader)
- {
- UniprotFile uni = new UniprotFile();
- try
- {
- if (map == null)
- {
- // 1. Load the mapping information from the file
- map = new Mapping(uni.getClass().getClassLoader());
- URL url = getClass().getResource("/uniprot_mapping.xml");
- map.loadMapping(url);
- }
-
- // 2. Unmarshal the data
- Unmarshaller unmar = new Unmarshaller(uni);
- unmar.setIgnoreExtraElements(true);
- unmar.setMapping(map);
- if (fileReader != null)
- {
- uni = (UniprotFile) unmar.unmarshal(fileReader);
- }
- } catch (Exception e)
- {
- System.out.println("Error getUniprotEntries() " + e);
- }
-
- return uni.getUniprotEntries();
- }
-