package org.biojava.examples;

import javax.vecmath.Point3d;

import org.apache.spark.api.java.JavaPairRDD;
import org.biojava.spark.data.StructureDataRDD;

/**
 * Example of mapping the PDB to chains of just C-alpha coords.
 * @author Anthony Bradley
 *
 */
public class MapChains {

	/**
	 * Example of mapping the PDB to chains of just C-alpha coords.
	 * @param args
	 */
	public static void main(String[] args) {

		JavaPairRDD<String, Point3d[]> calphaChains = 
				new StructureDataRDD("/Users/anthony/full")
				.filterResolution(3.0)
				.filterRfree(0.3)
				.getCalphaPair();

		

	}
}

@@ -28,84 +28,8 @@
 s;%0A%0A
-import javax.vecmath.Point3d;%0A%0Aimport org.apache.spark.api.java.JavaPairRDD;
 %0Aimp
@@ -142,16 +142,65 @@
 coords.%0A
+ * Calculate the mean C-alpha length in the PDB.%0A
  * @auth
@@ -321,16 +321,66 @@
 coords.%0A
+%09 * Calculate the mean C-alpha length in the PDB.%0A
 %09 * @par
@@ -438,54 +438,107 @@
 ) %7B%0A
+%09%09
 %0A%09%09
-JavaPairRDD%3CString, Point3d%5B%5D%3E calphaChains
+// Starter counter%0A%09%09Long startTime = System.currentTimeMillis();%0A%09%09%0A%09%09Double meanCalphaLength
  = %0A
@@ -658,14 +658,220 @@
 ir()
-;%0A%0A%09%09%0A
+%0A%09%09%09%09.mapToDouble(t -%3E t._2.length)%0A%09%09%09%09.mean();%0A%09%09%0A%09%09System.out.println(meanCalphaLength+%22 is the mean C-alpha length in the PDB%22);%0A%09%09System.out.println(%22Found in %22+(System.currentTimeMillis()-startTime)+%22 ms%22);
 %0A%09%7D%0A

Clean up the C-alpha example.