+ // 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 URL pattern to the list of DB name associated links in the user's preferences ?\r
+ // for the moment - just fix up the existing feature so it displays 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
+ urllink.setLabel(f.getDescription());\r
+ newlinks.addElement(urllink.toString());\r
+ } else {\r
+ // couldn't parse the link properly. Keep it anyway - just in 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