X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFeaturesFile.java;h=5058e5fbfc0cf85aa4ac6fb407394c7d70cc1a89;hb=ed12859f49530c561c9d069c71333ddac9fc8a30;hp=3e0314ae75bb029642b1070d2d579621fd2e4f76;hpb=167476e350f385aa0fcb334b79722ddaa1b3a368;p=jalview.git diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index 3e0314a..5058e5f 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=""; + String seqId = ""; while (st.hasMoreElements()) { @@ -201,11 +201,12 @@ public class FeaturesFile extends AlignFile { attributes.append("\t" + st.nextElement()); } + // TODO validate and split GFF2 attributes field ? parse out ([A-Za-z][A-Za-z0-9_]*) ; and add as sf.setValue(attrib, val); sf.setValue("ATTRIBUTES", attributes.toString()); } seq.addSequenceFeature(sf); - while ((seq=align.findName(seq, seqId, true))!=null) + while ((seq = align.findName(seq, seqId, true)) != null) { seq.addSequenceFeature(new SequenceFeature(sf)); } @@ -234,12 +235,12 @@ public class FeaturesFile extends AlignFile if (!token.equals("ID_NOT_SPECIFIED")) { - seq = align.findName(seqId=token, true); + seq = align.findName(seqId = token, true); st.nextToken(); } else { - seqId=null; + seqId = null; try { index = Integer.parseInt(st.nextToken()); @@ -285,7 +286,8 @@ public class FeaturesFile extends AlignFile seq.addSequenceFeature(sf); - while (seqId!=null && (seq=align.findName(seq, seqId, false))!=null) + while (seqId != null + && (seq = align.findName(seq, seqId, false)) != null) { seq.addSequenceFeature(new SequenceFeature(sf)); } @@ -379,12 +381,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); @@ -392,9 +397,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, @@ -409,7 +418,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;