Skip to content

Commit c5edbcb

Browse files
committed
Update DemoLoadSecStruc with new features
1 parent db6bf86 commit c5edbcb

1 file changed

Lines changed: 29 additions & 23 deletions

File tree

biojava-structure/src/main/java/demo/DemoLoadSecStruc.java

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,45 +20,51 @@
2020
*/
2121
package demo;
2222

23+
import java.io.IOException;
24+
2325
import org.biojava.nbio.structure.Chain;
2426
import org.biojava.nbio.structure.Group;
2527
import org.biojava.nbio.structure.Structure;
28+
import org.biojava.nbio.structure.StructureException;
2629
import org.biojava.nbio.structure.align.util.AtomCache;
2730
import org.biojava.nbio.structure.io.FileParsingParameters;
31+
import org.biojava.nbio.structure.secstruc.DSSPParser;
2832
import org.biojava.nbio.structure.secstruc.SecStrucInfo;
2933

3034
public class DemoLoadSecStruc {
3135

32-
public static void main(String[] args){
33-
34-
try {
35-
FileParsingParameters params = new FileParsingParameters();
36-
params.setParseSecStruc(true);
36+
public static void main(String[] args)
37+
throws IOException, StructureException {
38+
39+
String pdbID = "5pti";
40+
41+
FileParsingParameters params = new FileParsingParameters();
42+
//Only change needed to the normal Structure loading
43+
params.setParseSecStruc(true); //this is false as DEFAULT
3744

38-
AtomCache cache = new AtomCache();
39-
cache.setFileParsingParams(params);
40-
cache.setUseMmCif(false);
45+
AtomCache cache = new AtomCache();
46+
cache.setFileParsingParams(params);
47+
cache.setUseMmCif(false);
4148

42-
Structure s = cache.getStructure("4pti");
49+
//The loaded Structure contains the SS assigned by Author
50+
Structure s = cache.getStructure(pdbID);
51+
52+
//If the more detailed DSSP prediction is required call this
53+
DSSPParser.fetch(pdbID, s, true);
4354

44-
for ( Chain c : s.getChains()) {
45-
for (Group g: c.getAtomGroups()){
55+
for (Chain c : s.getChains()) {
56+
for (Group g: c.getAtomGroups()){
4657

47-
if ( g.hasAminoAtoms() ){
58+
if (g.hasAminoAtoms()){
4859

49-
SecStrucInfo ss =
50-
(SecStrucInfo) g.getProperty(Group.SEC_STRUC);
60+
SecStrucInfo ss =
61+
(SecStrucInfo) g.getProperty(Group.SEC_STRUC);
5162

52-
System.out.println(c.getChainID() +
53-
" " + g.getResidueNumber() + " "
54-
+ g.getPDBName() + " " + ss);
55-
}
63+
System.out.println(c.getChainID() +
64+
" " + g.getResidueNumber() + " "
65+
+ g.getPDBName() + ": " + ss.getType());
5666
}
5767
}
58-
59-
} catch (Exception e) {
60-
61-
e.printStackTrace();
62-
}
68+
}
6369
}
6470
}

0 commit comments

Comments
 (0)