Skip to content

Commit cb1002e

Browse files
committed
using java syntax highlighting
1 parent cfe334b commit cb1002e

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

structure/structure-data-model.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ This works for both NMR and X-ray based structures and by default the first mode
3939
Different ways are provided how to access the data contained in a [Structure](http://www.biojava.org/docs/api/org/biojava/bio/structure/Structure.html).
4040
If you want to directly access an array of [Atoms](http://www.biojava.org/docs/api/org/biojava/bio/structure/Atom.html) you can use the utility class called [StructureTools](http://www.biojava.org/docs/api/org/biojava/bio/structure/StructureTools.html)
4141

42-
<pre>
42+
```java
4343
// get all C-alpha atoms in the structure
4444
Atom[] caAtoms = StructureTools.getAtomCAArray(structure);
45-
</pre>
45+
```
4646

4747
Alternatively you can access atoms also by their parent-group.
4848

4949
## Loop over all the data
5050

5151
Here an example that loops over the whole data model and prints out the HEM groups of hemoglobin:
5252

53-
<pre>
53+
```java
5454
Structure structure = StructureIO.getStructure("4hhb");
5555

5656
List<Chain> chains = structure.getChains();
@@ -75,7 +75,7 @@ Here an example that loops over the whole data model and prints out the HEM grou
7575
}
7676
}
7777
}
78-
</pre>
78+
```
7979

8080
## Working with groups
8181

@@ -87,7 +87,7 @@ The [Group](http://www.biojava.org/docs/api/org/biojava/bio/structure/Group.html
8787

8888
In order to get all amino acids that have been observed in a PDB chain, you can use the following utility method:
8989

90-
<pre>
90+
```java
9191
Chain chain = s.getChainByPDB("A");
9292
List<Group> groups = chain.getAtomGroups("amino");
9393
for (Group group : groups) {
@@ -96,31 +96,31 @@ In order to get all amino acids that have been observed in a PDB chain, you can
9696
// do something amino acid specific, e.g. print the secondary structure assignment
9797
System.out.println(aa + " " + aa.getSecStruc());
9898
}
99-
</pre>
99+
```
100100

101101

102102
In a similar way you can access all nucleotide groups by
103-
<pre>
103+
```java
104104
chain.getAtomGroups("nucleotide");
105-
</pre>
105+
```
106106

107107
The Hetatom groups are access in a similar fashion:
108-
<pre>
108+
```java
109109
chain.getAtomGroups("hetatm");
110-
</pre>
110+
```
111111

112112

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

115-
<pre>
115+
```java
116116
List<Group> allgroups = chain.getAtomGroups();
117117
for (Group group : groups) {
118118
if ( group instanceof AminoAcid) {
119119
AminoAcid aa = (AminoAcid) group;
120120
System.out.println(aa.getSecStruc());
121121
}
122122
}
123-
</pre>
123+
```
124124

125125
## A Note
126126

@@ -143,7 +143,7 @@ has the two chains with the IDs A, and C and beta the chains B, and D. In total,
143143
built up out of four chains.
144144

145145
This prints all the compounds/entities in a structure
146-
<pre>
146+
```java
147147
Structure structure = StructureIO.getStructure("4hhb");
148148

149149
System.out.println(structure);
@@ -153,7 +153,7 @@ This prints all the compounds/entities in a structure
153153
for ( Compound entity: structure.getCompounds()) {
154154
System.out.println(" " + entity);
155155
}
156-
</pre>
156+
```
157157

158158

159159

0 commit comments

Comments
 (0)