Skip to content
Merged
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
7 changes: 6 additions & 1 deletion biojava-structure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
<artifactId>vecmath</artifactId>
<version>1.3.1</version>
</dependency>


<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-core</artifactId>
<version>0.9.1</version>
</dependency>

<!-- logging dependencies (managed by parent pom, don't set versions or scopes here) -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*/
public class SeqMisMatchImpl implements SeqMisMatch, Serializable{

Integer seqNum;
private static final long serialVersionUID = -3699285122925652562L;

Integer seqNum;
String origGroup;
String pdbGroup;
String details;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@

import org.biojava.nbio.structure.Structure;
import org.biojava.nbio.structure.symmetry.utils.CombinationGenerator;
import org.biojava.nbio.structure.symmetry.utils.ComponentFinder;
import org.biojava.nbio.structure.symmetry.utils.Graph;
import org.jgrapht.UndirectedGraph;
import org.jgrapht.alg.ConnectivityInspector;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.UndirectedSubgraph;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.vecmath.Point3d;

import java.math.BigInteger;
import java.util.*;

Expand All @@ -40,6 +45,10 @@
*
*/
public class QuatSymmetryDetector {

private static final Logger logger = LoggerFactory
.getLogger(QuatSymmetryDetector.class);

private Structure structure = null;
private QuatSymmetryParameters parameters = null;

Expand Down Expand Up @@ -136,8 +145,8 @@ private void run() {

double time = (System.nanoTime()- start)/1000000000;
if (time > parameters.getLocalTimeLimit()) {
System.out.println("Warning: QuatSymmetryDetector: Exceeded time limit for local symmetry calculations: " + time +
" seconds. Results may be incomplete");
logger.warn("Exceeded time limit for local symmetry calculations: " + time +
" seconds. Quat symmetry results may be incomplete");
break;
}
}
Expand Down Expand Up @@ -387,8 +396,8 @@ private List<List<Integer>> decomposeClusters(List<Point3d[]> caCoords, List<Int
}

SubunitGraph subunitGraph = new SubunitGraph(subList);
Graph<Integer> graph = subunitGraph.getProteinGraph();
// System.out.println("Graph: " + graph);
UndirectedGraph<Integer, DefaultEdge> graph = subunitGraph.getProteinGraph();
logger.debug("Graph: {}", graph.toString());

for (int i = last; i > 1; i--) {
CombinationGenerator generator = new CombinationGenerator(last, i);
Expand All @@ -397,8 +406,9 @@ private List<List<Integer>> decomposeClusters(List<Point3d[]> caCoords, List<Int

// avoid combinatorial explosion, i.e. for 1FNT
BigInteger maxCombinations = BigInteger.valueOf(parameters.getMaximumLocalCombinations());
// System.out.println("maxCombinations: " + generator.getTotal());
logger.debug("Number of combinations: {}", generator.getTotal());
if (generator.getTotal().compareTo(maxCombinations) > 0) {
logger.warn("Number of combinations exceeds limit for biounit with {} subunits in groups of {} subunits. Will not check local symmetry for them", last, i);
continue;
}

Expand All @@ -424,8 +434,8 @@ private List<List<Integer>> decomposeClusters(List<Point3d[]> caCoords, List<Int
}

// check if this subset of subunits interact with each other
Graph<Integer> subGraph = graph.extractSubGraph(subSet);
if (isConnectedGraph(subGraph)) {
UndirectedGraph<Integer, DefaultEdge> subGraph = new UndirectedSubgraph<Integer, DefaultEdge>(graph, new HashSet<Integer>(subSet), null);
if (isConnectedGraph(subGraph)) {
subClusters.add(subSet);
if (subClusters.size() > parameters.getMaximumLocalResults()) {
return subClusters;
Expand Down Expand Up @@ -454,10 +464,9 @@ private static int getLastMultiSubunit(List<Integer> clusterIds) {
return clusterIds.size();
}

private static boolean isConnectedGraph(Graph<Integer> graph) {
ComponentFinder<Integer> finder = new ComponentFinder<Integer>();
finder.setGraph(graph);
return finder.getComponentCount() == 1;
private static boolean isConnectedGraph(UndirectedGraph<Integer, DefaultEdge> graph) {
ConnectivityInspector<Integer, DefaultEdge> inspector = new ConnectivityInspector<Integer, DefaultEdge>(graph);
return inspector.isGraphConnected();
}

private static List<Integer> getFolds(Integer[] subCluster, int size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,44 @@
*/
package org.biojava.nbio.structure.symmetry.core;

import org.biojava.nbio.structure.symmetry.utils.Graph;
import org.biojava.nbio.structure.symmetry.utils.SimpleGraph;

import javax.vecmath.Point3d;

import org.jgrapht.UndirectedGraph;
import org.jgrapht.graph.DefaultEdge;
import org.jgrapht.graph.SimpleGraph;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

public class SubunitGraph {
private static double DISTANCE_CUTOFF = 8;
private static int MIN_CONTACTS = 10;

private static final Logger logger = LoggerFactory
.getLogger(SubunitGraph.class);

private static final double DISTANCE_CUTOFF = 8;
private static final int MIN_CONTACTS = 10;
private List<Point3d[]> caCoords = null;

public SubunitGraph(List<Point3d[]> caCoords) {
this.caCoords = caCoords;
}

public Graph<Integer> getProteinGraph() {
public UndirectedGraph<Integer, DefaultEdge> getProteinGraph() {
int n = caCoords.size();

// add vertex for each chain center
Graph<Integer> graph = new SimpleGraph<Integer>();
UndirectedGraph<Integer, DefaultEdge> graph = new SimpleGraph<Integer, DefaultEdge>(DefaultEdge.class);
for (int i = 0; i < n; i++) {
graph.addVertex(i);
}

// add edges if there are 10 or more contact of Calpha atoms
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
// System.out.println("contacts: " + calcContactNumber(caCoords.get(i), caCoords.get(j)));
if (calcContactNumber(caCoords.get(i), caCoords.get(j)) >= MIN_CONTACTS) {
int numContacts = calcContactNumber(caCoords.get(i), caCoords.get(j));
logger.debug("Calpha contacts between subunits {},{}: {}", i, j, numContacts);
if (numContacts >= MIN_CONTACTS) {
graph.addEdge(i, j);
}
}
Expand Down

This file was deleted.

This file was deleted.

Loading