Class MapperUtils

  • All Implemented Interfaces:
    java.io.Serializable

    public class MapperUtils
    extends java.lang.Object
    implements java.io.Serializable
    A class to preserve the log if the functions in mappers. Mappers should not contain logic - as they are hard to test.
    Author:
    Anthony Bradley
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      MapperUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.biojava.nbio.structure.Structure byteArrToBiojavaStruct​(java.lang.String pdbCodePlus, byte[] inputByteArr)
      Converts a byte array of the messagepack (mmtf) to a Biojava structure.
      static org.apache.spark.api.java.JavaPairRDD<org.apache.hadoop.io.Text,​org.apache.hadoop.io.BytesWritable> generateRdd​(java.util.List<java.lang.String> inputList, java.lang.String ccdUrl)
      PDB RDD generator.
      static scala.Tuple2<java.lang.String,​byte[]> getByteArray​(java.lang.String pdbId)
      Get the available data as a byte array from an input PDB id.
      static scala.Tuple2<java.lang.String,​byte[]> getByteArray​(java.lang.String pdbId, java.lang.String producer)
      Get the available data as a byte array from an input PDB id.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MapperUtils

        public MapperUtils()
    • Method Detail

      • byteArrToBiojavaStruct

        public static org.biojava.nbio.structure.Structure byteArrToBiojavaStruct​(java.lang.String pdbCodePlus,
                                                                                  byte[] inputByteArr)
                                                                           throws java.io.IOException
        Converts a byte array of the messagepack (mmtf) to a Biojava structure.
        Parameters:
        pdbCodePlus - The pdb code is the first four characters. Additional characters can be used.
        inputByteArr - The message pack bytre array to be decoded.
        Returns:
        the decoded and inflated structure
        Throws:
        java.io.IOException
      • generateRdd

        public static org.apache.spark.api.java.JavaPairRDD<org.apache.hadoop.io.Text,​org.apache.hadoop.io.BytesWritable> generateRdd​(java.util.List<java.lang.String> inputList,
                                                                                                                                            java.lang.String ccdUrl)
        PDB RDD generator. Converts a list of pdb ids to a JavaPairRDD with key Text and value BytesWritable.
        Parameters:
        sparkContext - the input JavaSparkContext
        inputList - a List of Strings of the input PDB ids
        Returns:
        a JavaPairRDD with key Text and value BytesWritable
      • getByteArray

        public static scala.Tuple2<java.lang.String,​byte[]> getByteArray​(java.lang.String pdbId)
                                                                        throws java.io.IOException,
                                                                               org.biojava.nbio.structure.StructureException
        Get the available data as a byte array from an input PDB id.
        Parameters:
        pdbId - the input PDB id
        Returns:
        the data as a byte array
        Throws:
        org.biojava.nbio.structure.StructureException - an error parsing the Structure using Biojava
        java.io.IOException - an error accessing the file
      • getByteArray

        public static scala.Tuple2<java.lang.String,​byte[]> getByteArray​(java.lang.String pdbId,
                                                                               java.lang.String producer)
                                                                        throws java.io.IOException,
                                                                               org.biojava.nbio.structure.StructureException
        Get the available data as a byte array from an input PDB id.
        Parameters:
        pdbId - the input PDB id
        Returns:
        the data as a byte array
        Throws:
        org.biojava.nbio.structure.StructureException - an error parsing the Structure using Biojava
        java.io.IOException - an error accessing the file