/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * \r
* This program is free software; you can redistribute it and/or\r
* modify it under the terms of the GNU General Public License\r
* as published by the Free Software Foundation; either version 2\r
* of the License, or (at your option) any later version.\r
- *\r
+ * \r
* This program is distributed in the hope that it will be useful,\r
* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
* GNU General Public License for more details.\r
- *\r
+ * \r
* You should have received a copy of the GNU General Public License\r
* along with this program; if not, write to the Free Software\r
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
}\r
continue;\r
}\r
-\r
+ String seqId = "";\r
while (st.hasMoreElements())\r
{\r
\r
{\r
// Still possible this is an old Jalview file,\r
// which does not have type colours at the beginning\r
- token = st.nextToken();\r
- seq = align.findName(token, true);\r
+ seqId = token = st.nextToken();\r
+ seq = align.findName(seqId, true);\r
if (seq != null)\r
{\r
desc = st.nextToken();\r
}\r
\r
seq.addSequenceFeature(sf);\r
-\r
+ while ((seq = align.findName(seq, seqId, true)) != null)\r
+ {\r
+ seq.addSequenceFeature(new SequenceFeature(sf));\r
+ }\r
break;\r
}\r
}\r
\r
if (!token.equals("ID_NOT_SPECIFIED"))\r
{\r
- seq = align.findName(token, true);\r
+ seq = align.findName(seqId = token, true);\r
st.nextToken();\r
}\r
else\r
{\r
+ seqId = null;\r
try\r
{\r
index = Integer.parseInt(st.nextToken());\r
\r
sf = new SequenceFeature(type, desc, "", start, end, featureGroup);\r
\r
- seq.addSequenceFeature(sf);\r
-\r
if (groupLink != null && removeHTML)\r
{\r
sf.addLink(groupLink);\r
\r
parseDescriptionHTML(sf, removeHTML);\r
\r
+ seq.addSequenceFeature(sf);\r
+\r
+ while (seqId != null\r
+ && (seq = align.findName(seq, seqId, false)) != null)\r
+ {\r
+ seq.addSequenceFeature(new SequenceFeature(sf));\r
+ }\r
// If we got here, its not a GFFFile\r
GFFFile = false;\r
}\r
\r
}\r
\r
-/**\r
- * generate a features file for seqs\r
- * @param seqs source of sequence features\r
- * @param visible hash of feature types and colours \r
- * @return features file contents\r
- */\r
+ /**\r
+ * generate a features file for seqs\r
+ * \r
+ * @param seqs\r
+ * source of sequence features\r
+ * @param visible\r
+ * hash of feature types and colours\r
+ * @return features file contents\r
+ */\r
public String printJalviewFormat(SequenceI[] seqs, Hashtable visible)\r
{\r
return printJalviewFormat(seqs, visible, true);\r
\r
/**\r
* generate a features file for seqs with colours from visible (if any)\r
- * @param seqs source of features\r
- * @param visible hash of Colours for each feature type\r
- * @param visOnly when true only feature types in 'visible' will be output\r
+ * \r
+ * @param seqs\r
+ * source of features\r
+ * @param visible\r
+ * hash of Colours for each feature type\r
+ * @param visOnly\r
+ * when true only feature types in 'visible' will be output\r
* @return features file contents\r
*/\r
public String printJalviewFormat(SequenceI[] seqs, Hashtable visible,\r
}\r
if (visible != null && visOnly)\r
{\r
- // write feature colours only if we're given them and we are generating viewed features\r
+ // write feature colours only if we're given them and we are generating\r
+ // viewed features\r
Enumeration en = visible.keys();\r
String type;\r
int color;\r