update author list in license for (JAL-826)
[jalview.git] / src / jalview / structure / StructureMapping.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10  * 
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 package jalview.structure;
19
20 import jalview.datamodel.*;
21
22 public class StructureMapping
23 {
24   String mappingDetails;
25
26   SequenceI sequence;
27
28   String pdbfile;
29
30   String pdbid;
31
32   String pdbchain;
33
34   // Mapping index 0 is resNum, index 1 is atomNo
35   int[][] mapping;
36
37   public StructureMapping(SequenceI seq, String pdbfile, String pdbid,
38           String chain, int[][] mapping, String mappingDetails)
39   {
40     sequence = seq;
41     this.pdbfile = pdbfile;
42     this.pdbid = pdbid;
43     this.pdbchain = chain;
44     this.mapping = mapping;
45     this.mappingDetails = mappingDetails;
46   }
47
48   public SequenceI getSequence()
49   {
50     return sequence;
51   }
52
53   public String getChain()
54   {
55     return pdbchain;
56   }
57
58   public String getPdbId()
59   {
60     return pdbid;
61   }
62
63   public int getAtomNum(int seqpos)
64   {
65     if (mapping.length > seqpos)
66     {
67       return mapping[seqpos][1];
68     }
69     else
70     {
71       return 0;
72     }
73   }
74
75   public int getPDBResNum(int seqpos)
76   {
77     if (mapping.length > seqpos)
78     {
79       return mapping[seqpos][0];
80     }
81     else
82     {
83       return 0;
84     }
85   }
86
87   public int getSeqPos(int pdbResNum)
88   {
89     for (int i = 0; i < mapping.length; i++)
90     {
91       if (mapping[i][0] == pdbResNum)
92       {
93         return i;
94       }
95     }
96     return -1;
97   }
98 }