001/* This class is based on the original FATCAT implementation by 002 * <pre> 003 * Yuzhen Ye & Adam Godzik (2003) 004 * Flexible structure alignment by chaining aligned fragment pairs allowing twists. 005 * Bioinformatics vol.19 suppl. 2. ii246-ii255. 006 * https://www.ncbi.nlm.nih.gov/pubmed/14534198 007 * </pre> 008 * 009 * Thanks to Yuzhen Ye and A. Godzik for granting permission to freely use and redistribute this code. 010 * 011 * This code may be freely distributed and modified under the 012 * terms of the GNU Lesser General Public Licence. This should 013 * be distributed with the code. If you do not have a copy, 014 * see: 015 * 016 * http://www.gnu.org/copyleft/lesser.html 017 * 018 * Copyright for this code is held jointly by the individual 019 * authors. These should be listed in @author doc comments. 020 * 021 * 022 * Created by Andreas Prlic - RCSB PDB 023 * 024 */ 025package org.biojava.nbio.structure.align.fatcat; 026 027import org.biojava.nbio.structure.Atom; 028import org.biojava.nbio.structure.StructureException; 029import org.biojava.nbio.structure.align.StructureAlignment; 030import org.biojava.nbio.structure.align.ce.ConfigStrucAligParams; 031import org.biojava.nbio.structure.align.fatcat.calc.FatCatParameters; 032import org.biojava.nbio.structure.align.model.AFPChain; 033 034 035public class FatCatRigid extends FatCat implements StructureAlignment{ 036 037 public static final String algorithmName = "jFatCat_rigid"; 038 039 FatCatParameters params; 040 041 public FatCatRigid(){ 042 super(); 043 params = new FatCatParameters(); 044 params.setMaxTra(0); 045 } 046 047 @Override 048 public AFPChain align(Atom[] ca1, Atom[] ca2) throws StructureException { 049 050 AFPChain afpChain = alignRigid(ca1, ca2, params); 051 afpChain.setAlgorithmName(algorithmName); 052 afpChain.setVersion(VERSION+""); 053 return afpChain; 054 } 055 056 @Override 057 public AFPChain align(Atom[] ca1, Atom[] ca2, Object param) 058 throws StructureException { 059 060 if ( ! (param instanceof FatCatParameters)){ 061 throw new IllegalArgumentException("FatCat algorithm needs FatCatParameters object as argument."); 062 } 063 064 params = (FatCatParameters) param; 065 066 AFPChain afpChain= alignRigid(ca1, ca2, params); 067 afpChain.setAlgorithmName(algorithmName); 068 afpChain.setVersion(VERSION+""); 069 return afpChain; 070 } 071 072 @Override 073 public String getAlgorithmName() { 074 075 return algorithmName; 076 } 077 078 @Override 079 public ConfigStrucAligParams getParameters() { 080 081 return params; 082 } 083 084 @Override 085 public String getVersion(){ 086 return VERSION+""; 087 } 088 089// public StructureAlignmentJmol display(AFPChain afpChain, Atom[] ca1, 090// Atom[] ca2, List<Group> hetatms, List<Group> nucs, 091// List<Group> hetatms2, List<Group> nucs2) throws StructureException { 092// 093// StructureAlignmentJmol gui = super.display(afpChain, ca1, ca2, hetatms, nucs, hetatms2, nucs2); 094// gui.setTitle(getAlgorithmName() + " : " + afpChain.getName1() + " vs. " + afpChain.getName2()); 095// return gui; 096// } 097 098 @Override 099 public void setParameters(ConfigStrucAligParams parameters) { 100 if (! (parameters instanceof FatCatParameters)){ 101 throw new IllegalArgumentException("Provided parameters are not of type FatCatParameters!"); 102 } 103 params = (FatCatParameters) parameters; 104 } 105 106 107 108}