Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public String toString(){

Class<?> c = Class.forName(PDBHeader.class.getName());
Method[] methods = c.getMethods();

Arrays.sort(methods, (o1, o2)-> o1.getName().compareTo(o2.getName()));

for (Method m : methods) {
String name = m.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ public static String toMMCIF(String categoryName, Object o) {
public static Field[] getFields(Class<?> c) {
Field[] allFields = c.getDeclaredFields();
Field[] fields = new Field[allFields.length];

Arrays.sort(allFields, (o1, o2)-> o2.getName().compareTo(o1.getName()));

int n = 0;
for(Field f : allFields) {
f.setAccessible(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,8 @@ private Object buildObject(String className, List<String> loopFields, List<Strin

try {
if ( pType[0].getName().equals(Integer.class.getName())) {
if ( val != null && ! val.equals("?") && !val.equals(".")) {
// if ( val != null && ! val.equals("?") && !val.equals(".")) {
if(checkIfValidStrForIntConversion(val)) {

Integer intVal = Integer.parseInt(val);
setter.invoke(o, intVal);
Expand All @@ -1039,6 +1040,20 @@ private Object buildObject(String className, List<String> loopFields, List<Strin

return o;
}

private boolean checkIfValidStrForIntConversion(String val) {

//if ( val != null || ! val.equals("?") || !val.equals(".") || !val.contains(".") )

if(val == null || val.isEmpty())
return false;

for(char ch : val.toCharArray()) {
if(ch < '0' || ch > '9')
return false;
}
return true;
}

private void produceWarning(String key, String val, Class<?> c, Set<String> warnings) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -105,7 +106,7 @@ public class MmtfStructureReader implements StructureAdapterInterface, Serializa
private List<Chain> chainList;

/** All the chains as a list of maps */
private List<Map<String,Chain>> chainMap;
private List<LinkedHashMap<String,Chain>> chainMap;

private List<double[]> transformList;

Expand Down Expand Up @@ -178,7 +179,7 @@ public void setModelInfo(int inputModelNumber,
int chainCount) {
modelNumber = inputModelNumber;
structure.addModel(new ArrayList<Chain>(chainCount));
chainMap.add(new HashMap<>());
chainMap.add(new LinkedHashMap<>());
}

/* (non-Javadoc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void testBiounitWriting() {
String[] lines = mmcif.split("\n");
long atomLines = Arrays.stream(lines).filter(l -> l.startsWith("ATOM")).count();
assertNotNull(mmcif);
assertEquals(4, atomLines);
assertEquals(0, atomLines);
}

private static Structure createDummyStructure() {
Expand Down