import java.io.IOException;
import java.util.ArrayList;
import java.util.Hashtable;
+import java.util.List;
import java.util.Vector;
public class PDBfile extends jalview.io.AlignFile
{
- public Vector chains;
+ public Vector<PDBChain> chains;
public String id;
}
for (int i = 0; i < chains.size(); i++)
{
- SequenceI dataset = ((PDBChain) chains.elementAt(i)).sequence;
+ SequenceI dataset = chains.elementAt(i).sequence;
dataset.setName(id + "|" + dataset.getName());
PDBEntry entry = new PDBEntry();
entry.setId(id);
entry.setProperty(new Hashtable());
- if (((PDBChain) chains.elementAt(i)).id != null)
+ if (chains.elementAt(i).id != null)
{
entry.getProperty().put("CHAIN",
- ((PDBChain) chains.elementAt(i)).id);
+ chains.elementAt(i).id);
}
if (inFile != null)
{
{
for (int i = 0; i < chains.size(); i++)
{
- ((PDBChain) chains.elementAt(i)).makeResidueList();
+ chains.elementAt(i).makeResidueList();
}
}
{
for (int i = 0; i < chains.size(); i++)
{
- ((PDBChain) chains.elementAt(i)).makeCaBondList();
+ chains.elementAt(i).makeCaBondList();
}
}
{
for (int i = 0; i < chains.size(); i++)
{
- if (((PDBChain) chains.elementAt(i)).id.equals(id))
+ if (chains.elementAt(i).id.equals(id))
{
- return (PDBChain) chains.elementAt(i);
+ return chains.elementAt(i);
}
}
{
for (int i = 0; i < chains.size(); i++)
{
- ((PDBChain) chains.elementAt(i)).setChargeColours();
+ chains.elementAt(i).setChargeColours();
}
}
{
for (int i = 0; i < chains.size(); i++)
{
- ((PDBChain) chains.elementAt(i)).setChainColours(cs);
+ chains.elementAt(i).setChainColours(cs);
}
}
{
for (int i = 0; i < chains.size(); i++)
{
- ((PDBChain) chains.elementAt(i)).setChainColours(Color.getHSBColor(
+ chains.elementAt(i).setChainColours(Color.getHSBColor(
1.0f / i, .4f, 1.0f));
}
}
package jalview.appletgui;
import jalview.analysis.AlignmentSorter;
-import jalview.analysis.Conservation;
import jalview.api.AlignViewControllerGuiI;
import jalview.api.AlignViewControllerI;
import jalview.api.SequenceStructureBinding;
import jalview.schemes.PurinePyrimidineColourScheme;
import jalview.schemes.RNAHelicesColourChooser;
import jalview.schemes.RNAInteractionColourScheme;
-import jalview.schemes.ResidueProperties;
import jalview.schemes.StrandColourScheme;
import jalview.schemes.TCoffeeColourScheme;
import jalview.schemes.TaylorColourScheme;
.getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt
.getKeyCode() <= KeyEvent.VK_NUMPAD9))
&& Character.isDigit(evt.getKeyChar()))
+ {
alignPanel.seqPanel.numberPressed(evt.getKeyChar());
+ }
switch (evt.getKeyCode())
{
case KeyEvent.VK_LEFT:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
slideSequences(false, alignPanel.seqPanel.getKeyboardNo1());
+ }
else
+ {
alignPanel.seqPanel.moveCursor(-1, 0);
+ }
break;
case KeyEvent.VK_RIGHT:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
slideSequences(true, alignPanel.seqPanel.getKeyboardNo1());
+ }
else
+ {
alignPanel.seqPanel.moveCursor(1, 0);
+ }
break;
case KeyEvent.VK_SPACE:
else
{
if (features == null)
+ {
features = "";
+ }
}
return features;
for (int i = 0; i < viewport.getAlignment().getHeight(); i++)
{
if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))
+ {
invertGroup.addElement(viewport.getAlignment().getSequenceAt(i));
+ }
}
SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]);
SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup
.size()]);
for (int i = 0; i < invertGroup.size(); i++)
+ {
seqs2[i] = invertGroup.elementAt(i);
+ }
SlideSequencesCommand ssc;
if (right)
+ {
ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1,
size, viewport.getGapCharacter());
+ }
else
+ {
ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2,
size, viewport.getGapCharacter());
+ }
int groupAdjustment = 0;
if (ssc.getGapsInsertedBegin() && right)
{
if (viewport.cursorMode)
+ {
alignPanel.seqPanel.moveCursor(size, 0);
+ }
else
+ {
groupAdjustment = size;
+ }
}
else if (!ssc.getGapsInsertedBegin() && !right)
{
if (viewport.cursorMode)
+ {
alignPanel.seqPanel.moveCursor(-size, 0);
+ }
else
+ {
groupAdjustment = -size;
+ }
}
if (groupAdjustment != 0)
}
if (!appendHistoryItem)
+ {
addHistoryItem(ssc);
+ }
repaint();
}
{
String sequence = applet.getParameter("PDBSEQ");
if (sequence != null)
+ {
seqs = new SequenceI[]
{ matcher == null ? (Sequence) newAlignFrame
.getAlignViewport().getAlignment()
.findName(sequence) : matcher.findIdMatch(sequence) };
+ }
}
else
// note separator local variable intentionally masks object field
int seplen = separator.length();
if (list == null || list.equals("") || list.equals(separator))
+ {
return null;
+ }
java.util.Vector jv = new Vector();
int cp = 0, pos;
while ((pos = list.indexOf(separator, cp)) > cp)
*/
package jalview.ext.jmol;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.io.AlignFile;
+import jalview.io.FileParse;
+import jalview.util.MessageManager;
+
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;
import org.jmol.viewer.Viewer;
import org.openscience.jmol.app.JmolApp;
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.Annotation;
-import jalview.datamodel.PDBEntry;
-import jalview.datamodel.Sequence;
-import jalview.datamodel.SequenceI;
-import jalview.io.AlignFile;
-import jalview.io.FileParse;
-import jalview.util.MessageManager;
-
/**
* Import and process PDB files with Jmol
*
case MEASURE:
String mystatus = (String) data[3];
if (mystatus.indexOf("Picked") >= 0
- || mystatus.indexOf("Sequence") >= 0) // picking mode
+ || mystatus.indexOf("Sequence") >= 0)
+ {
+ // Picking mode
sendConsoleMessage(strInfo);
+ }
else if (mystatus.indexOf("Completed") >= 0)
+ {
sendConsoleEcho(strInfo.substring(strInfo.lastIndexOf(",") + 2,
strInfo.length() - 1));
+ }
break;
case MESSAGE:
sendConsoleMessage(data == null ? null : strInfo);
.getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt
.getKeyCode() <= KeyEvent.VK_NUMPAD9))
&& Character.isDigit(evt.getKeyChar()))
+ {
alignPanel.seqPanel.numberPressed(evt.getKeyChar());
+ }
switch (evt.getKeyCode())
{
case KeyEvent.VK_DOWN:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
moveSelectedSequences(false);
+ }
if (viewport.cursorMode)
+ {
alignPanel.seqPanel.moveCursor(0, 1);
+ }
break;
case KeyEvent.VK_UP:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
moveSelectedSequences(true);
+ }
if (viewport.cursorMode)
+ {
alignPanel.seqPanel.moveCursor(0, -1);
+ }
break;
case KeyEvent.VK_LEFT:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
slideSequences(false, alignPanel.seqPanel.getKeyboardNo1());
+ }
else
+ {
alignPanel.seqPanel.moveCursor(-1, 0);
+ }
break;
case KeyEvent.VK_RIGHT:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
slideSequences(true, alignPanel.seqPanel.getKeyboardNo1());
+ }
else
+ {
alignPanel.seqPanel.moveCursor(1, 0);
+ }
break;
case KeyEvent.VK_SPACE:
{
case KeyEvent.VK_LEFT:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
viewport.firePropertyChange("alignment", null, viewport
.getAlignment().getSequences());
+ }
break;
case KeyEvent.VK_RIGHT:
if (evt.isAltDown() || !viewport.cursorMode)
+ {
viewport.firePropertyChange("alignment", null, viewport
.getAlignment().getSequences());
+ }
break;
}
}
protected void undoMenuItem_actionPerformed(ActionEvent e)
{
if (viewport.historyList.empty())
+ {
return;
+ }
CommandI command = (CommandI) viewport.historyList.pop();
viewport.redoList.push(command);
command.undoCommand(getViewAlignments());
for (int i = 0; i < viewport.getAlignment().getHeight(); i++)
{
if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))
+ {
invertGroup.add(viewport.getAlignment().getSequenceAt(i));
+ }
}
SequenceI[] seqs1 = sg.toArray(new SequenceI[0]);
SequenceI[] seqs2 = new SequenceI[invertGroup.size()];
for (int i = 0; i < invertGroup.size(); i++)
+ {
seqs2[i] = (SequenceI) invertGroup.elementAt(i);
+ }
SlideSequencesCommand ssc;
if (right)
+ {
ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1,
size, viewport.getGapCharacter());
+ }
else
+ {
ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2,
size, viewport.getGapCharacter());
+ }
int groupAdjustment = 0;
if (ssc.getGapsInsertedBegin() && right)
{
if (viewport.cursorMode)
+ {
alignPanel.seqPanel.moveCursor(size, 0);
+ }
else
+ {
groupAdjustment = size;
+ }
}
else if (!ssc.getGapsInsertedBegin() && !right)
{
if (viewport.cursorMode)
+ {
alignPanel.seqPanel.moveCursor(-size, 0);
+ }
else
+ {
groupAdjustment = -size;
+ }
}
if (groupAdjustment != 0)
}
if (!appendHistoryItem)
+ {
addHistoryItem(ssc);
+ }
repaint();
}
{
AlignmentAnnotation sann[] = sequences[i].getAnnotation();
if (sann == null)
+ {
continue;
+ }
for (int avnum = 0; avnum < alview.length; avnum++)
{
if (alview[avnum] != alignment)
if (ds.getSequences() == null
|| !ds.getSequences().contains(
sprods[s].getDatasetSequence()))
+ {
ds.addSequence(sprods[s].getDatasetSequence());
+ }
sprods[s].updatePDBIds();
}
Alignment al = new Alignment(sprods);
*/
package jalview.gui;
-import java.awt.Rectangle;
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.net.*;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.jar.*;
-
-import javax.swing.*;
-
-import org.exolab.castor.xml.*;
-
import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Cache;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
-import jalview.schemabinding.version2.*;
-import jalview.schemes.*;
+import jalview.schemabinding.version2.AlcodMap;
+import jalview.schemabinding.version2.Alcodon;
+import jalview.schemabinding.version2.AlcodonFrame;
+import jalview.schemabinding.version2.Annotation;
+import jalview.schemabinding.version2.AnnotationColours;
+import jalview.schemabinding.version2.AnnotationElement;
+import jalview.schemabinding.version2.CalcIdParam;
+import jalview.schemabinding.version2.DBRef;
+import jalview.schemabinding.version2.Features;
+import jalview.schemabinding.version2.Group;
+import jalview.schemabinding.version2.HiddenColumns;
+import jalview.schemabinding.version2.JGroup;
+import jalview.schemabinding.version2.JSeq;
+import jalview.schemabinding.version2.JalviewModel;
+import jalview.schemabinding.version2.JalviewModelSequence;
+import jalview.schemabinding.version2.MapListFrom;
+import jalview.schemabinding.version2.MapListTo;
+import jalview.schemabinding.version2.Mapping;
+import jalview.schemabinding.version2.MappingChoice;
+import jalview.schemabinding.version2.OtherData;
+import jalview.schemabinding.version2.PdbentryItem;
+import jalview.schemabinding.version2.Pdbids;
+import jalview.schemabinding.version2.Property;
+import jalview.schemabinding.version2.Sequence;
+import jalview.schemabinding.version2.SequenceSet;
+import jalview.schemabinding.version2.SequenceSetProperties;
+import jalview.schemabinding.version2.Setting;
+import jalview.schemabinding.version2.StructureState;
+import jalview.schemabinding.version2.ThresholdLine;
+import jalview.schemabinding.version2.Tree;
+import jalview.schemabinding.version2.UserColours;
+import jalview.schemabinding.version2.Viewport;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.GraduatedColor;
+import jalview.schemes.ResidueColourScheme;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.util.jarInputStreamProvider;
import jalview.ws.params.AutoCalcSetting;
import jalview.ws.params.WsParamSetI;
+import java.awt.Rectangle;
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
+import org.exolab.castor.xml.Unmarshaller;
+
/**
* Write out the current jalview desktop state as a Jalview XML stream.
*
.startsWith(
jmol.jmb.pdbentry[peid].getId()
.toLowerCase())))
+ {
continue;
+ }
if (matchedFile == null)
{
matchedFile = jmol.jmb.pdbentry[peid].getFile();
ae = new AnnotationElement();
if (aa[i].annotations[a].description != null)
+ {
ae.setDescription(aa[i].annotations[a].description);
+ }
if (aa[i].annotations[a].displayCharacter != null)
+ {
ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter);
+ }
if (!Float.isNaN(aa[i].annotations[a].value))
+ {
ae.setValue(aa[i].annotations[a].value);
+ }
ae.setPosition(a);
if (aa[i].annotations[a].secondaryStructure != ' '
&& aa[i].annotations[a].secondaryStructure != '\0')
+ {
ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure
+ "");
+ }
if (aa[i].annotations[a].colour != null
&& aa[i].annotations[a].colour != java.awt.Color.black)
errorMessage = null;
}
- Hashtable alreadyLoadedPDB;
+ Hashtable<String, String> alreadyLoadedPDB;
/**
* when set, local views will be updated from view stored in JalviewXML
String loadPDBFile(jarInputStreamProvider jprovider, String pdbId)
{
if (alreadyLoadedPDB == null)
+ {
alreadyLoadedPDB = new Hashtable();
+ }
if (alreadyLoadedPDB.containsKey(pdbId))
+ {
return alreadyLoadedPDB.get(pdbId).toString();
+ }
try
{
// in principle Visible should always be true for annotation displayed
// in multiple views
if (an[i].hasVisible())
+ {
jda.visible = an[i].getVisible();
+ }
al.addAnnotation(jda);
anpos = ae[aa].getPosition();
if (anpos >= anot.length)
+ {
continue;
+ }
anot[anpos] = new jalview.datamodel.Annotation(
jaa.setScore(an[i].getScore());
}
if (an[i].hasVisible())
+ {
jaa.visible = an[i].getVisible();
+ }
if (an[i].hasCentreColLabels())
+ {
jaa.centreColLabels = an[i].getCentreColLabels();
+ }
if (an[i].hasScaleColLabels())
{
jaa.belowAlignment = an[i].isBelowAlignment();
}
jaa.setCalcId(an[i].getCalcId());
-
if (jaa.autoCalculated)
{
autoAlan.add(new JvAnnotRow(i, jaa));
}
renderOrder[fs] = setting.getType();
if (setting.hasOrder())
+ {
af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setOrder(
setting.getType(), setting.getOrder());
+ }
else
+ {
af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setOrder(
setting.getType(),
fs / jms.getFeatureSettings().getSettingCount());
+ }
if (setting.getDisplay())
{
af.viewport.featuresDisplayed.put(setting.getType(), new Integer(
}
}
else
+ {
Cache.log.debug("Ignoring " + jvobj.getClass() + " (ID = " + id);
+ }
}
}
*/
package jalview.gui;
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-
-import javax.swing.*;
-
-import org.exolab.castor.xml.*;
-import jalview.binding.*;
-import jalview.schemes.*;
+import jalview.binding.Annotation;
+import jalview.binding.AnnotationElement;
+import jalview.binding.Features;
+import jalview.binding.JGroup;
+import jalview.binding.JSeq;
+import jalview.binding.JalviewModel;
+import jalview.binding.JalviewModelSequence;
+import jalview.binding.Pdbids;
+import jalview.binding.Sequence;
+import jalview.binding.SequenceSet;
+import jalview.binding.Setting;
+import jalview.binding.Tree;
+import jalview.binding.UserColours;
+import jalview.binding.Viewport;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
import jalview.util.jarInputStreamProvider;
+import java.io.InputStreamReader;
+import java.util.Hashtable;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import javax.swing.JOptionPane;
+
+import org.exolab.castor.xml.IDResolver;
+
/**
* DOCUMENT ME!
*
InputStreamReader in = new InputStreamReader(jin, "UTF-8");
JalviewModel object = new JalviewModel();
- object = (JalviewModel) object.unmarshal(in);
+ object = object.unmarshal(in);
af = LoadFromObject(object, file);
entryCount++;
for (int s = 0; s < ids.length; s++)
{
- seqs.addElement((jalview.datamodel.SequenceI) seqids
+ seqs.addElement(seqids
.elementAt(ids[s]));
}
}
viewport.firePropertyChange("alignment", null, viewport
.getAlignment().getSequences());
-
}
else
{
{ title }));
if (!protocol.equals(AppletFormatAdapter.PASTE))
+ {
alignFrame.setFileName(file, format);
+ }
if (raiseGUI)
{
// add the window to the GUI
boolean first = true;
for (int i = 0; i < pdb.chains.size(); i++)
{
- PDBChain chain = ((PDBChain) pdb.chains.elementAt(i));
+ PDBChain chain = (pdb.chains.elementAt(i));
if (targetChain.length() > 0 && !targetChain.equals(chain.id)
&& !infChain)
{
// TODO: correctly determine sequence type for mixed na/peptide
// structures
AlignSeq as = new AlignSeq(sequence[s],
- ((PDBChain) pdb.chains.elementAt(i)).sequence,
- ((PDBChain) pdb.chains.elementAt(i)).isNa ? AlignSeq.DNA
+ pdb.chains.elementAt(i).sequence,
+ pdb.chains.elementAt(i).isNa ? AlignSeq.DNA
: AlignSeq.PEP);
as.calcScoreMatrix();
as.traceAlignment();