Package org.biojava.spark.mappers
Class MapperUtils
- java.lang.Object
-
- org.biojava.spark.mappers.MapperUtils
-
- All Implemented Interfaces:
java.io.Serializable
public class MapperUtils extends java.lang.Object implements java.io.SerializableA 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.StructurebyteArrToBiojavaStruct(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.
-
-
-
Method Detail
-
byteArrToBiojavaStruct
public static org.biojava.nbio.structure.Structure byteArrToBiojavaStruct(java.lang.String pdbCodePlus, byte[] inputByteArr) throws java.io.IOExceptionConverts 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 aJavaPairRDDwith keyTextand valueBytesWritable.- Parameters:
sparkContext- the inputJavaSparkContextinputList- aListof Strings of the input PDB ids- Returns:
- a
JavaPairRDDwith keyTextand valueBytesWritable
-
getByteArray
public static scala.Tuple2<java.lang.String,byte[]> getByteArray(java.lang.String pdbId) throws java.io.IOException, org.biojava.nbio.structure.StructureExceptionGet 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 theStructureusing Biojavajava.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.StructureExceptionGet 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 theStructureusing Biojavajava.io.IOException- an error accessing the file
-
-