Clover icon

Coverage Report

  1. Project Clover database Mon Nov 11 2024 17:27:16 GMT
  2. Package mc_view

File Atom.java

 

Coverage histogram

../img/srcFileCovDistChart9.png
12% of files have more coverage

Code metrics

8
28
3
1
136
78
8
0.29
9.33
3
2.67

Classes

Class Line # Actions
Atom 27 28 8
0.897435989.7%
 

Contributing tests

This file is covered by 64 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
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
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package mc_view;
22   
23    import jalview.schemes.ResidueProperties;
24   
25    import java.awt.Color;
26   
 
27    public class Atom
28    {
29    public float x;
30   
31    public float y;
32   
33    public float z;
34   
35    public int number;
36   
37    public String name;
38   
39    public String resName;
40   
41    public int resNumber;
42   
43    public char insCode = ' ';
44   
45    public String resNumIns = null;
46   
47    public int type;
48   
49    Color color = Color.lightGray;
50   
51    public String chain;
52   
53    /**
54    * this is a temporary value - designed to store the position in sequence that
55    * this atom corresponds to after aligning the chain to a SequenceI object. Do
56    * not rely on its value being correct when visualizing sequence colourings on
57    * the structure - use the StructureSelectionManager's mapping instead.
58    */
59    public int alignmentMapping = -1;
60   
61    public int atomIndex;
62   
63    public float occupancy = 0;
64   
65    public float tfactor = 0;
66   
67    // need these if we ever want to export Atom data
68    // public boolean tfacset=true,occset=true;
69    public boolean isSelected = false;
70   
 
71  7107 toggle public Atom(String str)
72    {
73  7107 atomIndex = Integer.parseInt(str.substring(6, 11).trim());
74   
75  7106 name = str.substring(12, 15).trim();
76   
77  7106 resName = str.substring(17, 20);
78    // JAL-1828 treat MSE Selenomethionine as MET (etc)
79  7106 resName = ResidueProperties.getCanonicalAminoAcid(resName);
80   
81  7106 chain = str.substring(21, 22);
82   
83  7106 resNumber = Integer.parseInt(str.substring(22, 26).trim());
84  7106 resNumIns = str.substring(22, 27).trim();
85  7106 insCode = str.substring(26, 27).charAt(0);
86  7106 this.x = (new Float(str.substring(30, 38).trim()).floatValue());
87  7106 this.y = (new Float(str.substring(38, 46).trim()).floatValue());
88  7106 this.z = (new Float(str.substring(47, 55).trim()).floatValue());
89    // optional entries - see JAL-730
90  7106 String tm = str.substring(54, 60).trim();
91  7106 if (tm.length() > 0)
92    {
93  7105 occupancy = (new Float(tm)).floatValue();
94    }
95    else
96    {
97  1 occupancy = 1f; // default occupancy
98    // see note above: occset=false;
99    }
100  7106 tm = str.substring(60, 66).trim();
101  7106 if (tm.length() > 0)
102    {
103  7105 tfactor = (new Float(tm).floatValue());
104    }
105    else
106    {
107  1 tfactor = 1f;
108    // see note above: tfacset=false;
109    }
110    }
111   
 
112  10887568 toggle @Override
113    public boolean equals(Object that)
114    {
115  10887568 if (this == that || that == null)
116    {
117  0 return true;
118    }
119  10887568 if (that instanceof Atom)
120    {
121  10887568 Atom other = (Atom) that;
122  10887568 return other.resName.equals(this.resName)
123    && other.resNumber == this.resNumber
124    && other.resNumIns.equals(this.resNumIns)
125    && other.chain.equals(this.chain);
126    }
127  0 return false;
128    }
129   
 
130  41104 toggle public Atom(float x, float y, float z)
131    {
132  41104 this.x = x;
133  41104 this.y = y;
134  41104 this.z = z;
135    }
136    }