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 Jan 7, 2006
021 *
022 */
023package org.biojava.nbio.structure.align.pairwise;
024
025
026import org.biojava.nbio.structure.Atom;
027import org.biojava.nbio.structure.AtomImpl;
028import org.biojava.nbio.structure.jama.Matrix;
029
030
031/** a pair of fragments of two protein structures
032 *
033 * @author Andreas Prlic
034 * @since 1.5
035 * @version %I% %G%
036 */
037public class FragmentPair {
038
039
040        int length;
041        int pos1;
042        int pos2;
043
044        // parameter below may be used in different approaches
045
046        int contacts;
047        int cluster;
048        double rms;
049        int used;
050        int covered;
051
052        //filled if fragments are superimposed
053        Matrix rot;
054        Atom trans;
055
056        //this unit vector indicates the rotation of j onto i
057        Atom unitv;
058
059        Atom center1;
060        Atom center2;
061
062
063        public FragmentPair(int length, int p1, int p2) {
064                super();
065                this.length = length ;
066                 pos1 = p1;
067                 pos2 = p2;
068
069                 contacts = 0;
070                 cluster = 0;
071                 rms = 0.0;
072                 used = 0;
073                 covered = 0;
074
075                 unitv = new AtomImpl();
076                 unitv.setX(0);
077                 unitv.setY(0);
078                 unitv.setZ(1);
079                 rot = null;
080                 trans = new AtomImpl();
081                 center1 = new AtomImpl();
082                 center2 = new AtomImpl();
083
084        }
085        @Override
086        public Object clone(){
087
088                FragmentPair n = new FragmentPair(length,pos1,pos2);
089                if ( center1 !=null)
090                        n.setCenter1((Atom)center1.clone());
091
092                if ( center2 != null)
093                        n.setCenter2((Atom)center2.clone());
094
095                n.setCluster(cluster);
096                n.setContacts(contacts);
097                n.setCovered(covered);
098                n.setRms(rms);
099                n.setLength(length);
100                n.setRot((Matrix)rot.clone());
101                n.setUnitv((Atom)unitv.clone());
102
103                return n;
104        }
105        public int getCluster() {
106                return cluster;
107        }
108
109        public void setCluster(int cluster) {
110                this.cluster = cluster;
111        }
112
113        public int getContacts() {
114                return contacts;
115        }
116
117        public void setContacts(int contacts) {
118                this.contacts = contacts;
119        }
120
121        public int getCovered() {
122                return covered;
123        }
124
125        public void setCovered(int covered) {
126                this.covered = covered;
127        }
128
129        public int getLength() {
130                return length;
131        }
132
133        public void setLength(int length) {
134                this.length = length;
135        }
136
137        public int getPos1() {
138                return pos1;
139        }
140
141        public void setPos1(int pos1) {
142                this.pos1 = pos1;
143        }
144
145        public int getPos2() {
146                return pos2;
147        }
148
149        public void setPos2(int pos2) {
150                this.pos2 = pos2;
151        }
152
153        public double getRms() {
154                return rms;
155        }
156
157        public void setRms(double rms) {
158                this.rms = rms;
159        }
160
161        public Matrix getRot() {
162                return rot;
163        }
164
165        public void setRot(Matrix rot) {
166                this.rot = rot;
167        }
168
169        public Atom getTrans() {
170                return trans;
171        }
172
173        public void setTrans(Atom trans) {
174                this.trans = trans;
175        }
176
177        public Atom getUnitv() {
178                return unitv;
179        }
180
181        public void setUnitv(Atom unitv) {
182                this.unitv = unitv;
183        }
184
185        public int getUsed() {
186                return used;
187        }
188
189        public void setUsed(int used) {
190                this.used = used;
191        }
192
193        public Atom getCenter1() {
194                return center1;
195        }
196
197        public void setCenter1(Atom center1) {
198                this.center1 = center1;
199        }
200
201        public Atom getCenter2() {
202                return center2;
203        }
204
205        public void setCenter2(Atom center2) {
206                this.center2 = center2;
207        }
208
209        @Override
210        public String toString() {
211                return String.format("Fragment (%d,%d) len %d", pos1, pos2, length);
212        }
213}