Skip to content

Commit 456af9d

Browse files
authored
Update secstruc.md
1 parent 028ff37 commit 456af9d

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

structure/secstruc.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,60 @@ H1: 48 - 55
196196
You can find examples of how to get the different file formats in the class `DemoSecStrucPred` in the **demo**
197197
package.
198198

199+
### Example
200+
201+
This is taken from the DemoLoadSecStruc example in the **demo** package.
202+
203+
```java
204+
public static void main(String[] args) throws IOException,
205+
StructureException {
206+
207+
String pdbID = "5pti";
208+
209+
// Only change needed to the DEFAULT Structure loading
210+
FileParsingParameters params = new FileParsingParameters();
211+
params.setParseSecStruc(true);
212+
213+
AtomCache cache = new AtomCache();
214+
cache.setFileParsingParams(params);
215+
216+
// Use PDB format, because SS cannot be parsed from mmCIF yet
217+
cache.setUseMmCif(false);
218+
219+
// The loaded Structure contains the SS assigned by Author (simple)
220+
Structure s = cache.getStructure(pdbID);
221+
222+
// Print the Author's assignment (from PDB file)
223+
System.out.println("Author's assignment: ");
224+
printSecStruc(s);
225+
226+
// If the more detailed DSSP prediction is required call this
227+
DSSPParser.fetch(pdbID, s, true);
228+
229+
// Print the assignment residue by residue
230+
System.out.println("DSSP assignment: ");
231+
printSecStruc(s);
232+
233+
// finally use BioJava's built in DSSP-like secondary structure assigner
234+
SecStrucCalc secStrucCalc = new SecStrucCalc();
235+
236+
// calculate and assign
237+
secStrucCalc.calculate(s,true);
238+
printSecStruc(s);
239+
240+
}
241+
242+
public static void printSecStruc(Structure s){
243+
List<SecStrucInfo> ssi = SecStrucTools.getSecStrucInfo(s);
244+
for (SecStrucInfo ss : ssi) {
245+
System.out.println(ss.getGroup().getChain().getName() + " "
246+
+ ss.getGroup().getResidueNumber() + " "
247+
+ ss.getGroup().getPDBName() + " -> " + ss.toString());
248+
}
249+
}
250+
```
251+
252+
199253
<!--automatically generated footer-->
200254

201255
---

0 commit comments

Comments
 (0)