/** * The Uniprot mappings to other database identifiers for this sequence * * @return * @throws Exception */ public LinkedHashMap<String, ArrayList<DBReferenceInfo>> getDatabaseReferences() throws Exception { LinkedHashMap<String, ArrayList<DBReferenceInfo>> databaseReferencesHashMap = new LinkedHashMap<String, ArrayList<DBReferenceInfo>>(); if (uniprotDoc == null) { return databaseReferencesHashMap; } Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); ArrayList<Element> dbreferenceElementList = XMLHelper.selectElements(entryElement, "dbReference"); for (Element element : dbreferenceElementList) { String type = element.getAttribute("type"); String id = element.getAttribute("id"); ArrayList<DBReferenceInfo> idlist = databaseReferencesHashMap.get(type); if (idlist == null) { idlist = new ArrayList<DBReferenceInfo>(); databaseReferencesHashMap.put(type, idlist); } DBReferenceInfo dbreferenceInfo = new DBReferenceInfo(type, id); ArrayList<Element> propertyElementList = XMLHelper.selectElements(element, "property"); for (Element propertyElement : propertyElementList) { String propertyType = propertyElement.getAttribute("type"); String propertyValue = propertyElement.getAttribute("value"); dbreferenceInfo.addProperty(propertyType, propertyValue); } idlist.add(dbreferenceInfo); } return databaseReferencesHashMap; }
/** * Pull uniprot key words which is a mixed bag of words associated with this sequence * * @return * @throws Exception */ public ArrayList<String> getKeyWords() throws Exception { ArrayList<String> keyWordsList = new ArrayList<String>(); if (uniprotDoc == null) { return keyWordsList; } Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); ArrayList<Element> keyWordElementList = XMLHelper.selectElements(entryElement, "keyword"); for (Element element : keyWordElementList) { keyWordsList.add(element.getTextContent()); } return keyWordsList; }