Skip to content

Commit fd1d94d

Browse files
authored
Merge pull request #33 from lemora/fix/repair-examples
Update/fix examples in structure-data-model
2 parents ac806c2 + 22cfb22 commit fd1d94d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

structure/structure-data-model.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Structure
2828
All `Structure` objects contain one or more `Models`. That means also X-ray structures contain a "virtual" model which serves as a container for the chains. This allows to represent multi-model X-ray structures, e.g. from time-series analysis. The most common way to access chains is via:
2929

3030
```java
31-
List <Chain> chains = structure.getChains();
31+
List<Chain> chains = structure.getChains();
3232
```
3333

3434
This works for both NMR and X-ray based structures and by default the first `Model` is getting accessed.
@@ -58,7 +58,7 @@ Here an example that loops over the whole data model and prints out the HEM grou
5858

5959
for (Chain c : chains) {
6060

61-
System.out.println(" Chain: " + c.getChainID() + " # groups with atoms: " + c.getAtomGroups().size());
61+
System.out.println(" Chain: " + c.getId() + " # groups with atoms: " + c.getAtomGroups().size());
6262

6363
for (Group g: c.getAtomGroups()){
6464

@@ -87,35 +87,35 @@ The [Group](http://www.biojava.org/docs/api/org/biojava/nbio/structure/Group.htm
8787
In order to get all amino acids that have been observed in a PDB chain, you can use the following utility method:
8888

8989
```java
90-
Chain chain = s.getChainByPDB("A");
91-
List<Group> groups = chain.getAtomGroups("amino");
90+
Chain chain = structure.getPolyChainByPDB("A");
91+
List<Group> groups = chain.getAtomGroups(GroupType.AMINOACID);
9292
for (Group group : groups) {
93-
AminoAcid aa = (AminoAcid) group;
93+
SecStrucInfo secStrucInfo = (SecStrucInfo) group.getProperty(Group.SEC_STRUC);
9494

95-
// do something amino acid specific, e.g. print the secondary structure assignment
96-
System.out.println(aa + " " + aa.getSecStruc());
95+
// print the secondary structure assignment
96+
System.out.println(group + " -- " + secStrucInfo);
9797
}
9898
```
9999

100100
In a similar way you can access all nucleotide groups by
101101
```java
102-
chain.getAtomGroups("nucleotide");
102+
chain.getAtomGroups(GroupType.NUCLEOTIDE);
103103
```
104104

105105
The Hetatom groups are access in a similar fashion:
106106
```java
107-
chain.getAtomGroups("hetatm");
107+
chain.getAtomGroups(GroupType.HETATM);
108108
```
109109

110110

111111
Since all 3 types of groups are implementing the Group interface, you can also iterate over all groups and check for the instance type:
112112

113113
```java
114114
List<Group> allgroups = chain.getAtomGroups();
115-
for (Group group : groups) {
116-
if ( group instanceof AminoAcid) {
117-
AminoAcid aa = (AminoAcid) group;
118-
System.out.println(aa.getSecStruc());
115+
for (Group group : allgroups) {
116+
if (group.isAminoAcid()) {
117+
SecStrucInfo secStrucInfo = (SecStrucInfo) group.getProperty(Group.SEC_STRUC);
118+
System.out.println(group + " -- " + secStrucInfo);
119119
}
120120
}
121121
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy