-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCountElements.java
More file actions
35 lines (25 loc) · 921 Bytes
/
CountElements.java
File metadata and controls
35 lines (25 loc) · 921 Bytes
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
package demo;
import java.util.Map;
import org.biojava.spark.utils.BiojavaSparkUtils;
import org.rcsb.mmtf.spark.data.StructureDataRDD;
/**
* An example reading the PDB and finding the mean frequency of
* every element in the PDB.
* @author Anthony Bradley
*/
public class CountElements {
/**
* An example reading the PDB and finding the mean frequency of
* every element in the PDB.
* @param args
*/
public static void main(String[] args) {
// Starter counter
Long startTime = System.currentTimeMillis();
// assumes that files are in installed in $HOME/mmtf/full/
String userHome = System.getProperty("user.home");
Map<String, Long> elementCountMap = BiojavaSparkUtils.findAtoms(new StructureDataRDD(userHome + "/mmtf/full")).countByElement();
System.out.println("\nElement map"+elementCountMap);
System.out.println("Found in "+(System.currentTimeMillis()-startTime)+" ms");
}
}