X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FStructureFile.java;h=0a0504e55b4652554c7822dc8a433a5e8786c9aa;hb=9c05fc8a07869007db06cc7efc54f2ac41e4575c;hp=40bb8bee96a75f0317f1001c0317e999a469e3c5;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/io/StructureFile.java b/src/jalview/io/StructureFile.java index 40bb8be..0a0504e 100644 --- a/src/jalview/io/StructureFile.java +++ b/src/jalview/io/StructureFile.java @@ -20,6 +20,12 @@ */ package jalview.io; +import java.awt.Color; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.util.List; +import java.util.Vector; + import jalview.analysis.AlignSeq; import jalview.api.FeatureSettingsModelI; import jalview.datamodel.Alignment; @@ -31,14 +37,8 @@ import jalview.datamodel.PDBEntry; import jalview.datamodel.PDBEntry.Type; import jalview.datamodel.SequenceI; import jalview.structure.StructureImportSettings; - -import java.awt.Color; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.util.List; -import java.util.Vector; - -import MCview.PDBChain; +import jalview.structure.StructureImportSettings.TFType; +import mc_view.PDBChain; public abstract class StructureFile extends AlignFile { @@ -68,10 +68,30 @@ public abstract class StructureFile extends AlignFile private boolean pdbIdAvailable; - public StructureFile(String inFile, DataSourceType sourceType) + private StructureImportSettings.TFType temperatureFactorType = TFType.DEFAULT; + + public void setTemperatureFactorType(StructureImportSettings.TFType t) + { + this.temperatureFactorType = t; + } + + public StructureImportSettings.TFType getTemperatureFactorType() + { + return temperatureFactorType; + } + + public StructureFile(Object inFile, DataSourceType sourceType) throws IOException { - super(inFile, sourceType); + this(inFile, sourceType, null); + } + + public StructureFile(Object inFile, DataSourceType sourceType, + StructureImportSettings.TFType tempfacType) throws IOException + { + super(false, inFile, sourceType); + this.setTemperatureFactorType(tempfacType); + doParse(); } public StructureFile(FileParse fp) throws IOException @@ -95,10 +115,11 @@ public abstract class StructureFile extends AlignFile .isProcessSecondaryStructure(); this.externalSecondaryStructure = StructureImportSettings .isExternalSecondaryStructure(); - + this.temperatureFactorType = StructureImportSettings + .getTemperatureFactorType(); } - public StructureFile(boolean parseImmediately, String dataObject, + public StructureFile(boolean parseImmediately, Object dataObject, DataSourceType sourceType) throws IOException { super(parseImmediately, dataObject, sourceType); @@ -119,6 +140,7 @@ public abstract class StructureFile extends AlignFile pdbSequence.setName(getId() + "|" + pdbSequence.getName()); PDBEntry entry = new PDBEntry(); entry.setId(getId()); + entry.setFakedPDBId(!isPPDBIdAvailable()); entry.setType(getStructureFileType()); if (chain.id != null) { @@ -318,6 +340,8 @@ public abstract class StructureFile extends AlignFile .setProcessSecondaryStructure(predictSecondaryStructure); StructureImportSettings .setExternalSecondaryStructure(externalSecondaryStructure); + StructureImportSettings + .setTemperatureFactorType(temperatureFactorType); Object jmf = constructor.newInstance(args); AlignmentI al = new Alignment((SequenceI[]) cl .getMethod("getSeqsAsArray", new Class[] {}).invoke(jmf)); @@ -342,7 +366,14 @@ public abstract class StructureFile extends AlignFile StructureImportSettings.setShowSeqFeatures(true); } - public PDBChain findChain(String id) throws Exception + /** + * Answers the first PDBChain found matching the given id, or null if none is + * found + * + * @param id + * @return + */ + public PDBChain findChain(String id) { for (PDBChain chain : getChains()) { @@ -351,7 +382,7 @@ public abstract class StructureFile extends AlignFile return chain; } } - throw new Exception("PDB chain not Found!"); + return null; } public void makeResidueList() @@ -397,8 +428,10 @@ public abstract class StructureFile extends AlignFile public static boolean isRNA(SequenceI seq) { - for (char c : seq.getSequence()) + int length = seq.getLength(); + for (int i = 0; i < length; i++) { + char c = seq.getCharAt(i); if ((c != 'A') && (c != 'C') && (c != 'G') && (c != 'U')) { return false;