import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
import jalview.structure.StructureMapping;
+import jalview.structure.StructureViewSettings;
import java.awt.Color;
import java.util.List;
// System.out.println("PDB Sequence is :\nSequence = " + seq);
// System.out.println("No of residues = " + residues.size());
+
+ if (StructureViewSettings.isShowSeqFeatures())
+ {
for (i = 0, iSize = resFeatures.size(); i < iSize; i++)
{
sequence.addSequenceFeature(resFeatures.elementAt(i));
resFeatures.setElementAt(null, i);
}
+ }
if (visibleChainAnnotation)
{
Annotation[] annots = new Annotation[resAnnotation.size()];
package MCview;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.DBRefSource;
import jalview.datamodel.SequenceI;
import jalview.io.FileParse;
import jalview.io.StructureFile;
boolean predictSecondaryStructure, boolean externalSecStr)
{
super();
- this.visibleChainAnnotation = addAlignmentAnnotations;
- this.predictSecondaryStructure = predictSecondaryStructure;
- this.externalSecondaryStructure = externalSecStr;
+ addSettings(addAlignmentAnnotations, predictSecondaryStructure,
+ externalSecStr);
}
- public PDBfile(boolean addAlignmentAnnotations,
- boolean predictSecondaryStructure, boolean externalSecStr,
- String file, String protocol) throws IOException
+ public PDBfile(boolean addAlignmentAnnotations, boolean predictSecStr,
+ boolean externalSecStr, String file, String protocol)
+ throws IOException
{
super(false, file, protocol);
- this.visibleChainAnnotation = addAlignmentAnnotations;
- this.predictSecondaryStructure = predictSecondaryStructure;
- this.externalSecondaryStructure = externalSecStr;
+ addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr);
doParse();
}
- public PDBfile(boolean addAlignmentAnnotations,
- boolean predictSecondaryStructure, boolean externalSecStr,
+ public PDBfile(boolean addAlignmentAnnotations, boolean predictSecStr,
+ boolean externalSecStr,
FileParse source) throws IOException
{
super(false, source);
- this.visibleChainAnnotation = addAlignmentAnnotations;
- this.predictSecondaryStructure = predictSecondaryStructure;
- this.externalSecondaryStructure = externalSecStr;
+ addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr);
doParse();
}
@Override
public void parse() throws IOException
{
+ setDbRefType(DBRefSource.PDB);
// TODO set the filename sensibly - try using data source name.
setId(safeName(getDataName()));
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
+import jalview.datamodel.DBRefSource;
import jalview.datamodel.SequenceI;
import jalview.io.FileParse;
import jalview.io.StructureFile;
import jalview.schemes.ResidueProperties;
+import jalview.structure.StructureViewSettings;
import jalview.util.MessageManager;
import java.io.IOException;
{
Viewer viewer = null;
- public JmolParser(boolean addAlignmentAnnotations,
- boolean predictSecondaryStructure, boolean externalSecStr,
- String inFile, String type) throws IOException
+ public JmolParser(boolean addAlignmentAnnotations, boolean predictSecStr,
+ boolean externalSecStr, String inFile, String type)
+ throws IOException
{
super(inFile, type);
- this.visibleChainAnnotation = addAlignmentAnnotations;
- this.predictSecondaryStructure = predictSecondaryStructure;
- this.externalSecondaryStructure = externalSecStr;
+ // addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr);
}
- public JmolParser(boolean addAlignmentAnnotations,
- boolean predictSecondaryStructure, boolean externalSecStr,
- FileParse fp) throws IOException
+ public JmolParser(boolean addAlignmentAnnotations, boolean predictSecStr,
+ boolean externalSecStr, FileParse fp) throws IOException
{
super(fp);
- this.visibleChainAnnotation = addAlignmentAnnotations;
- this.predictSecondaryStructure = predictSecondaryStructure;
- this.externalSecondaryStructure = externalSecStr;
- }
-
- public JmolParser(FileParse fp) throws IOException
- {
- super(fp);
- }
-
- public JmolParser(String inFile, String type) throws IOException
- {
- super(inFile, type);
+ // addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr);
}
public JmolParser()
@Override
public void parse() throws IOException
{
-
+ String dataName = getDataName();
+ if (dataName.endsWith(".cif"))
+ {
+ setDbRefType(DBRefSource.MMCIF);
+ }
+ else
+ {
+ setDbRefType(DBRefSource.PDB);
+ }
setChains(new Vector<PDBChain>());
Viewer jmolModel = getJmolData();
jmolModel.openReader(getDataName(), getDataName(), getReader());
for (PDBChain chain : getChains())
{
SequenceI chainseq = postProcessChain(chain);
- createAnnotation(chainseq, chain, ms.at);
if (isRNA(chainseq))
{
rna.add(chainseq);
{
prot.add(chainseq);
}
+
+ if (StructureViewSettings.isPredictSecondaryStructure())
+ {
+ createAnnotation(chainseq, chain, ms.at);
+ }
}
} catch (OutOfMemoryError er)
{
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
+import jalview.structure.StructureViewSettings;
import jalview.util.MessageManager;
import java.io.File;
boolean isParseWithJMOL = false;
if (isParseWithJMOL)
{
+ StructureViewSettings.addSettings(annotFromStructure,
+ localSecondaryStruct, serviceSecondaryStruct);
alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, inFile,
type);
}
else
{
+ StructureViewSettings.setShowSeqFeatures(true);
alignFile = new MCview.PDBfile(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, inFile,
type);
}
else if (format.equals("mmCIF"))
{
+ StructureViewSettings.addSettings(annotFromStructure,
+ localSecondaryStruct, serviceSecondaryStruct);
alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, inFile, type);
}
boolean isParseWithJMOL = false;
if (isParseWithJMOL)
{
+ StructureViewSettings.addSettings(annotFromStructure,
+ localSecondaryStruct, serviceSecondaryStruct);
alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, source);
}
else
{
+ StructureViewSettings.setShowSeqFeatures(true);
alignFile = new MCview.PDBfile(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, source);
}
}
else if (format.equals("mmCIF"))
{
+ StructureViewSettings.addSettings(annotFromStructure,
+ localSecondaryStruct, serviceSecondaryStruct);
alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, source);
}
import jalview.datamodel.DBRefSource;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.structure.StructureViewSettings;
import java.awt.Color;
import java.io.IOException;
private String id;
+ private String dbRefType;
/**
* set to true to add derived sequence annotations (temp factor read from
* file, or computed secondary structure) to the alignment
*/
protected boolean visibleChainAnnotation = false;
- /*
+ /**
* Set true to predict secondary structure (using JMol for protein, Annotate3D
* for RNA)
*/
- protected boolean predictSecondaryStructure = true;
+ protected boolean predictSecondaryStructure = false;
- /*
+ /**
* Set true (with predictSecondaryStructure=true) to predict secondary
* structure using an external service (currently Annotate3D for RNA only)
*/
super(fp);
}
+ public void addSettings(boolean addAlignmentAnnotations,
+ boolean predictSecondaryStructure, boolean externalSecStr)
+ {
+ this.visibleChainAnnotation = addAlignmentAnnotations;
+ this.predictSecondaryStructure = predictSecondaryStructure;
+ this.externalSecondaryStructure = externalSecStr;
+ }
public StructureFile(boolean parseImmediately, String inFile, String type)
throws IOException
{
pdbSequence.setName(getId() + "|" + pdbSequence.getName());
PDBEntry entry = new PDBEntry();
entry.setId(getId());
- entry.setType(PDBEntry.Type.PDB);
+ entry.setType(this.dbRefType);
entry.setProperty(new Hashtable());
if (chain.id != null)
{
if (cl != null)
{
final Constructor constructor = cl
- .getConstructor(new Class[] { FileParse.class });
- final Object[] args = new Object[] { new FileParse(getDataName(),
+.getConstructor(new Class[] {
+ boolean.class, boolean.class, boolean.class, FileParse.class });
+ final Object[] args = new Object[] { true, true, true,
+ new FileParse(getDataName(),
type) };
+
+ StructureViewSettings.setShowSeqFeatures(false);
+ StructureViewSettings.setPredictSecondaryStructure(true);
Object jmf = constructor.newInstance(args);
AlignmentI al = new Alignment((SequenceI[]) cl.getMethod(
"getSeqsAsArray", new Class[] {}).invoke(jmf));
{
this.chains = chains;
}
+
+ public String getDbRefType()
+ {
+ return dbRefType;
+ }
+
+ public void setDbRefType(String dbRefType)
+ {
+ this.dbRefType = dbRefType;
+ }
}
--- /dev/null
+package jalview.structure;
+
+public class StructureViewSettings
+{
+ private String dbRefType;
+
+ /**
+ * set to true to add derived sequence annotations (temp factor read from
+ * file, or computed secondary structure) to the alignment
+ */
+ private static boolean visibleChainAnnotation = false;
+
+ /**
+ * Set true to predict secondary structure (using JMol for protein, Annotate3D
+ * for RNA)
+ */
+ private static boolean predictSecStr = false;
+
+ /**
+ * Set true (with predictSecondaryStructure=true) to predict secondary
+ * structure using an external service (currently Annotate3D for RNA only)
+ */
+ private static boolean externalSecondaryStructure = false;
+
+ private static boolean showSeqFeatures = true;
+
+ public static void addSettings(boolean addAlignmentAnnotations,
+ boolean predictSecStr, boolean externalSecStr)
+ {
+ StructureViewSettings.visibleChainAnnotation = addAlignmentAnnotations;
+ StructureViewSettings.predictSecStr = predictSecStr;
+ StructureViewSettings.externalSecondaryStructure = externalSecStr;
+ StructureViewSettings.showSeqFeatures = true;
+ }
+
+ public static boolean isVisibleChainAnnotation()
+ {
+ return visibleChainAnnotation;
+ }
+
+ public static void setVisibleChainAnnotation(
+ boolean visibleChainAnnotation)
+ {
+ StructureViewSettings.visibleChainAnnotation = visibleChainAnnotation;
+ }
+
+ public static boolean isPredictSecondaryStructure()
+ {
+ return predictSecStr;
+ }
+
+ public static void setPredictSecondaryStructure(
+ boolean predictSecondaryStructure)
+ {
+ StructureViewSettings.predictSecStr = predictSecondaryStructure;
+ }
+
+ public static boolean isExternalSecondaryStructure()
+ {
+ return externalSecondaryStructure;
+ }
+
+ public static void setExternalSecondaryStructure(
+ boolean externalSecondaryStructure)
+ {
+ StructureViewSettings.externalSecondaryStructure = externalSecondaryStructure;
+ }
+
+ public static boolean isShowSeqFeatures()
+ {
+ return showSeqFeatures;
+ }
+
+ public static void setShowSeqFeatures(boolean showSeqFeatures)
+ {
+ StructureViewSettings.showSeqFeatures = showSeqFeatures;
+ }
+
+}