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 */ 025 026package org.biojava.nbio.structure.align.fatcat; 027 028 029import org.biojava.nbio.structure.Atom; 030import org.biojava.nbio.structure.StructureException; 031import org.biojava.nbio.structure.align.StructureAlignment; 032import org.biojava.nbio.structure.align.ce.ConfigStrucAligParams; 033import org.biojava.nbio.structure.align.fatcat.calc.FatCatParameters; 034import org.biojava.nbio.structure.align.model.AFPChain; 035 036 037public class FatCatFlexible extends FatCat implements StructureAlignment{ 038 039 040 041 public static final String algorithmName = "jFatCat_flexible"; 042 043 FatCatParameters params; 044 045 public FatCatFlexible(){ 046 super(); 047 params = new FatCatParameters(); 048 } 049 050 @Override 051 public AFPChain align(Atom[] ca1, Atom[] ca2) throws StructureException { 052 053 AFPChain afpChain = alignFlexible(ca1, ca2, params); 054 afpChain.setAlgorithmName(algorithmName); 055 afpChain.setVersion(VERSION+""); 056 return afpChain; 057 } 058 059 @Override 060 public AFPChain align(Atom[] ca1, Atom[] ca2, Object param) 061 throws StructureException { 062 063 if ( ! (param instanceof FatCatParameters)){ 064 throw new IllegalArgumentException("FatCat algorithm needs FatCatParameters object as argument."); 065 } 066 067 params = (FatCatParameters) param; 068 069 AFPChain afpChain= alignFlexible(ca1, ca2, params); 070 afpChain.setAlgorithmName(algorithmName); 071 afpChain.setVersion(VERSION+""); 072 return afpChain; 073 } 074 075 @Override 076 public String getAlgorithmName() { 077 078 return algorithmName; 079 } 080 081 @Override 082 public String getVersion(){ 083 return VERSION+""; 084 } 085 086 @Override 087 public ConfigStrucAligParams getParameters() { 088 089 return params; 090 } 091 092// public StructureAlignmentJmol display(AFPChain afpChain, Atom[] ca1, 093// Atom[] ca2, List<Group> hetatms, List<Group> nucs, 094// List<Group> hetatms2, List<Group> nucs2) throws StructureException { 095// 096// StructureAlignmentJmol gui = super.display(afpChain, ca1, ca2, hetatms, nucs, hetatms2, nucs2); 097// gui.setTitle(getAlgorithmName() + " : " + afpChain.getName1() + " vs. " + afpChain.getName2()); 098// return gui; 099// } 100 101 @Override 102 public void setParameters(ConfigStrucAligParams parameters) { 103 if (! (parameters instanceof FatCatParameters)){ 104 throw new IllegalArgumentException("Provided parameters are not of type FatCatParameters!"); 105 } 106 params = (FatCatParameters) parameters; 107 } 108 109 110 111}