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 * Created on Mar 15, 2010
021 * Author: Andreas Prlic
022 *
023 */
024
025package demo;
026
027import org.biojava.nbio.structure.Atom;
028import org.biojava.nbio.structure.Structure;
029import org.biojava.nbio.structure.StructureTools;
030import org.biojava.nbio.structure.align.StructureAlignment;
031import org.biojava.nbio.structure.align.StructureAlignmentFactory;
032import org.biojava.nbio.structure.align.fatcat.FatCatRigid;
033import org.biojava.nbio.structure.align.fatcat.calc.FatCatParameters;
034import org.biojava.nbio.structure.align.model.AFPChain;
035import org.biojava.nbio.structure.align.util.AtomCache;
036
037public class DemoFATCAT
038{
039
040        public static void main(String[] args){
041
042                //String name1 = "4hhb.A";
043                //String name2 = "4hhb.B";
044
045                String name1 = "1cdg.A";
046                String name2 = "1tim.B";
047
048
049
050                AtomCache cache = new AtomCache();
051
052                Structure structure1 = null;
053                Structure structure2 = null;
054
055                try {
056
057                        StructureAlignment algorithm  = StructureAlignmentFactory.getAlgorithm(FatCatRigid.algorithmName);
058
059                        structure1 = cache.getStructure(name1);
060                        structure2 = cache.getStructure(name2);
061
062                        Atom[] ca1 = StructureTools.getAtomCAArray(structure1);
063                        Atom[] ca2 = StructureTools.getAtomCAArray(structure2);
064
065                        // the default parameters
066                        FatCatParameters params = new FatCatParameters();
067
068                        AFPChain afpChain = algorithm.align(ca1,ca2,params);
069
070                        afpChain.setName1(name1);
071                        afpChain.setName2(name2);
072
073                        // flexible original results:
074                        System.out.println(afpChain.toFatcat(ca1,ca2));
075
076                        System.out.println(afpChain.toRotMat());
077                        //System.out.println(afpChain.toCE(ca1, ca2));
078
079                        //System.out.println(AFPChainXMLConverter.toXML(afpChain,ca1,ca2));
080
081                } catch (Exception e) {
082                        e.printStackTrace();
083                        return;
084                }
085        }
086}