Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public SelectMultiplePanel(boolean show2boxes){

Box vBox = Box.createVerticalBox();

input = new JTextField("4hhb.A 1hlb 1thb.A 1dlw");
input = new JTextField("1mbc 1hlb 1dlw 1ith.A 1thb.A 1kr7.A_0-110");
Box b = getDomainPanel(input);
vBox.add(b);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ else if (move < 0.85){
if (debug){
System.out.println("Step: "+i+": --prob: "+prob+
", --score: "+AS+", --conv: "+conv);
}

if (i%100==1){
lengthHistory.add(msa.length());
rmsdHistory.add(MultipleAlignmentScorer.getRMSD(msa));
scoreHistory.add(mcScore);
if (i%100==1){
lengthHistory.add(msa.length());
rmsdHistory.add(MultipleAlignmentScorer.getRMSD(msa));
scoreHistory.add(mcScore);
}
}

i++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.biojava.nbio.structure.AtomImpl;
import org.biojava.nbio.structure.Calc;
import org.biojava.nbio.structure.StructureException;
import org.biojava.nbio.structure.StructureTools;
import org.biojava.nbio.structure.align.model.AFPChain;
import org.biojava.nbio.structure.jama.Matrix;

Expand Down Expand Up @@ -52,9 +53,11 @@
* {@link #MIN_ANGLE}.
*
* @author Spencer Bliven
* @author Aleix Lafita
*
*/
public final class RotationAxis {

/**
* Minimum angle to calculate rotation axes. 5 degrees.
*/
Expand All @@ -65,7 +68,8 @@ public final class RotationAxis {
private Atom rotationPos; // a point on the axis of rotation
private Atom screwTranslation; //translation parallel to the axis of rotation
private Atom otherTranslation; // translation perpendicular to the axis of rotation

private Atom[] atoms; //atoms used for determining the bounds of the axis

/**
* The rotation angle
* @return the angle, in radians
Expand Down Expand Up @@ -370,15 +374,16 @@ private void calculateTranslationalAxis(Matrix rotation, Atom translation) {

/**
* Returns a Jmol script which will display the axis of rotation. This
* consists of a cyan arrow along the axis, plus an arc showing the angle
* consists of an orange arrow along the axis, plus an arc showing the angle
* of rotation.
* <p>
* As the rotation angle gets smaller, the axis of rotation becomes poorly
* defined and would need to get farther and farther away from the protein.
* This is not particularly useful, so we arbitrarily draw it parallel to
* the translation and omit the arc.
*
* @param atoms Some atoms from the protein, used for determining the bounds
* of the axis.
* of the axis. If null, the Atoms stored in this axis will be used.
*
* @return The Jmol script, suitable for calls to
* {@link org.biojava.nbio.structure.align.gui.jmol.StructureAlignmentJmol#evalString() jmol.evalString()}
Expand All @@ -389,15 +394,16 @@ public String getJmolScript(Atom[] atoms){

/**
* Returns a Jmol script which will display the axis of rotation. This
* consists of a cyan arrow along the axis, plus an arc showing the angle
* consists of an orange arrow along the axis, plus an arc showing the angle
* of rotation.
* <p>
* As the rotation angle gets smaller, the axis of rotation becomes poorly
* defined and would need to get farther and farther away from the protein.
* This is not particularly useful, so we arbitrarily draw it parallel to
* the translation and omit the arc.
*
* @param atoms Some atoms from the protein, used for determining the bounds
* of the axis.
* of the axis.If null, the Atoms stored in this axis will be used.
* @param axisID in case of representing more than one axis in the same jmol
* panel, indicate the ID number.
*
Expand All @@ -408,6 +414,7 @@ public String getJmolScript(Atom[] atoms, int axisID){
final double width=.5;// width of JMol object
final String axisColor = "yellow"; //axis color
final String screwColor = "orange"; //screw translation color
if (atoms==null) atoms = this.atoms;

// Project each Atom onto the rotation axis to determine limits
double min, max;
Expand Down Expand Up @@ -567,6 +574,17 @@ public static double getAngle(Matrix rotation) {
double c = (rotation.trace()-1)/2.0; //=cos(theta)
return Math.acos(c);
}

/**
* Set the Atom coordinates that determine the boundaries of the axis when
* displayed in Jmol. The Atoms are cloned before stored, so that if they
* change the axis is not affected.
*
* @param atoms
*/
public void setAtoms(Atom[] atoms) {
this.atoms = StructureTools.cloneAtomArray(atoms);
}

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package org.biojava.nbio.structure.symmetry.utils;

import java.util.List;

/**
* A directed acyclic graph (DAG) implementation based on a
* List of vertices and a List of Edges for each vertex
* (adjacency List).
* <p>
* Every time a new Edge is added to the Graph, a check is
* made to ensure that no cycles are present. If a cycle
* exists, an Exception is thrown.
*
* @author Aleix Lafita
* @since 4.1.1
*
*/
public class DirectedAcyclicGraph<V> extends DirectedGraph<V> {

@Override
public boolean addEdge(V vertex1, V vertex2) {

//Check if the vertices exist
int index1 = vertices.indexOf(vertex1);
int index2 = vertices.indexOf(vertex2);
if (index1 == -1 || index2 == -1) return false;

//Check if the edge already existed
boolean changed = vertexMap.get(index1).add(index2);
if (!changed) return false;

//Check for cycles in the DAG: use a DFS to check for back edges
for (int source=0; source<size(); source++){
GraphIteratorDFS<V> iter = new GraphIteratorDFS<V>(this, source);
while (iter.hasNext()){
V vertex = iter.next();
List<V> path = iter.getPath();
for (Integer c : getChildren(indexOf(vertex))){
V child = getVertex(c);
if (path.contains(child)){
//We found a back edge
throw new IllegalStateException(
"There is a cycle in the DAG");
}
}
}
}
return true;
}


@Override
public DirectedAcyclicGraph<V> clone() {
return (DirectedAcyclicGraph<V>) super.clone();
}

@Override
public DirectedAcyclicGraph<V> extractSubGraph(List<Integer> indices) {
return (DirectedAcyclicGraph<V>) super.extractSubGraph(indices);
}

}
Loading