From: <ha...@us...> - 2013-01-19 22:12:55
|
Revision: 17873 http://jmol.svn.sourceforge.net/jmol/?rev=17873&view=rev Author: hansonr Date: 2013-01-19 22:12:47 +0000 (Sat, 19 Jan 2013) Log Message: ----------- implements reading Schroedinger/NAMD -hex 99999/9999+ option in PDB reader. Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/PdbReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/PdbReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/PdbReader.java 2013-01-19 21:26:24 UTC (rev 17872) +++ trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/PdbReader.java 2013-01-19 22:12:47 UTC (rev 17873) @@ -195,7 +195,7 @@ .indexOf(line.substring(0, 6))) >> 3; boolean isAtom = (ptOption == 0 || ptOption == 1); boolean isModel = (ptOption == 2); - int serial = (isAtom ? parseIntRange(line, 6, 11) : 0); + serial = (isAtom ? getSerial() : 0); boolean isNewModel = ((isTrajectory || isSequential) && !isMultiModel && isAtom && serial == 1); if (getHeader) { @@ -233,7 +233,7 @@ return true; if (isAtom) { getHeader = false; - atom(serial); + atom(); return true; } switch (ptOption) { @@ -664,7 +664,37 @@ } } - // Note that segID (columns 73-76) is not generally read, + + // Schroedinger perversion + // https://www.schrodinger.com/AcrobatFile.php?type=supportdocs&type2=&ident=530 + // assumes sequential numbers with atom 99999 or seq 9999 present + // otherwise "20000" before atom 99999 is different from "20000" after ??? + + private boolean isHexSerial; + private boolean isHexSeq; + private int serial; + + private char currentChainID; + + private int getSerial() { + if (isHexSerial) + return serial = Integer.parseInt(line.substring(6, 11), 16); + serial = parseIntRange(line, 6, 11); + if (serial == 99999) + isHexSerial = true; + return serial; + } + + private int getSeqNo() { + if (isHexSeq) + return Integer.parseInt(line.substring(22, 26), 16); + int n = parseIntRange(line, 22, 26); + if (n == 9999) + isHexSeq = true; + return n; + } + +// Note that segID (columns 73-76) is not generally read, // but can be read into the atomType atom property // starting in Jmol 13.1.12 using FILTER "type 73,4" @@ -674,7 +704,7 @@ //01234567890123456789012345678901234567890123456789012345678901234567890123456789 //aaaaaauuuuu ssss sss cnnnnc xxxxxxxxxxyyyyyyyyyyzzzzzzzzzzccccccccrrrrrrrr - private void atom(int serial) { + private void atom() { Atom atom = new Atom(); atom.atomName = line.substring(12, 16).trim(); char ch = line.charAt(16); @@ -685,7 +715,12 @@ if (chainAtomCounts != null) chainAtomCounts[ch]++; atom.chainID = ch; - atom.sequenceNumber = parseIntRange(line, 22, 26); + atom.sequenceNumber = getSeqNo(); + if (isHexSeq && ch != currentChainID) { + currentChainID = ch; + if (atom.sequenceNumber < 9999) + isHexSeq = false; + } atom.insertionCode = JmolAdapter.canonizeInsertionCode(line.charAt(26)); atom.isHetero = line.startsWith("HETATM"); atom.elementSymbol = deduceElementSymbol(atom.isHetero); @@ -1070,6 +1105,7 @@ * number right after the word MODEL :-( ****************************************************************/ checkNotPDB(); + isHexSerial = false; haveMappedSerials = false; sbConect = null; atomSetCollection.newAtomSet(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |