Package org.rcsb.mmtf.spark.data
Class StructureDataRDD
- java.lang.Object
-
- org.rcsb.mmtf.spark.data.StructureDataRDD
-
public class StructureDataRDD extends java.lang.ObjectA class to provide functions on a series ofStructureDataInterfaceobjects.- Author:
- Anthony Bradley
-
-
Constructor Summary
Constructors Constructor Description StructureDataRDD()Empty constructor reads the sample data ifSparkUtilshas not been set with a path.StructureDataRDD(java.lang.String inputPath)Constructor from a file.StructureDataRDD(java.lang.String[] pdbIdArray)Construtor from an array of PDB ids.StructureDataRDD(java.util.List<java.lang.String> pdbIdList)Constructor from a list of PDB ids.StructureDataRDD(org.apache.spark.api.java.JavaPairRDD<java.lang.String,org.rcsb.mmtf.api.StructureDataInterface> javaPairRDD)Constructor from aJavaPairRDDofStringandStructureDataInterface.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StructureDataRDDcache()Cache the underlying RDD.StructureDataRDDfilterResolution(double maxRes)Filter theStructureDataRDDbased on resolution.StructureDataRDDfilterResolution(double maxRes, double minRes)Filter theStructureDataRDDbased on resolution.StructureDataRDDfilterRfree(double maxRFree)Filter theStructureDataRDDbased on R-free.StructureDataRDDfilterRfree(double maxRFree, double minRFree)Filter theStructureDataRDDbased on R-free.AtomDatasetgetAtoms()Get the atoms in theStructureDataRDDas anAtomDataset.SegmentDataRDDgetCalpha()Get thePoint3dof the C-alpha co-ordinate data as lightweight point 3d objects.SegmentDataRDDgetFragments(int fragSize)Get thePoint3dof the C-alpha co-ordinate data as lightweight point 3d objects.org.apache.spark.api.java.JavaPairRDD<java.lang.String,org.rcsb.mmtf.api.StructureDataInterface>getJavaRdd()Get theJavaPairRDDofStringStructureDataInterfacefor this instanceStructureDataRDDgetReduced()Covert theStructureDataRDDto the reduced format.StructureDataRDDsample(double fraction)Allow the user to sample the data.voidsaveToFile(java.lang.String filePath)Save the data as a Hadoop sequence file.java.lang.Longsize()Get the number of entries in the RDD.
-
-
-
Constructor Detail
-
StructureDataRDD
public StructureDataRDD()
Empty constructor reads the sample data ifSparkUtilshas not been set with a path.
-
StructureDataRDD
public StructureDataRDD(java.lang.String inputPath)
Constructor from a file.- Parameters:
inputPath- the input path of the Hadoop sequence file to read
-
StructureDataRDD
public StructureDataRDD(org.apache.spark.api.java.JavaPairRDD<java.lang.String,org.rcsb.mmtf.api.StructureDataInterface> javaPairRDD)
Constructor from aJavaPairRDDofStringandStructureDataInterface.- Parameters:
javaPairRDD- the inputJavaPairRDDofStringStructureDataInterface
-
StructureDataRDD
public StructureDataRDD(java.util.List<java.lang.String> pdbIdList) throws java.io.IOExceptionConstructor from a list of PDB ids.- Parameters:
pdbIdList- the input list of PDB ids- Throws:
java.io.IOException- due to reading from the URL
-
StructureDataRDD
public StructureDataRDD(java.lang.String[] pdbIdArray) throws java.io.IOExceptionConstrutor from an array of PDB ids.- Parameters:
pdbIdArray- the input array of PDB ids- Throws:
java.io.IOException- due to reading from the URL
-
-
Method Detail
-
getJavaRdd
public org.apache.spark.api.java.JavaPairRDD<java.lang.String,org.rcsb.mmtf.api.StructureDataInterface> getJavaRdd()
Get theJavaPairRDDofStringStructureDataInterfacefor this instance- Returns:
- the
JavaPairRDDofStringStructureDataInterface
-
filterRfree
public StructureDataRDD filterRfree(double maxRFree)
Filter theStructureDataRDDbased on R-free.- Parameters:
maxRFree- the maximum allowed R-free- Returns:
- the filtered
StructureDataRDD
-
filterRfree
public StructureDataRDD filterRfree(double maxRFree, double minRFree)
Filter theStructureDataRDDbased on R-free.- Parameters:
maxRFree- the maximum allowed R-freeminRFree- the minimum allowed R-free- Returns:
- the filtered
StructureDataRDD
-
filterResolution
public StructureDataRDD filterResolution(double maxRes)
Filter theStructureDataRDDbased on resolution.- Parameters:
maxRes- the maximum allowed resolution (in Angstrom)- Returns:
- the filtered
StructureDataRDD
-
filterResolution
public StructureDataRDD filterResolution(double maxRes, double minRes)
Filter theStructureDataRDDbased on resolution.- Parameters:
maxRes- the maximum allowed resolution (in Angstrom)minRes- the minimum allowed resolution (in Angstrom)- Returns:
- the filtered
StructureDataRDD
-
getCalpha
public SegmentDataRDD getCalpha()
Get thePoint3dof the C-alpha co-ordinate data as lightweight point 3d objects.- Returns:
- the segment data array
-
getReduced
public StructureDataRDD getReduced()
Covert theStructureDataRDDto the reduced format.- Returns:
- the
StructureDataRDDof the reduced format
-
getFragments
public SegmentDataRDD getFragments(int fragSize)
Get thePoint3dof the C-alpha co-ordinate data as lightweight point 3d objects. Fragmented based on size. The fragments are continuous and overlapping.- Parameters:
fragSize- the size of every fragment- Returns:
- the fragments as an RDD
-
getAtoms
public AtomDataset getAtoms()
Get the atoms in theStructureDataRDDas anAtomDataset.- Returns:
- the
AtomDatasetgenerated.
-
size
public java.lang.Long size()
Get the number of entries in the RDD.- Returns:
- the
Longnumber of entries
-
saveToFile
public void saveToFile(java.lang.String filePath)
Save the data as a Hadoop sequence file.- Parameters:
filePath- the path to save the data to
-
sample
public StructureDataRDD sample(double fraction)
Allow the user to sample the data.- Parameters:
fraction- the fraction of data to be used (e.g. 0.1 retains 10%)- Returns:
- the
SegmentDataRDDupdated
-
cache
public StructureDataRDD cache()
Cache the underlying RDD.- Returns:
- the cached
StructureDataRDD
-
-