X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAlignFile.java;h=b2cf26206199ccfa2f02206d224fa3528f1eca27;hb=b8b5965ecce656c11042aabcda9dca342f320e65;hp=889d72ec78dbf97217ff7ca6613e39c6327f7e5c;hpb=892e857760e779796e156b4fa36d97d8d31e73e1;p=jalview.git diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 889d72e..b2cf262 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -28,12 +28,12 @@ import java.util.List; import java.util.Vector; import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.AlignmentAnnotation.TFType; import jalview.datamodel.AlignmentI; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.util.MessageManager; +import jalview.util.StringUtils; /** * DOCUMENT ME! @@ -82,12 +82,7 @@ public abstract class AlignFile extends FileParse private boolean dataClosed = false; - private AlignmentAnnotation.TFType temperatureFactorType = null; - - public AlignmentAnnotation.TFType getTemperatureFactorType() - { - return this.temperatureFactorType; - } + private boolean doXferSettings = true; /** * @return if doParse() was called at construction time @@ -125,13 +120,7 @@ public abstract class AlignFile extends FileParse public AlignFile(Object dataObject, DataSourceType sourceType) throws IOException { - this(dataObject, sourceType, null); - } - - public AlignFile(Object dataObject, DataSourceType sourceType, - AlignmentAnnotation.TFType tempfacType) throws IOException - { - this(true, dataObject, sourceType, tempfacType); + this(true, dataObject, sourceType); } /** @@ -149,16 +138,9 @@ public abstract class AlignFile extends FileParse public AlignFile(boolean parseImmediately, Object dataObject, DataSourceType sourceType) throws IOException { - this(parseImmediately, dataObject, sourceType, null); - } - - public AlignFile(boolean parseImmediately, Object dataObject, - DataSourceType sourceType, AlignmentAnnotation.TFType tempfacType) throws IOException - { // BH allows File or String super(dataObject, sourceType); initData(); - this.temperatureFactorType = tempfacType; if (parseImmediately) { doParse(); @@ -172,6 +154,12 @@ public abstract class AlignFile extends FileParse * @param source * @throws IOException */ + public AlignFile(FileParse source, boolean doXferSettings) + throws IOException + { + this(true, source, true, doXferSettings); + } + public AlignFile(FileParse source) throws IOException { this(true, source); @@ -194,12 +182,19 @@ public abstract class AlignFile extends FileParse public AlignFile(boolean parseImmediately, FileParse source, boolean closeData) throws IOException { + this(parseImmediately, source, closeData, true); + } + + public AlignFile(boolean parseImmediately, FileParse source, + boolean closeData, boolean doXferSettings) throws IOException + { super(source); initData(); // stash flag in case parse needs to know if it has to autoconfigure or was // configured after construction this.parseImmediately = parseImmediately; + this.doXferSettings = doXferSettings; if (parseImmediately) { @@ -226,7 +221,7 @@ public abstract class AlignFile extends FileParse + "Need to call initData() again before parsing can be reattempted."); } parseCalled = true; - parse(); + parse(this.doXferSettings); if (closeData && !dataClosed) { dataIn.close(); @@ -391,6 +386,18 @@ public abstract class AlignFile extends FileParse public abstract void parse() throws IOException; /** + * This method is only overridden by JmolParser because of its use in + * StructureFile to parse annotations + * + * @param doXferSettings + * @throws IOException + */ + public void parse(boolean doXferSettings) throws IOException + { + parse(); + } + + /** * A general parser for ids. * * @String id Id to be parsed @@ -399,7 +406,7 @@ public abstract class AlignFile extends FileParse { Sequence seq = null; id = id.trim(); - int space = id.indexOf(" "); + int space = StringUtils.indexOfFirstWhitespace(id); if (space > -1) { seq = new Sequence(id.substring(0, space), ""); @@ -472,4 +479,14 @@ public abstract class AlignFile extends FileParse { seqs.add(seq); } + + public void setDoXferSettings(boolean b) + { + doXferSettings = b; + } + + public boolean getDoXferSettings() + { + return doXferSettings; + } }