Skip to content

Commit d1470f5

Browse files
author
Andreas Prlic
committed
working on tutorial
1 parent 7ea9784 commit d1470f5

4 files changed

Lines changed: 118 additions & 0 deletions

File tree

structure/firststeps.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
First Steps
2+
===========
3+
4+
## First steps
5+
6+
The simplest way to load a PDB file is by using the [StructureIO](http://www.biojava.org/docs/api/org/biojava3/structure/StructureIO.html) class.
7+
8+
<pre>
9+
public static void main(String[] args){
10+
11+
try {
12+
Structure structure = StructureIO.getStructure("4HHB");
13+
// and let's print out how many atoms are in this structure
14+
System.out.println(StructureTools.getNrAtoms(structure));
15+
} catch (Exception e){
16+
e.printStackTrace();
17+
}
18+
}
19+
</pre>
20+
21+
BioJava automatically downloads the PDB file for hemoglobin [4HHB](http://www.rcsb.org/pdb/explore.do?structureId=4HHB) and copies it into a temporary location. Then the PDB file parser loads the data into a [Structure](http://www.biojava.org/docs/api/org/biojava/bio/structure/Structure.html) object, that provides access to the content in the file. (If you call this a second time, BioJava will automatically re-use the local file.)
22+
23+
<table>
24+
<tr>
25+
<td>
26+
<a href="http://www.rcsb.org/pdb/explore.do?structureId=4hhb"><img src="img/4hhb_bio_r_250.jpg"/></a>
27+
</td>
28+
<td>
29+
The crystal structure of human deoxyhaemoglobin PDB ID <a href="http://www.rcsb.org/pdb/explore.do?structureId=4hhb">4HHB</a> (image source: <a href="http://www.rcsb.org/pdb/explore.do?structureId=4hhb">RCSB</a>)
30+
</tr>
31+
</table>
32+
33+
34+
35+
This demonstrates two things:
36+
37+
+ BioJava can automatically download and install files locally (more on this in Chapter 4)
38+
+ BioJava by default writes those files into a temporary location (The system temp directory "java.io.tempdir").
39+
40+
If you already have a local PDB installation, you can configure where BioJava should read the files from by setting the PDB_DIR system property
41+
42+
<pre>
43+
-DPDB_DIR=/wherever/you/want/
44+
</pre>
45+
46+
## A Quick 3D View
47+
48+
If you have the *biojava-structure-gui* module installed, you can quickly visualise a [Structure](http://www.biojava.org/docs/api/org/biojava/bio/structure/Structure.html) via this:
49+
50+
<pre>
51+
public static void main(String[] args){
52+
53+
try {
54+
55+
Structure struc = StructureIO.getStructure("4hhb");
56+
57+
StructureAlignmentJmol jmolPanel = new StructureAlignmentJmol();
58+
59+
jmolPanel.setStructure(struc);
60+
61+
// send some commands to Jmol
62+
jmolPanel.evalString("select * ; color chain;");
63+
jmolPanel.evalString("select *; spacefill off; wireframe off; cartoon on; ");
64+
jmolPanel.evalString("select ligands; cartoon off; wireframe 0.3; spacefill 0.5; color cpk;");
65+
66+
} catch (Exception e){
67+
e.printStackTrace();
68+
}
69+
}
70+
</pre>
71+
72+
This will result in the following view:
73+
74+
<table>
75+
<tr>
76+
<td>
77+
<img src="img/4hhb_jmol.png"/>
78+
</td>
79+
<td>
80+
The <a href="http://www.biojava.org/docs/api/org/biojava/bio/structure/align/gui/jmol/StructureAlignmentJmol.html">StructureAlignmentJmol</a> class provides a wrapper for the <a href="http://jmol.sourceforge.net/">Jmol</a> viewer and provides a bridge to BioJava, so Structure objects can be sent to Jmol for visualisation.
81+
</td>
82+
</tr>
83+
</table>

structure/img/4hhb_bio_r_250.jpg

24.2 KB
Loading

structure/img/4hhb_jmol.png

138 KB
Loading

structure/installation.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Quick Installation
2+
3+
In the beginning, just one quick paragraph of how to get access to BioJava.
4+
5+
BioJava is open source and you can get the code from [Github](https://github.com/biojava/biojava), however it might be easier this way:
6+
7+
BioJava uses [Maven](http://maven.apache.org/) as a build and distribution system. If you are new to Maven, take a look at the [Getting Started with Maven](http://maven.apache.org/guides/getting-started/index.html) guide.
8+
9+
We are providing a BioJava specific Maven repository at (http://biojava.org/download/maven/) .
10+
11+
You can add the BioJava repository by adding the following XML to your project pom.xml file:
12+
```xml
13+
<repositories>
14+
...
15+
<repository>
16+
<id>biojava-maven-repo</id>
17+
<name>BioJava repository</name>
18+
<url>http://www.biojava.org/download/maven/</url>
19+
</repository>
20+
</repositories>
21+
<dependencies>
22+
...
23+
<dependency>
24+
<!-- This imports the latest SNAPSHOT builds from the protein structure modules of BioJava
25+
-->
26+
<groupId>org.biojava</groupId>
27+
<artifactId>biojava3-structure</artifactId>
28+
<version>3.0.7-SNAPSHOT</version>
29+
</dependency>
30+
<!-- other biojava jars as needed -->
31+
</dependencies>
32+
```
33+
34+
If you run 'mvn package' on your project, the BioJava dependencies will be automatically downloaded and installed for you.
35+

0 commit comments

Comments
 (0)