e8424eacf3348b4e324d84f93017f166b6f96483
[jalview.git] / src / jalview / datamodel / SeqDistanceContactMatrix.java
1 package jalview.datamodel;
2
3 /**
4  * Dummy contact matrix based on sequence distance
5  * 
6  * @author jprocter
7  *
8  */
9 public class SeqDistanceContactMatrix implements ContactMatrixI
10 {
11   private static final String SEQUENCE_DISTANCE = "SEQUENCE_DISTANCE";
12
13   private int width = 0;
14
15   public SeqDistanceContactMatrix(int width)
16   {
17     this.width = width;
18   }
19
20   @Override
21   public float getMin()
22   {
23     return 0f;
24   }
25
26   @Override
27   public float getMax()
28   {
29     return width;
30   }
31
32   @Override
33   public ContactListI getContactList(final int column)
34   {
35     if (column < 0 || column >= width)
36     {
37       return null;
38     }
39     return new ContactListImpl(new ContactListProviderI()
40     {
41
42       int p = column;
43
44       // @Override
45       // public Color getColorForScore(int column)
46       // {
47       // return jalview.util.ColorUtils.getGraduatedColour(Math.abs(column-p),
48       // 0, Color.white, width, Color.magenta);
49       // }
50       // @Override
51       // public Color getColorForRange(int from_column, int to_column)
52       // {
53       // return jalview.util.ColorUtils.getGraduatedColour(
54       // Math.abs(to_column + from_column - 2 * p) / 2, 0, Color.white, width,
55       // Color.magenta);
56       // }
57
58       @Override
59       public int getContactHeight()
60       {
61         return width;
62
63       }
64
65       @Override
66       public int getPosition()
67       {
68         return p;
69       }
70
71       @Override
72       public double getContactAt(int column)
73       {
74         return Math.abs(column - p);
75       }
76     });
77   }
78
79   @Override
80   public boolean hasReferenceSeq()
81   {
82     // TODO Auto-generated method stub
83     return false;
84   }
85
86   @Override
87   public SequenceI getReferenceSeq()
88   {
89     // TODO Auto-generated method stub
90     return null;
91   }
92
93   @Override
94   public String getAnnotDescr()
95   {
96     return "Sequence distance matrix";
97   }
98
99   @Override
100   public String getAnnotLabel()
101   {
102     return "Sequence Distance";
103   }
104
105   @Override
106   public String getType()
107   {
108     return SEQUENCE_DISTANCE;
109   }
110
111   @Override
112   public int getWidth()
113   {
114     return width;
115   }
116
117   @Override
118   public int getHeight()
119   {
120     return width;
121   }
122 }