+ * examine the given sequence feature to determine if it should actually be\r
+ * turned into sequence annotation or database cross references rather than a\r
+ * simple sequence feature.\r
+ * \r
+ * @param seq\r
+ * the sequence to annotate\r
+ * @param f\r
+ * the jalview sequence feature generated from the DAS feature\r
+ * @param map\r
+ * the sequence feature attributes\r
+ * @param source\r
+ * the source that emitted the feature\r
+ * @return true if feature was consumed as another kind of annotation.\r
+ */\r
+ protected boolean parseSeqFeature(SequenceI seq, SequenceFeature f,\r
+ Map map, Das1Source source)\r
+ {\r
+ SequenceI mseq = seq;\r
+ while (seq.getDatasetSequence() != null)\r
+ {\r
+ seq = seq.getDatasetSequence();\r
+ }\r
+ if (f.getType() != null)\r
+ {\r
+ String type = f.getType();\r
+ if (type.equalsIgnoreCase("protein_name"))\r
+ {\r
+ // parse name onto the alignment sequence or the dataset sequence.\r
+ if (seq.getDescription() == null\r
+ || seq.getDescription().trim().length() == 0)\r
+ {\r
+ // could look at the note series to pick out the first long name, for\r
+ // the moment just use the whole description string\r
+ seq.setDescription(f.getDescription());\r
+ }\r
+ if (mseq.getDescription() == null\r
+ || mseq.getDescription().trim().length() == 0)\r
+ {\r
+ // could look at the note series to pick out the first long name, for\r
+ // the moment just use the whole description string\r
+ mseq.setDescription(f.getDescription());\r
+ }\r
+ return true;\r
+ }\r
+ // check if source has biosapiens or other sequence ontology label\r
+ if (type.equalsIgnoreCase("DBXREF") || type.equalsIgnoreCase("DBREF"))\r
+ {\r
+ // 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
+ }\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /**\r