44import java .text .DateFormat ;
55import java .text .SimpleDateFormat ;
66import java .util .ArrayList ;
7+ import java .util .Arrays ;
78import java .util .Date ;
89import java .util .HashMap ;
910import java .util .HashSet ;
@@ -64,7 +65,9 @@ public static AtomCache setUpBioJava() {
6465 }
6566
6667 /**
67- * Set up the configuration parameters for BioJava. - with an extra URL
68+ * Set up the configuration parameters for BioJava.
69+ * @param extraUrl the string describing the URL (or file path) from which
70+ * to get missing CCD entries.
6871 */
6972 public static AtomCache setUpBioJava (String extraUrl ) {
7073 // Set up the atom cache etc
@@ -122,7 +125,7 @@ public static void fixMicroheterogenity(Structure bioJavaStruct) {
122125
123126
124127 /**
125- * Function to generate the secondary structure for a Biojava structure object.
128+ * Generate the secondary structure for a Biojava structure object.
126129 * @param bioJavaStruct the Biojava structure for which it is to be calculate.
127130 */
128131 public static void calculateDsspSecondaryStructure (Structure bioJavaStruct ) {
@@ -273,7 +276,7 @@ public static int getNumGroups(Structure structure) {
273276
274277
275278 /**
276- * Function to get a list of atoms for a group. Only add each atom once.
279+ * Get a list of atoms for a group. Only add each atom once.
277280 * @param inputGroup the Biojava Group to consider
278281 * @return the atoms for the input Biojava Group
279282 */
@@ -354,7 +357,7 @@ public static void setSecStructType(Group group, int dsspIndex) {
354357
355358
356359 /**
357- * Helper function to set the DSSP type based on a numerical index.
360+ * Set the DSSP type based on a numerical index.
358361 * @param dsspIndex the integer index of the type to set
359362 * @return the instance of the SecStrucType object holding this secondary
360363 * structure type.
@@ -373,7 +376,7 @@ public static SecStrucType getSecStructTypeFromDsspIndex(int dsspIndex) {
373376 }
374377
375378 /**
376- * Function to get summary information for the structure.
379+ * Get summary information for the structure.
377380 * @param structure the structure for which to get the information.
378381 */
379382 public static MmtfSummaryDataBean getStructureInfo (Structure structure ) {
@@ -412,4 +415,41 @@ public static MmtfSummaryDataBean getStructureInfo(Structure structure) {
412415 return mmtfSummaryDataBean ;
413416
414417 }
418+
419+ /**
420+ * Get a list of N 4*4 matrices from a single list of doubles of length 16*N.
421+ * @param ncsOperMatrixList the input list of doubles
422+ * @return the list of 4*4 matrics
423+ */
424+ public static Matrix4d [] getNcsAsMatrix4d (double [] ncsOperMatrixList ) {
425+ if (ncsOperMatrixList ==null ){
426+ return new Matrix4d [0 ];
427+ }
428+ int numMats = ncsOperMatrixList .length /16 ;
429+ Matrix4d [] outList = new Matrix4d [numMats ];
430+ for (int i =0 ; i <numMats ; i ++){
431+ double [] inputData = Arrays .copyOfRange (ncsOperMatrixList , i *0 , (i +1 )*16 );
432+ outList [i ] = new Matrix4d (inputData );
433+ }
434+ return outList ;
435+ }
436+
437+ /**
438+ * Get a list of length N*16 of a list of Matrix4d*N.
439+ * @param ncsOperators the {@link Matrix4d} list
440+ * @return the list of length N*16 of the list of matrices
441+ */
442+ public static double [] getNcsAsArray (Matrix4d [] ncsOperators ) {
443+ if (ncsOperators ==null ){
444+ return new double [0 ];
445+ }
446+ double [] outList = new double [ncsOperators .length *16 ];
447+ for (int i =0 ; i <ncsOperators .length ;i ++){
448+ double [] doubleList = convertToDoubleArray (ncsOperators [i ]);
449+ for (int j =0 ; j <16 ; j ++){
450+ outList [i *16 +j ] = doubleList [j ];
451+ }
452+ }
453+ return outList ;
454+ }
415455}
0 commit comments