Class StructureDataRDD


  • public class StructureDataRDD
    extends java.lang.Object
    A class to provide functions on a series of StructureDataInterface objects.
    Author:
    Anthony Bradley
    • Constructor Detail

      • StructureDataRDD

        public StructureDataRDD()
        Empty constructor reads the sample data if SparkUtils has 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 a JavaPairRDD of String and StructureDataInterface.
        Parameters:
        javaPairRDD - the input JavaPairRDD of String StructureDataInterface
      • StructureDataRDD

        public StructureDataRDD​(java.util.List<java.lang.String> pdbIdList)
                         throws java.io.IOException
        Constructor 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.IOException
        Construtor 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 the JavaPairRDD of String StructureDataInterface for this instance
        Returns:
        the JavaPairRDD of String StructureDataInterface
      • filterRfree

        public StructureDataRDD filterRfree​(double maxRFree,
                                            double minRFree)
        Filter the StructureDataRDD based on R-free.
        Parameters:
        maxRFree - the maximum allowed R-free
        minRFree - the minimum allowed R-free
        Returns:
        the filtered StructureDataRDD
      • filterResolution

        public StructureDataRDD filterResolution​(double maxRes,
                                                 double minRes)
        Filter the StructureDataRDD based 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 the Point3d of the C-alpha co-ordinate data as lightweight point 3d objects.
        Returns:
        the segment data array
      • getFragments

        public SegmentDataRDD getFragments​(int fragSize)
        Get the Point3d of 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
      • size

        public java.lang.Long size()
        Get the number of entries in the RDD.
        Returns:
        the Long number 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 SegmentDataRDD updated