@@ -22,7 +22,9 @@ Groups derived from SEQRES groups will be empty (i.e. they will not
2222contain Atoms), unless they could be mapped to the ATOM records, in
2323which case the full ATOM information can be accessed.
2424
25- Example: ```java import java.util.List; import
25+ Example:
26+ ``` java
27+ import java.util.List ; import
2628org.biojava.nbio.structure. Chain ; import
2729org.biojava.nbio.structure. Group ; import
2830org.biojava.nbio.structure. GroupType ; import
@@ -33,39 +35,39 @@ org.biojava.nbio.structure.io.LocalPDBDirectory.FetchBehavior;
3335
3436public class SeqResCookBook {
3537
36- ` public static void main(String[] args) throws Exception { `
37- ` `
38- ` String code = "1aoi"; `
38+ public static void main (String [] args ) throws Exception {
39+
40+ String code = " 1aoi" ;
3941
40- ` PDBFileReader pdbreader = new PDBFileReader(); `
41- ` FileParsingParameters params = new FileParsingParameters(); `
42- ` params.setParseSecStruc(true);// parse the secondary structure information from PDB file `
43- ` params.setAlignSeqRes(true); // align SEQRES and ATOM records `
44- ` pdbreader.setFileParsingParameters(params); `
45- ` `
46- ` pdbreader.setFetchBehavior(FetchBehavior.FETCH_FILES); // fetch PDB files from web if they can't be found locally `
47-
48- ` Structure struc = pdbreader.getStructureById(code); `
49-
50- ` System.out.println("The SEQRES and ATOM information is available via the chains:"); `
51-
52- ` int modelnr = 0 ; // also is 0 if structure is an XRAY structure. `
53-
54- ` List ` <Chain >` chains = struc.getChains(modelnr); `
55- ` for (Chain cha:chains){ `
56- ` List ` <Group >` agr = cha.getAtomGroups(GroupType.AMINOACID); `
57- ` List ` <Group >` hgr = cha.getAtomGroups(GroupType.HETATM); `
58- ` List ` <Group >` ngr = cha.getAtomGroups(GroupType.NUCLEOTIDE); `
59-
60- ` System.out.print("chain: >"+cha.getChainID()+"<"); `
61- ` System.out.print(" length SEQRES: " +cha.getSeqResLength()); `
62- ` System.out.print(" length ATOM: " +cha.getAtomLength()); `
63- ` System.out.print(" aminos: " +agr.size()); `
64- ` System.out.print(" hetatms: "+hgr.size()); `
65- ` System.out.println(" nucleotides: "+ngr.size()); `
66- ` } `
67-
68- ` } `
42+ PDBFileReader pdbreader = new PDBFileReader ();
43+ FileParsingParameters params = new FileParsingParameters ();
44+ params. setParseSecStruc(true );// parse the secondary structure information from PDB file
45+ params. setAlignSeqRes(true ); // align SEQRES and ATOM records
46+ pdbreader. setFileParsingParameters(params);
47+
48+ pdbreader. setFetchBehavior(FetchBehavior . FETCH_FILES ); // fetch PDB files from web if they can't be found locally
49+
50+ Structure struc = pdbreader. getStructureById(code);
51+
52+ System . out. println(" The SEQRES and ATOM information is available via the chains:" );
53+
54+ int modelnr = 0 ; // also is 0 if structure is an XRAY structure.
55+
56+ List<Chain > chains = struc. getChains(modelnr);
57+ for (Chain cha: chains){
58+ List<Group > agr = cha. getAtomGroups(GroupType . AMINOACID );
59+ List<Group > hgr = cha. getAtomGroups(GroupType . HETATM );
60+ List<Group > ngr = cha. getAtomGroups(GroupType . NUCLEOTIDE );
61+
62+ System . out. print(" chain: >" + cha. getChainID()+ " <" );
63+ System . out. print(" length SEQRES: " + cha. getSeqResLength());
64+ System . out. print(" length ATOM: " + cha. getAtomLength());
65+ System . out. print(" aminos: " + agr. size());
66+ System . out. print(" hetatms: " + hgr. size());
67+ System . out. println(" nucleotides: " + ngr. size());
68+ }
69+
70+ }
6971
7072}
7173
0 commit comments