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 Dec 7, 2013
021 * Created by Douglas Myers-Turnbull
022 *
023 */
024package org.biojava.nbio.structure.io.sifts;
025
026/**
027 * An entry in the chain-level SIFTS mapping between UniProt and the PDB.
028 * @author dmyersturnbull
029 * @see SiftsChainToUniprotMapping
030 * @since 3.0.7
031 * @see SiftsResidue Which is a distinct concept
032 */
033public class SiftsChainEntry {
034
035        private final String chainId;
036        private final String pdbEnd;
037        private final String pdbId;
038        private final String pdbStart;
039        private final String seqresEnd;
040        private final String seqresStart;
041        private final String uniprotEnd;
042        private final String uniProtId;
043        private final String uniprotStart;
044
045        public SiftsChainEntry(String pdbId, String chainId, String uniProtId, String seqresStart, String seqresEnd,
046                        String pdbStart, String pdbEnd, String uniprotStart, String uniprotEnd) {
047                super();
048                this.pdbId = pdbId;
049                this.chainId = chainId;
050                this.uniProtId = uniProtId;
051                this.seqresStart = seqresStart;
052                this.seqresEnd = seqresEnd;
053                this.pdbStart = pdbStart;
054                this.pdbEnd = pdbEnd;
055                this.uniprotStart = uniprotStart;
056                this.uniprotEnd = uniprotEnd;
057        }
058
059        @Override
060        public boolean equals(Object obj) {
061                if (this == obj) return true;
062                if (obj == null) return false;
063                if (getClass() != obj.getClass()) return false;
064                SiftsChainEntry other = (SiftsChainEntry) obj;
065                if (chainId == null) {
066                        if (other.chainId != null) return false;
067                } else if (!chainId.equals(other.chainId)) return false;
068                if (pdbEnd == null) {
069                        if (other.pdbEnd != null) return false;
070                } else if (!pdbEnd.equals(other.pdbEnd)) return false;
071                if (pdbId == null) {
072                        if (other.pdbId != null) return false;
073                } else if (!pdbId.equals(other.pdbId)) return false;
074                if (pdbStart == null) {
075                        if (other.pdbStart != null) return false;
076                } else if (!pdbStart.equals(other.pdbStart)) return false;
077                if (seqresEnd == null) {
078                        if (other.seqresEnd != null) return false;
079                } else if (!seqresEnd.equals(other.seqresEnd)) return false;
080                if (seqresStart == null) {
081                        if (other.seqresStart != null) return false;
082                } else if (!seqresStart.equals(other.seqresStart)) return false;
083                if (uniProtId == null) {
084                        if (other.uniProtId != null) return false;
085                } else if (!uniProtId.equals(other.uniProtId)) return false;
086                if (uniprotEnd == null) {
087                        if (other.uniprotEnd != null) return false;
088                } else if (!uniprotEnd.equals(other.uniprotEnd)) return false;
089                if (uniprotStart == null) {
090                        if (other.uniprotStart != null) return false;
091                } else if (!uniprotStart.equals(other.uniprotStart)) return false;
092                return true;
093        }
094
095        public String getChainId() {
096                return chainId;
097        }
098
099        /**
100         * @return A residue number
101         */
102        public String getPdbEnd() {
103                return pdbEnd;
104        }
105
106        public String getPdbId() {
107                return pdbId;
108        }
109
110        /**
111         * @return A residue number
112         */
113        public String getPdbStart() {
114                return pdbStart;
115        }
116
117        /**
118         * @return A residue number
119         */
120        public String getSeqresEnd() {
121                return seqresEnd;
122        }
123
124        /**
125         * @return A residue number
126         */
127        public String getSeqresStart() {
128                return seqresStart;
129        }
130
131        public String getUniprotEnd() {
132                return uniprotEnd;
133        }
134
135        public String getUniProtId() {
136                return uniProtId;
137        }
138
139        public String getUniprotStart() {
140                return uniprotStart;
141        }
142
143        @Override
144        public int hashCode() {
145                final int prime = 31;
146                int result = 1;
147                result = prime * result + (chainId == null ? 0 : chainId.hashCode());
148                result = prime * result + (pdbEnd == null ? 0 : pdbEnd.hashCode());
149                result = prime * result + (pdbId == null ? 0 : pdbId.hashCode());
150                result = prime * result + (pdbStart == null ? 0 : pdbStart.hashCode());
151                result = prime * result + (seqresEnd == null ? 0 : seqresEnd.hashCode());
152                result = prime * result + (seqresStart == null ? 0 : seqresStart.hashCode());
153                result = prime * result + (uniProtId == null ? 0 : uniProtId.hashCode());
154                result = prime * result + (uniprotEnd == null ? 0 : uniprotEnd.hashCode());
155                result = prime * result + (uniprotStart == null ? 0 : uniprotStart.hashCode());
156                return result;
157        }
158
159        @Override
160        public String toString() {
161                return "SiftsChainToUniprotEntry [pdbId=" + pdbId + ", chainName=" + chainId + ", uniProtId=" + uniProtId
162                                + ", seqresStart=" + seqresStart + ", seqresEnd=" + seqresEnd + ", pdbStart=" + pdbStart + ", pdbEnd="
163                                + pdbEnd + ", uniprotStart=" + uniprotStart + ", uniprotEnd=" + uniprotEnd + "]";
164        }
165
166}