bonds.addElement(new Bond(start, end, at1, at2));
}
- public void makeResidueList()
+ public void makeResidueList(boolean visibleChainAnnotation)
{
int count = 0;
Object symbol;
.elementAt(i));
resFeatures.setElementAt(null, i);
}
- Annotation[] annots = new Annotation[resAnnotation.size()];
- float max = 0;
- for (i = 0, iSize = annots.length; i < iSize; i++)
+ if (visibleChainAnnotation)
{
- annots[i] = (Annotation) resAnnotation.elementAt(i);
- if (annots[i].value > max)
+ Annotation[] annots = new Annotation[resAnnotation.size()];
+ float max = 0;
+ for (i = 0, iSize = annots.length; i < iSize; i++)
{
- max = annots[i].value;
+ annots[i] = (Annotation) resAnnotation.elementAt(i);
+ if (annots[i].value > max)
+ {
+ max = annots[i].value;
+ }
+ resAnnotation.setElementAt(null, i);
}
- resAnnotation.setElementAt(null, i);
+
+ AlignmentAnnotation tfactorann = new AlignmentAnnotation(
+ "PDB.TempFactor", "Temperature Factor for "
+ + sequence.getName(), annots, 0, max,
+ AlignmentAnnotation.LINE_GRAPH);
+ tfactorann.setSequenceRef(sequence);
+ sequence.addAlignmentAnnotation(tfactorann);
}
- AlignmentAnnotation tfactorann = new AlignmentAnnotation(
- "PDB.TempFactor", "Temperature Factor for "
- + sequence.getName(), annots, 0, max,
- AlignmentAnnotation.LINE_GRAPH);
- tfactorann.setSequenceRef(sequence);
- sequence.addAlignmentAnnotation(tfactorann);
}
public void setChargeColours()
try
{
tmpPDBFile = pdbentry.getFile();
- PDBfile pdbfile = new PDBfile(false,false,tmpPDBFile,
+ PDBfile pdbfile = new PDBfile(false, false, false, tmpPDBFile,
jalview.io.AppletFormatAdapter.FILE);
pdbcanvas.init(pdbentry, seq, chains, ap, protocol);
*/
boolean VisibleChainAnnotation = false;
- boolean processSecondaryStructure=true;
-
+ boolean processSecondaryStructure = true;
+
+ boolean externalSecondaryStructure = false;
public PDBfile(boolean visibleChainAnnotation,
- boolean processSecondaryStructure)
+ boolean processSecondaryStructure, boolean externalSecStr)
{
super();
VisibleChainAnnotation = visibleChainAnnotation;
this.processSecondaryStructure = processSecondaryStructure;
+ this.externalSecondaryStructure = externalSecStr;
}
public PDBfile(boolean visibleChainAnnotation,
- boolean processSecondaryStructure, String file, String protocol) throws IOException
+ boolean processSecondaryStructure, boolean externalSecStr,
+ String file, String protocol) throws IOException
{
super(false, file, protocol);
VisibleChainAnnotation = visibleChainAnnotation;
this.processSecondaryStructure = processSecondaryStructure;
+ this.externalSecondaryStructure = externalSecStr;
doParse();
}
public PDBfile(boolean visibleChainAnnotation,
- boolean processSecondaryStructure, FileParse source) throws IOException
+ boolean processSecondaryStructure, boolean externalSecStr,
+ FileParse source) throws IOException
{
super(false, source);
VisibleChainAnnotation = visibleChainAnnotation;
this.processSecondaryStructure = processSecondaryStructure;
+ this.externalSecondaryStructure = externalSecStr;
doParse();
}
entry.setProperty(new Hashtable());
if (chains.elementAt(i).id != null)
{
- entry.getProperty().put("CHAIN",
- chains.elementAt(i).id);
+ entry.getProperty().put("CHAIN", chains.elementAt(i).id);
}
if (inFile != null)
{
AlignmentAnnotation[] chainannot = chainseq.getAnnotation();
- if (chainannot != null)
+ if (chainannot != null && VisibleChainAnnotation)
{
for (int ai = 0; ai < chainannot.length; ai++)
{
}
if (processSecondaryStructure)
{
- if (rna.size() > 0)
- {
- try
+ if (externalSecondaryStructure && rna.size() > 0)
{
- processPdbFileWithAnnotate3d(rna);
- } catch (Exception x)
- {
- System.err
- .println("Exceptions when dealing with RNA in pdb file");
- x.printStackTrace();
+ try
+ {
+ processPdbFileWithAnnotate3d(rna);
+ } catch (Exception x)
+ {
+ System.err
+ .println("Exceptions when dealing with RNA in pdb file");
+ x.printStackTrace();
+ }
}
- }
- ;
- if (prot.size() > 0)
- {
- try
+ ;
+ if (prot.size() > 0)
{
- processPdbFileWithJmol(prot);
- } catch (Exception x)
- {
- System.err
- .println("Exceptions from Jmol when processing data in pdb file");
- x.printStackTrace();
+ try
+ {
+ processPdbFileWithJmol(prot);
+ } catch (Exception x)
+ {
+ System.err
+ .println("Exceptions from Jmol when processing data in pdb file");
+ x.printStackTrace();
+ }
}
}
- }
} catch (OutOfMemoryError er)
{
System.out.println("OUT OF MEMORY LOADING PDB FILE");
public static boolean isCalcIdHandled(String calcId)
{
- return calcId != null
- && (calcIdPrefix.equals(calcId));
+ return calcId != null && (calcIdPrefix.equals(calcId));
}
- public static boolean isCalcIdForFile(AlignmentAnnotation alan, String pdbFile)
+ public static boolean isCalcIdForFile(AlignmentAnnotation alan,
+ String pdbFile)
{
return alan.getCalcId() != null
&& calcIdPrefix.equals(alan.getCalcId())
{
for (SequenceI sq : seqs)
{
- for (AlignmentAnnotation aa : sq.getAnnotation())
+ if (sq.getAnnotation() != null)
{
- String oldId = aa.getCalcId();
- if (oldId == null)
+ for (AlignmentAnnotation aa : sq.getAnnotation())
{
- oldId = "";
+ String oldId = aa.getCalcId();
+ if (oldId == null)
+ {
+ oldId = "";
+ }
+ aa.setCalcId(calcIdPrefix);
+ aa.setProperty("PDBID", id);
+ aa.setProperty("oldCalcId", oldId);
}
- aa.setCalcId(calcIdPrefix);
- aa.setProperty("PDBID", id);
- aa.setProperty("oldCalcId", oldId);
}
}
}
+
private void processPdbFileWithJmol(ArrayList<SequenceI> prot)
throws Exception
{
AlignmentI al, String pep, boolean b)
{
List<List<? extends Object>> replaced = AlignSeq
- .replaceMatchingSeqsWith(seqs,
- annotations, prot, al, AlignSeq.PEP, false);
+ .replaceMatchingSeqsWith(seqs, annotations, prot, al,
+ AlignSeq.PEP, false);
for (PDBChain ch : chains)
{
int p = 0;
p = -p - 1;
// set shadow entry for chains
ch.shadow = (SequenceI) replaced.get(1).get(p);
- ch.shadowMap = ((AlignSeq) replaced.get(2)
-.get(p))
+ ch.shadowMap = ((AlignSeq) replaced.get(2).get(p))
.getMappingFromS1(false);
}
}
{
for (int i = 0; i < chains.size(); i++)
{
- chains.elementAt(i).makeResidueList();
+ chains.elementAt(i).makeResidueList(VisibleChainAnnotation);
}
}
{
for (int i = 0; i < chains.size(); i++)
{
- chains.elementAt(i).setChainColours(Color.getHSBColor(
- 1.0f / i, .4f, 1.0f));
+ chains.elementAt(i).setChainColours(
+ Color.getHSBColor(1.0f / i, .4f, 1.0f));
}
}
ap++;
}
}
- if (sq.getAnnotation() != null)
+ if (sq.getAnnotation() != null && sq.getAnnotation().length > 0)
{
annotations.addAll(inspos, Arrays.asList(sq.getAnnotation()));
}
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
+import jalview.structure.StructureSelectionManager;
import jalview.util.ImageMaker;
import jalview.util.MessageManager;
import jalview.ws.params.ParamManager;
instance = this;
doVamsasClientCheck();
doGroovyCheck();
-
+ doConfigureStructurePrefs();
setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE",
});
}
+ public void doConfigureStructurePrefs()
+ {
+ // configure services
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(this);
+ if (jalview.bin.Cache.getDefault(Preferences.ADD_SS_ANN, true))
+ {
+ ssm.setAddTempFacAnnot(jalview.bin.Cache.getDefault(
+ Preferences.ADD_TEMPFACT_ANN, true));
+ ssm.setProcessSecondaryStructure(jalview.bin.Cache.getDefault(Preferences.STRUCT_FROM_PDB, true));
+ ssm.setSecStructServices(jalview.bin.Cache.getDefault(Preferences.USE_RNAVIEW,
+ true));
+ }
+ else
+ {
+ ssm.setAddTempFacAnnot(false);
+ ssm.setProcessSecondaryStructure(false);
+ ssm.setSecStructServices(false);
+ }
+ }
+
public void checkForNews()
{
final Desktop me = this;
dasSource.saveProperties(Cache.applicationProperties);
wsPrefs.updateAndRefreshWsMenuConfig(false);
-
Cache.saveProperties();
-
+ Desktop.instance.doConfigureStructurePrefs();
try
{
frame.setClosed(true);
public static String CLASSLOADER = "ClassLoader";
+ /**
+ * add jalview-derived non-secondary structure annotation from PDB structure
+ */
+ boolean annotFromStructure = false;
+
+ /**
+ * add secondary structure from PDB data with built-in algorithms
+ */
+ boolean localSecondaryStruct = false;
+
+ /**
+ * process PDB data with web services
+ */
+ boolean serviceSecondaryStruct = false;
+
AlignFile afile = null;
String inFile;
}
else if (format.equals("PDB"))
{
- afile = new MCview.PDBfile(true,true,inFile, type);
+ afile = new MCview.PDBfile(annotFromStructure,
+ localSecondaryStruct, serviceSecondaryStruct, inFile, type);
// Uncomment to test Jmol data based PDB processing: JAL-1213
// afile = new jalview.ext.jmol.PDBFileWithJmol(inFile, type);
}
}
else if (format.equals("PDB"))
{
- afile = new MCview.PDBfile(true,true,source);
+ afile = new MCview.PDBfile(annotFromStructure,
+ localSecondaryStruct, serviceSecondaryStruct, source);
}
else if (format.equals("STH"))
{
package jalview.io;
import jalview.api.AlignViewportI;
-import jalview.datamodel.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
/**
* Additional formatting methods used by the application in a number of places.
public class FormatAdapter extends AppletFormatAdapter
{
+ public FormatAdapter()
+ {
+ super();
+ if (jalview.bin.Cache.getDefault("STRUCT_FROM_PDB", true))
+ {
+ annotFromStructure = jalview.bin.Cache.getDefault("ADD_TEMPFACT_ANN",
+ true);
+ localSecondaryStruct = jalview.bin.Cache.getDefault("ADD_SS_ANN",
+ true);
+ serviceSecondaryStruct = jalview.bin.Cache.getDefault("USE_RNAVIEW",
+ true);
+ }
+ else
+ {
+ // disable all PDB annotation options
+ annotFromStructure = false;
+ localSecondaryStruct = false;
+ serviceSecondaryStruct = false;
+ }
+ }
public String formatSequences(String format, SequenceI[] seqs,
String[] omitHiddenColumns)
{
public boolean getCacheSuffixDefault(String format)
{
if (isValidFormat(format))
+ {
return jalview.bin.Cache.getDefault(format.toUpperCase()
+ "_JVSUFFIX", true);
+ }
return false;
}
StructureMapping[] mappings;
+ private boolean processSecondaryStructure = false,
+ secStructServices = false, addTempFacAnnot = false;
+
+ /**
+ * @return true if will try to use external services for processing secondary
+ * structure
+ */
+ public boolean isSecStructServices()
+ {
+ return secStructServices;
+ }
+
+ /**
+ * control use of external services for processing secondary structure
+ *
+ * @param secStructServices
+ */
+ public void setSecStructServices(boolean secStructServices)
+ {
+ this.secStructServices = secStructServices;
+ }
+
+ /**
+ * flag controlling addition of any kind of structural annotation
+ *
+ * @return true if temperature factor annotation will be added
+ */
+ public boolean isAddTempFacAnnot()
+ {
+ return addTempFacAnnot;
+ }
+
+ /**
+ * set flag controlling addition of structural annotation
+ *
+ * @param addTempFacAnnot
+ */
+ public void setAddTempFacAnnot(boolean addTempFacAnnot)
+ {
+ this.addTempFacAnnot = addTempFacAnnot;
+ }
+
+ /**
+ *
+ * @return if true, the structure manager will attempt to add secondary
+ * structure lines for unannotated sequences
+ */
+
+ public boolean isProcessSecondaryStructure()
+ {
+ return processSecondaryStructure;
+ }
+
+ /**
+ * Control whether structure manager will try to annotate mapped sequences
+ * with secondary structure from PDB data.
+ *
+ * @param enable
+ */
+ public void setProcessSecondaryStructure(boolean enable)
+ {
+ processSecondaryStructure = enable;
+ }
+
/**
* debug function - write all mappings to stdout
*/
* the tried and tested MCview pdb mapping
*/
MCview.PDBfile pdb = null;
- boolean parseSecStr=true;
+ boolean parseSecStr = processSecondaryStructure;
if (isPDBFileRegistered(pdbFile))
{
for (SequenceI sq : sequence)
}
try
{
- pdb = new MCview.PDBfile(true, parseSecStr, pdbFile, protocol);
+ pdb = new MCview.PDBfile(addTempFacAnnot, parseSecStr,
+ secStructServices, pdbFile, protocol);
if (pdb.id != null && pdb.id.trim().length() > 0
&& AppletFormatAdapter.FILE.equals(protocol))
{
{
for (String pdbStr : testFile)
{
- PDBfile mctest = new PDBfile(false, false, pdbStr,
+ PDBfile mctest = new PDBfile(false, false, false, pdbStr,
AppletFormatAdapter.FILE);
PDBFileWithJmol jtest = new PDBFileWithJmol(pdbStr,
jalview.io.AppletFormatAdapter.FILE);
package jalview.ext.paradise;
import static org.junit.Assert.assertTrue;
-
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
-import jalview.ext.paradise.Annotate3D;
import jalview.io.FastaFile;
import jalview.io.FormatAdapter;
iline = id.readLine();
fline = file.readLine();
if (iline != null)
+ {
System.out.println(iline);
+ }
if (fline != null)
+ {
System.out.println(fline);
+ }
// next assert fails for latest RNAview - because the XMLID entries
// change between file and ID based RNAML generation.
assertTrue(
@Test
public void testPDBfileVsRNAML() throws Exception
{
- PDBfile pdbf = new PDBfile(true,true,"examples/2GIS.pdb", FormatAdapter.FILE);
+ PDBfile pdbf = new PDBfile(true, false, true, "examples/2GIS.pdb",
+ FormatAdapter.FILE);
Assert.assertTrue(pdbf.isValid());
// Comment - should add new FileParse constructor like new FileParse(Reader
// ..). for direct reading