1313import org .rcsb .mmtf .encoder .DataApiToBean ;
1414import org .rcsb .mmtf .encoder .WriterToDataApi ;
1515import org .rcsb .mmtf .serializers .MessagePackSerializer ;
16+ import org .rcsb .mmtf .utils .DownloadUtils ;
1617
1718public class MmtfActions {
1819
20+ /**
21+ * Utility function to get a Biojava structure from a PDB code.
22+ * @param pdbCode the pdb code of the structure you desire
23+ * @return a Biojava structure object relating to the input PDB code
24+ * @throws IOException
25+ */
26+ public static Structure getBiojavaStruct (String pdbCode ) throws IOException {
27+ return getBiojavaStruct (DownloadUtils .getDataFromUrl (pdbCode ));
28+ }
29+
1930 /**
2031 * Utility function to get a Biojava structure from a byte array.
2132 * @param inputByteArray Must be uncompressed (i.e. with entropy compression methods like gzip)
22- * @param parsingParams
23- * @return
33+ * @return a Biojava structure object relating to the input byte array.
2434 * @throws IOException
2535 */
2636 public static Structure getBiojavaStruct (byte [] inputByteArray ) throws IOException {
@@ -41,9 +51,9 @@ public static Structure getBiojavaStruct(byte[] inputByteArray) throws IOExcepti
4151 }
4252
4353 /**
44- *
45- * @param pdbId
46- * @return
54+ * Get the byte array (messagepack encoded) of the PDB code you desire.
55+ * @param pdbId the input PDB id for the structure you want
56+ * @return the byte array of the structure compressed and message pack encoded
4757 * @throws IOException
4858 * @throws StructureException
4959 */
@@ -53,10 +63,9 @@ public static byte[] getByteArray(String pdbId) throws IOException, StructureExc
5363 }
5464
5565 /**
56- * Utility function to get a byte array from a Biojava structure
57- * @param inputByteArray Must be uncompressed (i.e. with entropy compression methods like gzip)
58- * @param parsingParams
59- * @return
66+ * Utility function to get a byte array from a Biojava structure.
67+ * @param structure the input Biojava structure object
68+ * @return the byte array of the structure compressed and message pack encoded
6069 * @throws IOException
6170 */
6271 public static byte [] getByteArray (Structure structure ) throws IOException {
@@ -65,10 +74,9 @@ public static byte[] getByteArray(Structure structure) throws IOException {
6574 }
6675
6776 /**
68- * Utility function to get an mmtf bean from a Biojava structure
69- * @param inputByteArray Must be uncompressed (i.e. with entropy compression methods like gzip)
70- * @param parsingParams
71- * @return
77+ * Utility function to get an mmtf bean from a Biojava structure.
78+ * @param structure the input Biojava structure object
79+ * @return the raw (compressed) data as an MmtfBean object
7280 * @throws IOException
7381 */
7482 public static MmtfBean getBean (Structure structure ) throws IOException {
@@ -78,10 +86,9 @@ public static MmtfBean getBean(Structure structure) throws IOException {
7886 }
7987
8088 /**
81- * Utility function to get an mmtf bean from a Biojava structure
82- * @param inputByteArray Must be uncompressed (i.e. with entropy compression methods like gzip)
83- * @param parsingParams
84- * @return
89+ * Utility function to get an mmtf bean from a PDB id.
90+ * @param pdbId the input PDB id for the structure you want
91+ * @return the byte array of the structure compressed and message pack encoded
8592 * @throws IOException
8693 * @throws StructureException
8794 */
@@ -92,10 +99,9 @@ public static MmtfBean getBean(String pdbId) throws IOException, StructureExcept
9299 }
93100
94101 /**
95- * Utility function to get an mmtf bean from a Biojava structure
96- * @param inputByteArray Must be uncompressed (i.e. with entropy compression methods like gzip)
97- * @param parsingParams
98- * @return
102+ * Utility function to get an API to the data from a Biojava structure
103+ * @param structure the input Biojava structure object
104+ * @return the API to the data in the form of an MmtfDecodedDataInterface
99105 * @throws IOException
100106 */
101107 public static MmtfDecodedDataInterface getApi (Structure structure ) throws IOException {
@@ -110,10 +116,9 @@ public static MmtfDecodedDataInterface getApi(Structure structure) throws IOExce
110116 }
111117
112118 /**
113- * Utility function to get an mmtf bean from a Biojava structure
114- * @param inputByteArray Must be uncompressed (i.e. with entropy compression methods like gzip)
115- * @param parsingParams
116- * @return
119+ * Utility function to get an API to the data from a PDB code.
120+ * @param pdbId the input PDB id for the structure you want
121+ * @return the API to the data in the form of an MmtfDecodedDataInterface
117122 * @throws IOException
118123 * @throws StructureException
119124 */
@@ -130,8 +135,8 @@ public static MmtfDecodedDataInterface getApi(String pdbId) throws IOException,
130135 }
131136
132137 /**
133- * Round trip a given structure. Mainly for testing purposes
134- * @param structure the input structure
138+ * Round trip a given structure. Mainly for testing purposes.
139+ * @param structure the input Biojava structure object
135140 * @return the round tripped structure (conversion to messge pack mmtf and back).
136141 * @throws IOException
137142 */
0 commit comments