added resNum+insCode string field for truly unambiguous PDB atom entry referencing...
[jalview.git] / src / MCview / Atom.java
1 /*
2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18 */
19 package MCview;
20
21 import java.awt.*;
22
23
24 public class Atom {
25     public float x;
26     public float y;
27     public float z;
28     public int number;
29     public String name;
30     public String resName;
31     public int resNumber;
32     public char insCode=' ';
33     public String resNumIns=null;
34     public int type;
35     Color color = Color.lightGray;
36     public String chain;
37     int alignmentMapping=-1;
38
39     public boolean isSelected = false;
40
41     public Atom(String str)
42     {
43         name =  str.substring(12,15).trim();
44
45         resName = str.substring(17,20);
46
47         chain = str.substring(21,22);
48
49         resNumber = Integer.parseInt(str.substring(22,26).trim());
50         resNumIns=str.substring(22,27);
51         insCode = str.substring(26,27).charAt(0);
52         this.x = (float) (new Float(str.substring(30,38).trim()).floatValue());
53         this.y = (float) (new Float(str.substring(38,46).trim()).floatValue());
54         this.z = (float) (new Float(str.substring(47,55).trim()).floatValue());
55
56     }
57     public Atom(float x,float y, float z) {
58       this.x = x;
59       this.y = y;
60       this.z = z;
61     }
62   //  public void setColor(Color col) {
63   //      this.color = col;
64   //  }
65 }