Skip to content

Commit fc9f288

Browse files
committed
Updates for biojava 6.0.0 release
1 parent d6f380e commit fc9f288

File tree

2 files changed

+25
-67
lines changed

2 files changed

+25
-67
lines changed

structure/firststeps.md

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@ First Steps
66
The simplest way to load a PDB file is by using the [StructureIO](http://www.biojava.org/docs/api/org/biojava/nbio/structure/StructureIO.html) class.
77

88
```java
9-
public static void main(String[] args){
10-
try {
11-
Structure structure = StructureIO.getStructure("4HHB");
12-
// and let's print out how many atoms are in this structure
13-
System.out.println(StructureTools.getNrAtoms(structure));
14-
} catch (Exception e){
15-
e.printStackTrace();
16-
}
9+
public static void main(String[] args) throws Exception {
10+
Structure structure = StructureIO.getStructure("4HHB");
11+
// and let's print out how many atoms are in this structure
12+
System.out.println(StructureTools.getNrAtoms(structure));
1713
}
1814
```
1915

@@ -53,23 +49,17 @@ Talking about startup properties, it is also good to mention the fact that many
5349
If you have the *biojava-structure-gui* module installed, you can quickly visualise a [Structure](http://www.biojava.org/docs/api/org/biojava/nbio/structure/Structure.html) via this:
5450

5551
```java
56-
public static void main(String[] args){
57-
try {
58-
59-
Structure struc = StructureIO.getStructure("4hhb");
60-
61-
StructureAlignmentJmol jmolPanel = new StructureAlignmentJmol();
62-
63-
jmolPanel.setStructure(struc);
64-
65-
// send some commands to Jmol
66-
jmolPanel.evalString("select * ; color chain;");
67-
jmolPanel.evalString("select *; spacefill off; wireframe off; cartoon on; ");
68-
jmolPanel.evalString("select ligands; cartoon off; wireframe 0.3; spacefill 0.5; color cpk;");
69-
70-
} catch (Exception e){
71-
e.printStackTrace();
72-
}
52+
public static void main(String[] args) throws Exception {
53+
Structure struc = StructureIO.getStructure("4hhb");
54+
55+
StructureAlignmentJmol jmolPanel = new StructureAlignmentJmol();
56+
57+
jmolPanel.setStructure(struc);
58+
59+
// send some commands to Jmol
60+
jmolPanel.evalString("select * ; color chain;");
61+
jmolPanel.evalString("select *; spacefill off; wireframe off; cartoon on; ");
62+
jmolPanel.evalString("select ligands; cartoon off; wireframe 0.3; spacefill 0.5; color cpk;");
7363
}
7464
```
7565

@@ -91,15 +81,10 @@ This will result in the following view:
9181
By default many people work with the *asymmetric unit* of a protein. However for many studies the correct representation to look at is the *biological assembly* of a protein. You can request it by calling
9282

9383
```java
94-
public static void main(String[] args){
95-
96-
try {
97-
Structure structure = StructureIO.getBiologicalAssembly("1GAV");
98-
// and let's print out how many atoms are in this structure
99-
System.out.println(StructureTools.getNrAtoms(structure));
100-
} catch (Exception e){
101-
e.printStackTrace();
102-
}
84+
public static void main(String[] args) throws Exception {
85+
Structure structure = StructureIO.getBiologicalAssembly("1GAV");
86+
// and let's print out how many atoms are in this structure
87+
System.out.println(StructureTools.getNrAtoms(structure));
10388
}
10489
```
10590

structure/mmcif.md

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ By default BioJava is using the PDB file format for parsing data. In order to sw
4444

4545
```java
4646
AtomCache cache = new AtomCache();
47-
48-
cache.setUseMmCif(true);
47+
48+
cache.setFiletype(StructureFiletype.CIF);
4949

5050
// if you struggled to set the PDB_DIR property correctly in the previous step,
5151
// you could set it manually like this:
@@ -67,13 +67,8 @@ StructureIO can also access files via URLs and fetch the data dynamically. E.g.
6767

6868
```java
6969
String u = "http://ftp.wwpdb.org/pub/pdb/data/biounit/mmCIF/divided/nw/4nwr-assembly1.cif.gz";
70-
try {
71-
Structure s = StructureIO.getStructure(u);
72-
73-
System.out.println(s);
74-
} catch (Exception e) {
75-
e.printStackTrace();
76-
}
70+
Structure s = StructureIO.getStructure(u);
71+
System.out.println(s);
7772
```
7873

7974
### Local URLs
@@ -86,34 +81,12 @@ BioJava can also access local files, by specifying the URL as
8681

8782
## Low Level Access
8883

89-
If you want to learn how to use the BioJava mmCIF parser to populate your own data structure, let's first take a look this lower-level code:
84+
You can load a BioJava `Structure` object using the ciftools-java parser with:
9085

9186
```java
9287
InputStream inStream = new FileInputStream(fileName);
93-
94-
MMcifParser parser = new SimpleMMcifParser();
95-
96-
SimpleMMcifConsumer consumer = new SimpleMMcifConsumer();
97-
98-
// The Consumer builds up the BioJava - structure object.
99-
// you could also hook in your own and build up you own data model.
100-
parser.addMMcifConsumer(consumer);
101-
102-
try {
103-
parser.parse(new BufferedReader(new InputStreamReader(inStream)));
104-
} catch (IOException e){
105-
e.printStackTrace();
106-
}
107-
10888
// now get the protein structure.
109-
Structure cifStructure = consumer.getStructure();
110-
```
111-
112-
The parser operates similar to a XML parser by triggering "events". The [SimpleMMcifConsumer](http://www.biojava.org/docs/api/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.html) listens to new categories being read from the file and then builds up the BioJava data model.
113-
114-
To re-use the parser for your own datamodel, just implement the [MMcifConsumer](http://www.biojava.org/docs/api/org/biojava/nbio/structure/io/mmcif/MMcifConsumer.html) interface and add it to the [SimpleMMcifParser](http://www.biojava.org/docs/api/org/biojava/nbio/structure/io/mmcif/SimpleMMcifParser.html).
115-
```java
116-
parser.addMMcifConsumer(myOwnConsumerImplementation);
89+
Structure cifStructure = CifStructureConverter.fromInputStream(inStream);
11790
```
11891

11992
## I Loaded a Structure Object, What Now?

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