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 org.biojava.nbio.structure.contact;
022
023import java.io.Serializable;
024import java.util.ArrayList;
025import java.util.List;
026
027public class StructureInterfaceCluster implements Serializable {
028
029        private static final long serialVersionUID = 1L;
030
031
032        private int id;
033
034        private List<StructureInterface> members;
035
036        /**
037         * The average similarity score between all pairs of members in the cluster.
038         */
039        private double averageScore;
040
041
042        public StructureInterfaceCluster() {
043                this.members = new ArrayList<StructureInterface>();
044        }
045
046        public List<StructureInterface> getMembers() {
047                return members;
048        }
049
050        public void setMembers(List<StructureInterface> members) {
051                this.members = members;
052        }
053
054        public boolean addMember(StructureInterface interf) {
055                return this.members.add(interf);
056        }
057
058        public int getId() {
059                return id;
060        }
061
062        public void setId(int id) {
063                this.id = id;
064        }
065
066        /**
067         * Return the average buried surface area for this interface cluster
068         * @return
069         */
070        public double getTotalArea() {
071                double area = 0;
072                for (StructureInterface interf:members) {
073                        area+=interf.getTotalArea();
074                }
075                return area/members.size();
076        }
077
078        /**
079         * Returns the average similarity score between all pairs of members in the cluster
080         * @return
081         */
082        public double getAverageScore() {
083                return averageScore;
084        }
085
086        public void setAverageScore(double averageScore) {
087                this.averageScore = averageScore;
088        }
089}