@@ -337,10 +337,21 @@ public ArrayList<AccessionID> getAccessions() throws XPathExpressionException {
337337
338338 /**
339339 * Pull uniprot protein aliases associated with this sequence
340+ * Provided for backwards compatibility now that we support both
341+ * gene and protein aliases via separate methods.
340342 * @return
341343 * @throws XPathExpressionException
342344 */
343345 public ArrayList <String > getAliases () throws XPathExpressionException {
346+
347+ return getProteinAliases ();
348+ }
349+ /**
350+ * Pull uniprot protein aliases associated with this sequence
351+ * @return
352+ * @throws XPathExpressionException
353+ */
354+ public ArrayList <String > getProteinAliases () throws XPathExpressionException {
344355 ArrayList <String > aliasList = new ArrayList <String >();
345356 if (uniprotDoc == null ) {
346357 return aliasList ;
@@ -353,6 +364,32 @@ public ArrayList<String> getAliases() throws XPathExpressionException {
353364 Element fullNameElement = XMLHelper .selectSingleElement (element , "fullName" );
354365 aliasList .add (fullNameElement .getTextContent ());
355366 }
367+ keyWordElementList = XMLHelper .selectElements (proteinElement , "recommendedName" );
368+ for (Element element : keyWordElementList ) {
369+ Element fullNameElement = XMLHelper .selectSingleElement (element , "fullName" );
370+ aliasList .add (fullNameElement .getTextContent ());
371+ }
372+
373+ return aliasList ;
374+ }
375+
376+ /**
377+ * Pull uniprot gene aliases associated with this sequence
378+ * @return
379+ * @throws XPathExpressionException
380+ */
381+ public ArrayList <String > getGeneAliases () throws XPathExpressionException {
382+ ArrayList <String > aliasList = new ArrayList <String >();
383+ if (uniprotDoc == null ) {
384+ return aliasList ;
385+ }
386+ Element uniprotElement = uniprotDoc .getDocumentElement ();
387+ Element entryElement = XMLHelper .selectSingleElement (uniprotElement , "entry" );
388+ Element proteinElement = XMLHelper .selectSingleElement (entryElement , "gene" );
389+ ArrayList <Element > keyWordElementList = XMLHelper .selectElements (proteinElement , "name" );
390+ for (Element element : keyWordElementList ) {
391+ aliasList .add (element .getTextContent ());
392+ }
356393
357394 return aliasList ;
358395 }
0 commit comments