Clover icon

Coverage Report

  1. Project Clover database Fri Dec 6 2024 13:47:14 GMT
  2. Package jalview.datamodel

File SeqDistanceContactMatrix.java

 

Coverage histogram

../../img/srcFileCovDistChart5.png
43% of files have more coverage

Code metrics

2
16
14
1
152
91
16
1
1.14
14
1.14

Classes

Class Line # Actions
SeqDistanceContactMatrix 37 16 16
0.550%
 

Contributing tests

This file is covered by 5 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 jalview.datamodel;
22   
23    import java.awt.Color;
24    import java.util.BitSet;
25    import java.util.HashMap;
26    import java.util.List;
27   
28    import jalview.util.MapList;
29    import jalview.ws.datamodel.alphafold.MappableContactMatrix;
30   
31    /**
32    * Dummy contact matrix based on sequence distance
33    *
34    * @author jprocter
35    *
36    */
 
37    public class SeqDistanceContactMatrix
38    extends MappableContactMatrix<SeqDistanceContactMatrix>
39    implements ContactMatrixI
40    {
41    private static final String SEQUENCE_DISTANCE = "SEQUENCE_DISTANCE";
42   
43    private int width = 0;
44   
 
45  63 toggle public SeqDistanceContactMatrix(int width)
46    {
47  63 this.width = width;
48    }
49   
 
50  73 toggle @Override
51    public float getMin()
52    {
53  73 return 0f;
54    }
55   
 
56  73 toggle @Override
57    public float getMax()
58    {
59  73 return width;
60    }
61   
 
62  0 toggle @Override
63    public ContactListI getContactList(final int column)
64    {
65  0 if (column < 0 || column >= width)
66    {
67  0 return null;
68    }
69  0 return new ContactListImpl(new ContactListProviderI()
70    {
71   
72    int p = column;
73   
74    // @Override
75    // public Color getColorForScore(int column)
76    // {
77    // return jalview.util.ColorUtils.getGraduatedColour(Math.abs(column-p),
78    // 0, Color.white, width, Color.magenta);
79    // }
80    // @Override
81    // public Color getColorForRange(int from_column, int to_column)
82    // {
83    // return jalview.util.ColorUtils.getGraduatedColour(
84    // Math.abs(to_column + from_column - 2 * p) / 2, 0, Color.white, width,
85    // Color.magenta);
86    // }
87   
 
88  0 toggle @Override
89    public int getContactHeight()
90    {
91  0 return width;
92   
93    }
94   
 
95  0 toggle @Override
96    public int getPosition()
97    {
98  0 return p;
99    }
100   
 
101  0 toggle @Override
102    public double getContactAt(int column)
103    {
104  0 return Math.abs(column - p);
105    }
106    });
107    }
108   
 
109  63 toggle @Override
110    public String getAnnotDescr()
111    {
112  63 return "Sequence distance matrix";
113    }
114   
 
115  63 toggle @Override
116    public String getAnnotLabel()
117    {
118  63 return "Sequence Distance";
119    }
120   
 
121  73 toggle @Override
122    public String getType()
123    {
124  73 return SEQUENCE_DISTANCE;
125    }
126   
 
127  0 toggle @Override
128    public int getWidth()
129    {
130  0 return width;
131    }
132   
 
133  0 toggle @Override
134    public int getHeight()
135    {
136  0 return width;
137    }
138   
 
139  80 toggle @Override
140    public double getElementAt(int _column, int i)
141    {
142  80 return Math.abs(_column - i);
143    }
144   
 
145  1 toggle @Override
146    protected SeqDistanceContactMatrix newMappableContactMatrix(
147    SequenceI newRefSeq, MapList newFromMapList)
148    {
149   
150  1 return new SeqDistanceContactMatrix(width);
151    }
152    }