-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCountContacts.java
More file actions
84 lines (68 loc) · 2.28 KB
/
CountContacts.java
File metadata and controls
84 lines (68 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package demo;
import java.util.List;
import org.biojava.spark.utils.BiojavaSparkUtils;
import org.rcsb.mmtf.spark.data.AtomSelectObject;
import org.rcsb.mmtf.spark.data.StructureDataRDD;
import org.rcsb.mmtf.spark.utils.SparkUtils;
/**
* An example reading the PDB and finding the mean C-alpha
* to C-alpha distance between Proline and Lysine.
* @author Anthony Bradley
*
*/
public class CountContacts {
private static final double cutoff = 5.0;
/**
* An example reading the PDB and finding the mean C-alpha
* to C-alpha distance between Proline and Lysine.
* @param args
*/
public static void main(String[] args) {
// assumes that files are in installed in $HOME/mmtf/full/
String userHome = System.getProperty("user.home");
// Starter counter
Long startTime = System.currentTimeMillis();
// Get the atom contacts
Double mean = BiojavaSparkUtils.findContacts(new StructureDataRDD(userHome+"/mmtf/full"),
new AtomSelectObject()
.elementNameList(new String[] {"C"})
.groupNameList(new String[] {"PRO","LYS"})
.atomNameList(new String[] {"CA"}),
cutoff)
.getDistanceDistOfAtomInts("CA", "CA")
.mean();
System.out.println("\nMean CA-CA distance: "+mean);
System.out.println("Found in "+(System.currentTimeMillis()-startTime)+" ms");
SparkUtils.shutdown();
}
/**
* Example of finding C-alpha C-alpha contacts.
*/
public static void findCalphaCalphaContacts() {
long count = BiojavaSparkUtils.findContacts(
new StructureDataRDD(), new AtomSelectObject().atomNameList(new String[]{"CA"}), cutoff)
.countInterElementContacts("C", "C");
System.out.println(count);
}
/**
* Example of finding N O charged contacts.
*/
public static void findNOChargedContacts(){
long count = BiojavaSparkUtils.findContacts(
new StructureDataRDD(), new AtomSelectObject().charged(true), cutoff)
.countInterElementContacts("N", "O");
System.out.println(count);
}
/**
* Example of finding Fe His contacts.
*/
public static void findFeHisContacts() {
List<String> pdbIds = BiojavaSparkUtils.
findContacts(new StructureDataRDD(),
new AtomSelectObject().groupNameList(new String[]{"HIS"}),
new AtomSelectObject().atomNameList(new String[]{"Fe"}),
cutoff).
getGroupIds();
System.out.println(pdbIds);
}
}