X Tutup
Skip to content

Commit a12f4a0

Browse files
committed
Update structure-data-model.md
1 parent 10b00ac commit a12f4a0

File tree

1 file changed

+18
-37
lines changed

1 file changed

+18
-37
lines changed

structure/structure-data-model.md

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -62,70 +62,51 @@ and beta. Each of the entities has two copies (= chains) in the structure. IN 4H
6262
has the two chains with the IDs A, and C and beta the chains B, and D. In total, hemoglobin is
6363
built up out of four chains.
6464

65-
## Loop over all the data
66-
67-
Here an example that loops over the whole data model and prints out the HEM groups of hemoglobin:
68-
65+
This prints all the compounds/entities in a structure
6966
<pre>
7067
Structure structure = StructureIO.getStructure("4hhb");
7168

69+
System.out.println(structure);
70+
7271
System.out.println(" # of compounds (entities) " + structure.getCompounds().size());
7372

7473
for ( Compound entity: structure.getCompounds()) {
7574
System.out.println(" " + entity);
7675
}
76+
</pre>
77+
78+
79+
## Loop over all the data
80+
81+
Here an example that loops over the whole data model and prints out the HEM groups of hemoglobin:
82+
83+
<pre>
84+
Structure structure = StructureIO.getStructure("4hhb");
85+
7786
List<Chain> chains = structure.getChains();
7887

7988
System.out.println(" # chains: " + chains.size());
8089

8190
for (Chain c : chains) {
82-
System.out.println(" Chain: " + c.getChainID());
91+
92+
System.out.println(" Chain: " + c.getChainID() + " # groups with atoms: " + c.getAtomGroups().size());
93+
8394
for (Group g: c.getAtomGroups()){
8495

8596
if ( g.getPDBName().equalsIgnoreCase("HEM")) {
8697

87-
System.out.println(g);
98+
System.out.println(" " + g);
8899

89100
for (Atom a: g.getAtoms()) {
90101

91-
System.out.println(a);
102+
System.out.println(" " + a);
92103

93104
}
94105
}
95106
}
96107
}
97108
</pre>
98109

99-
This will display
100-
101-
<pre>
102-
# of compounds (entities) 2
103-
Compound: 1 HEMOGLOBIN (DEOXY) (ALPHA CHAIN) Engineered: YES OrganismScientific: HOMO SAPIENS OrganismTaxId: 9606 OrganismCommon: HUMAN Chains: ChainId: A C
104-
Compound: 2 HEMOGLOBIN (DEOXY) (BETA CHAIN) Engineered: YES OrganismScientific: HOMO SAPIENS OrganismTaxId: 9606 OrganismCommon: HUMAN Chains: ChainId: B D
105-
# chains: 4
106-
Chain: A
107-
Hetatom 142 HEM true atoms: 43
108-
CHA (CHA) C 4389 8.585 7.902 -18.282
109-
CHB (CHB) C 4390 10.355 9.805 -14.208
110-
...
111-
Chain: B
112-
Hetatom 148 HEM true atoms: 43
113-
CHA (CHA) C 4433 9.659 -10.155 20.773
114-
CHB (CHB) C 4434 11.121 -12.19 16.575
115-
...
116-
Chain: C
117-
Hetatom 142 HEM true atoms: 43
118-
CHA (CHA) C 4476 -8.63 7.776 18.352
119-
CHB (CHB) C 4477 -10.32 10.048 14.384
120-
...
121-
Chain: D
122-
Hetatom 148 HEM true atoms: 43
123-
CHA (CHA) C 4520 -9.813 -9.884 -20.599
124-
CHB (CHB) C 4521 -11.252 -11.989 -16.61
125-
...
126-
</pre>
127-
128-
129110
## Working with groups
130111

131112
The [Group](http://www.biojava.org/docs/api/org/biojava/bio/structure/Group.html) interface defines all methods common to a group of atoms. There are 3 types of Groups:

0 commit comments

Comments
 (0)
X Tutup