001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 */ 021package demo; 022 023import java.io.IOException; 024 025import org.biojava.nbio.structure.Atom; 026import org.biojava.nbio.structure.Structure; 027import org.biojava.nbio.structure.StructureException; 028import org.biojava.nbio.structure.StructureTools; 029import org.biojava.nbio.structure.align.multiple.util.MultipleAlignmentWriter; 030import org.biojava.nbio.structure.align.util.AtomCache; 031import org.biojava.nbio.structure.symmetry.core.QuatSymmetryResults; 032import org.biojava.nbio.structure.symmetry.internal.CESymmParameters; 033import org.biojava.nbio.structure.symmetry.internal.CESymmParameters.RefineMethod; 034import org.biojava.nbio.structure.symmetry.internal.CESymmParameters.SymmetryType; 035import org.biojava.nbio.structure.symmetry.internal.CeSymm; 036import org.biojava.nbio.structure.symmetry.internal.CeSymmResult; 037import org.biojava.nbio.structure.symmetry.utils.SymmetryTools; 038 039/** 040 * Quick demo of how to call CE-Symm programmatically. 041 * Some examples of different symmetry types are proposed. 042 * 043 * @author Spencer Bliven 044 * @author Aleix Lafita 045 * 046 */ 047public class DemoCeSymm { 048 049 public static void main(String[] args) 050 throws IOException, StructureException { 051 052 /* 053 * Some examples: 054 * 055 * CLOSED 056 * 2-fold: 1hiv.A, 057 * 3-fold: 4i4q, 4dou 058 * 5-fold: 2jaj.A 059 * 6-fold: 1u6d 060 * 7-fold: 1jof.A 061 * 8-fold: 1vzw, d1i4na_ 062 * 063 * OPEN 064 * ankyrin: 1n0r.A, 3ehq.A 065 * leucine repeats: 2bnh.A, 3o6n 066 * helical: 1d0b.A 067 * 068 * MULTIPLE AXES 069 * dihedral: 4hhb, 1vym 070 * hierarchical: 4gcr, 1ppr.O, 1hiv 071 * monoclonal Ab: 4NZU 072 * 073 * - For more examples see the symmetry benchmark 074 */ 075 076 //Set the name of the protein structure to analyze 077 String name = "1u6d"; 078 079 //Download the atoms 080 AtomCache cache = new AtomCache(); 081 Structure s = cache.getStructure(name); 082 Atom[] atoms = StructureTools.getRepresentativeAtomArray(s); 083 084 //Choose some parameters 085 CESymmParameters params = new CESymmParameters(); 086 params.setRefineMethod(RefineMethod.SEQUENCE_FUNCTION); 087 params.setSymmType(SymmetryType.AUTO); 088 params.setOptimization(true); 089 params.setSymmLevels(0); 090 params.setSSEThreshold(2); 091 092 //Run the alignment 093 CeSymmResult result = CeSymm.analyze(atoms, params); 094 095 //Display the results in FatCat format 096 System.out.println(MultipleAlignmentWriter.toFatCat(result.getMultipleAlignment())); 097 098 //Obtain the point group symmetry 099 QuatSymmetryResults pg = SymmetryTools.getQuaternarySymmetry(result); 100 System.out.println("Point group internal symmetry: "+pg.getSymmetry()); 101 } 102 103}