+ // try to parse the accession out\r
+\r
+ DBRefEntry dbr = new DBRefEntry();\r
+ dbr.setVersion(source.getNickname());\r
+ StringTokenizer st = new StringTokenizer(f.getDescription(), ":");\r
+ if (st.hasMoreTokens())\r
+ {\r
+ dbr.setSource(st.nextToken());\r
+ }\r
+ if (st.hasMoreTokens())\r
+ {\r
+ dbr.setAccessionId(st.nextToken());\r
+ }\r
+ seq.addDBRef(dbr);\r
+\r
+ if (f.links != null && f.links.size() > 0)\r
+ {\r
+ // feature is also appended to enable links to be seen.\r
+ // TODO: consider extending dbrefs to have their own links ?\r
+ // TODO: new feature: extract dbref links from DAS servers and add the\r
+ // URL pattern to the list of DB name associated links in the user's\r
+ // preferences ?\r
+ // for the moment - just fix up the existing feature so it displays\r
+ // correctly.\r
+ // f.setType(dbr.getSource());\r
+ // f.setDescription();\r
+ f.setValue("linkonly", Boolean.TRUE);\r
+ // f.setDescription("");\r
+ Vector newlinks = new Vector();\r
+ Enumeration it = f.links.elements();\r
+ while (it.hasMoreElements())\r
+ {\r
+ String elm;\r
+ UrlLink urllink = new UrlLink(elm = (String) it.nextElement());\r
+ if (urllink.isValid())\r
+ {\r
+ urllink.setLabel(f.getDescription());\r
+ newlinks.addElement(urllink.toString());\r
+ }\r
+ else\r
+ {\r
+ // couldn't parse the link properly. Keep it anyway - just in\r
+ // case.\r
+ debug("couldn't parse link string - " + elm);\r
+ newlinks.addElement(elm);\r
+ }\r
+ }\r
+ f.links = newlinks;\r
+ seq.addSequenceFeature(f);\r
+ }\r
+ return true;\r