Skip to content

Commit d78ab0b

Browse files
committed
adding biojava's internal sec struc assignment to example
1 parent de7a19f commit d78ab0b

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.biojava.nbio.structure.align.util.AtomCache;
2929
import org.biojava.nbio.structure.io.FileParsingParameters;
3030
import org.biojava.nbio.structure.secstruc.DSSPParser;
31+
import org.biojava.nbio.structure.secstruc.SecStrucCalc;
3132
import org.biojava.nbio.structure.secstruc.SecStrucInfo;
3233
import org.biojava.nbio.structure.secstruc.SecStrucTools;
3334

@@ -61,21 +62,28 @@ public static void main(String[] args) throws IOException,
6162

6263
// Print the Author's assignment (from PDB file)
6364
System.out.println("Author's assignment: ");
64-
List<SecStrucInfo> ssi = SecStrucTools.getSecStrucInfo(s);
65-
for (SecStrucInfo ss : ssi) {
66-
System.out.println(ss.getGroup().getChain().getName() + " "
67-
+ ss.getGroup().getResidueNumber() + " "
68-
+ ss.getGroup().getPDBName() + " -> " + ss.toString());
69-
}
65+
printSecStruc(s);
7066

7167
// If the more detailed DSSP prediction is required call this
7268
DSSPParser.fetch(pdbID, s, true);
7369

7470
// Print the assignment residue by residue
7571
System.out.println("DSSP assignment: ");
76-
ssi = SecStrucTools.getSecStrucInfo(s);
72+
printSecStruc(s);
73+
74+
// finally use BioJava's built in DSSP-like secondary structure assigner
75+
SecStrucCalc secStrucCalc = new SecStrucCalc();
76+
77+
// calculate and assign
78+
secStrucCalc.calculate(s,true);
79+
printSecStruc(s);
80+
81+
}
82+
83+
public static void printSecStruc(Structure s){
84+
List<SecStrucInfo> ssi = SecStrucTools.getSecStrucInfo(s);
7785
for (SecStrucInfo ss : ssi) {
78-
System.out.println(ss.getGroup().getChain().getName() + " "
86+
System.out.println(ss.getGroup().getChain().getChainID() + " "
7987
+ ss.getGroup().getResidueNumber() + " "
8088
+ ss.getGroup().getPDBName() + " -> " + ss.toString());
8189
}

0 commit comments

Comments
 (0)