X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFeaturesFile.java;h=462ee22dd65d8260f500437db9f2b22d4abc7bfe;hb=506d60f0e188723ddc91c26824b41ac7034df3fe;hp=03a7a8393a7c44223599fcbb9f084d5d2151cfc7;hpb=6750fadacf73cce0289645dbc387be9331016b1e;p=jalview.git diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index 03a7a83..462ee22 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -148,7 +148,7 @@ public class FeaturesFile extends AlignFile } continue; } - + String seqId = ""; while (st.hasMoreElements()) { @@ -156,8 +156,8 @@ public class FeaturesFile extends AlignFile { // Still possible this is an old Jalview file, // which does not have type colours at the beginning - token = st.nextToken(); - seq = align.findName(token, true); + seqId = token = st.nextToken(); + seq = align.findName(seqId, true); if (seq != null) { desc = st.nextToken(); @@ -205,7 +205,10 @@ public class FeaturesFile extends AlignFile } seq.addSequenceFeature(sf); - + while ((seq = align.findName(seq, seqId, true)) != null) + { + seq.addSequenceFeature(new SequenceFeature(sf)); + } break; } } @@ -231,11 +234,12 @@ public class FeaturesFile extends AlignFile if (!token.equals("ID_NOT_SPECIFIED")) { - seq = align.findName(token, true); + seq = align.findName(seqId = token, true); st.nextToken(); } else { + seqId = null; try { index = Integer.parseInt(st.nextToken()); @@ -266,8 +270,6 @@ public class FeaturesFile extends AlignFile sf = new SequenceFeature(type, desc, "", start, end, featureGroup); - seq.addSequenceFeature(sf); - if (groupLink != null && removeHTML) { sf.addLink(groupLink); @@ -281,6 +283,13 @@ public class FeaturesFile extends AlignFile parseDescriptionHTML(sf, removeHTML); + seq.addSequenceFeature(sf); + + while (seqId != null + && (seq = align.findName(seq, seqId, false)) != null) + { + seq.addSequenceFeature(new SequenceFeature(sf)); + } // If we got here, its not a GFFFile GFFFile = false; } @@ -371,12 +380,15 @@ public class FeaturesFile extends AlignFile } -/** - * generate a features file for seqs - * @param seqs source of sequence features - * @param visible hash of feature types and colours - * @return features file contents - */ + /** + * generate a features file for seqs + * + * @param seqs + * source of sequence features + * @param visible + * hash of feature types and colours + * @return features file contents + */ public String printJalviewFormat(SequenceI[] seqs, Hashtable visible) { return printJalviewFormat(seqs, visible, true); @@ -384,9 +396,13 @@ public class FeaturesFile extends AlignFile /** * generate a features file for seqs with colours from visible (if any) - * @param seqs source of features - * @param visible hash of Colours for each feature type - * @param visOnly when true only feature types in 'visible' will be output + * + * @param seqs + * source of features + * @param visible + * hash of Colours for each feature type + * @param visOnly + * when true only feature types in 'visible' will be output * @return features file contents */ public String printJalviewFormat(SequenceI[] seqs, Hashtable visible, @@ -401,7 +417,8 @@ public class FeaturesFile extends AlignFile } if (visible != null && visOnly) { - // write feature colours only if we're given them and we are generating viewed features + // write feature colours only if we're given them and we are generating + // viewed features Enumeration en = visible.keys(); String type; int color;