Skip to content

Commit c4e8ff9

Browse files
committed
Fixes #770, bioassemblies are now kept in the same order as read in from
file.
1 parent a75c18d commit c4e8ff9

File tree

1 file changed

+4
-2
lines changed
  • biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf

1 file changed

+4
-2
lines changed

biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.Date;
2727
import java.util.HashMap;
2828
import java.util.HashSet;
29+
import java.util.LinkedHashMap;
2930
import java.util.List;
3031
import java.util.Map;
3132
import java.util.Map.Entry;
@@ -243,7 +244,7 @@ public static String dateToIsoString(Date inputDate) {
243244
* @return the bioassembly information (as primitive types).
244245
*/
245246
public static Map<double[], int[]> getTransformMap(BioAssemblyInfo bioassemblyInfo, Map<String, Integer> chainIdToIndexMap) {
246-
Map<Matrix4d, List<Integer>> matMap = new HashMap<>();
247+
Map<Matrix4d, List<Integer>> matMap = new LinkedHashMap<>();
247248
List<BiologicalAssemblyTransformation> transforms = bioassemblyInfo.getTransforms();
248249
for (BiologicalAssemblyTransformation transformation : transforms) {
249250
Matrix4d transMatrix = transformation.getTransformationMatrix();
@@ -261,7 +262,8 @@ public static Map<double[], int[]> getTransformMap(BioAssemblyInfo bioassemblyIn
261262
matMap.put(transMatrix, chainIdList);
262263
}
263264
}
264-
Map<double[], int[]> outMap = new HashMap<>();
265+
266+
Map<double[], int[]> outMap = new LinkedHashMap<>();
265267
for (Entry<Matrix4d, List<Integer>> entry : matMap.entrySet()) {
266268
outMap.put(convertToDoubleArray(entry.getKey()), CodecUtils.convertToIntArray(entry.getValue()));
267269
}

0 commit comments

Comments
 (0)