| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.schemes; |
| 22 |
|
|
| 23 |
|
import jalview.api.AlignViewportI; |
| 24 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 25 |
|
import jalview.datamodel.AlignmentI; |
| 26 |
|
import jalview.datamodel.AnnotatedCollectionI; |
| 27 |
|
import jalview.datamodel.SequenceCollectionI; |
| 28 |
|
import jalview.datamodel.SequenceI; |
| 29 |
|
|
| 30 |
|
import java.awt.Color; |
| 31 |
|
import java.util.Hashtable; |
| 32 |
|
import java.util.Map; |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
@author |
| 40 |
|
@version |
| 41 |
|
|
| |
|
| 0% |
Uncovered Elements: 73 (73) |
Complexity: 27 |
Complexity Density: 0.61 |
|
| 42 |
|
public class RNAHelicesColour extends ResidueColourScheme |
| 43 |
|
{ |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
public Hashtable<Integer, String> positionsToHelix = new Hashtable<>(); |
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
int numHelix = 0; |
| 55 |
|
|
| 56 |
|
public AlignmentAnnotation annotation; |
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 61 |
0 |
public RNAHelicesColour()... |
| 62 |
|
{ |
| 63 |
|
|
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 69 |
0 |
public RNAHelicesColour(AlignmentAnnotation annotation)... |
| 70 |
|
{ |
| 71 |
0 |
super(ResidueProperties.nucleotideIndex); |
| 72 |
0 |
this.annotation = annotation; |
| 73 |
0 |
ColourSchemeProperty.resetRnaHelicesShading(); |
| 74 |
0 |
refresh(); |
| 75 |
|
} |
| 76 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 77 |
0 |
public RNAHelicesColour(AnnotatedCollectionI alignment)... |
| 78 |
|
{ |
| 79 |
0 |
super(ResidueProperties.nucleotideIndex); |
| 80 |
0 |
ColourSchemeProperty.resetRnaHelicesShading(); |
| 81 |
0 |
alignmentChanged(alignment, null); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
|
| 85 |
|
|
| 86 |
|
|
| 87 |
|
@param |
| 88 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 89 |
0 |
public RNAHelicesColour(RNAHelicesColour rnaHelicesColour)... |
| 90 |
|
{ |
| 91 |
0 |
super(ResidueProperties.nucleotideIndex); |
| 92 |
0 |
annotation = rnaHelicesColour.annotation; |
| 93 |
0 |
refresh(); |
| 94 |
|
} |
| 95 |
|
|
| |
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 6 |
Complexity Density: 0.75 |
|
| 96 |
0 |
@Override... |
| 97 |
|
public void alignmentChanged(AnnotatedCollectionI alignment, |
| 98 |
|
Map<SequenceI, SequenceCollectionI> hiddenReps) |
| 99 |
|
{ |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
0 |
AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation(); |
| 104 |
0 |
if (annotations == null) |
| 105 |
|
{ |
| 106 |
0 |
return; |
| 107 |
|
} |
| 108 |
0 |
for (int i = 0; i < annotations.length; i++) |
| 109 |
|
{ |
| 110 |
|
|
| 111 |
|
|
| 112 |
0 |
if (annotations[i].isForDisplay() && annotations[i].isRNA() |
| 113 |
|
&& annotations[i].isValidStruc()) |
| 114 |
|
{ |
| 115 |
0 |
annotation = annotations[i]; |
| 116 |
0 |
break; |
| 117 |
|
} |
| 118 |
|
} |
| 119 |
|
|
| 120 |
0 |
refresh(); |
| 121 |
|
|
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
private long lastrefresh = -1; |
| 125 |
|
|
| |
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 7 |
Complexity Density: 0.64 |
|
| 126 |
0 |
public void refresh()... |
| 127 |
|
{ |
| 128 |
|
|
| 129 |
0 |
if (annotation != null && ((annotation._rnasecstr == null |
| 130 |
|
|| lastrefresh != annotation._rnasecstr.hashCode()) |
| 131 |
|
&& annotation.isValidStruc())) |
| 132 |
|
{ |
| 133 |
0 |
annotation.getRNAStruc(); |
| 134 |
0 |
lastrefresh = annotation._rnasecstr.hashCode(); |
| 135 |
0 |
numHelix = 0; |
| 136 |
0 |
positionsToHelix = new Hashtable<>(); |
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
|
| 141 |
0 |
for (int x = 0; x < this.annotation._rnasecstr.length; x++) |
| 142 |
|
{ |
| 143 |
|
|
| 144 |
|
|
| 145 |
|
|
| 146 |
|
|
| 147 |
|
|
| 148 |
|
|
| 149 |
|
|
| 150 |
0 |
positionsToHelix.put(this.annotation._rnasecstr[x].getBegin(), |
| 151 |
|
this.annotation._rnasecstr[x].getFeatureGroup()); |
| 152 |
0 |
positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(), |
| 153 |
|
this.annotation._rnasecstr[x].getFeatureGroup()); |
| 154 |
|
|
| 155 |
0 |
if (Integer.parseInt( |
| 156 |
|
this.annotation._rnasecstr[x].getFeatureGroup()) > numHelix) |
| 157 |
|
{ |
| 158 |
0 |
numHelix = Integer.parseInt( |
| 159 |
|
this.annotation._rnasecstr[x].getFeatureGroup()); |
| 160 |
|
} |
| 161 |
|
|
| 162 |
|
} |
| 163 |
0 |
ColourSchemeProperty.initRnaHelicesShading(numHelix); |
| 164 |
|
} |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
|
| 168 |
|
|
| 169 |
|
|
| 170 |
|
|
| 171 |
|
@param |
| 172 |
|
|
| 173 |
|
|
| 174 |
|
@return |
| 175 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 176 |
0 |
@Override... |
| 177 |
|
public Color findColour(char c) |
| 178 |
|
{ |
| 179 |
0 |
return ResidueProperties.purinepyrimidine[ResidueProperties.purinepyrimidineIndex[c]]; |
| 180 |
|
|
| 181 |
|
|
| 182 |
|
} |
| 183 |
|
|
| 184 |
|
|
| 185 |
|
|
| 186 |
|
|
| 187 |
|
@param |
| 188 |
|
|
| 189 |
|
@param |
| 190 |
|
|
| 191 |
|
|
| 192 |
|
@return |
| 193 |
|
|
| |
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 194 |
0 |
@Override... |
| 195 |
|
public Color findColour(char c, int j, SequenceI seq) |
| 196 |
|
{ |
| 197 |
0 |
refresh(); |
| 198 |
0 |
Color currentColour = Color.white; |
| 199 |
0 |
String currentHelix = null; |
| 200 |
0 |
currentHelix = positionsToHelix.get(j); |
| 201 |
0 |
if (currentHelix != null) |
| 202 |
|
{ |
| 203 |
0 |
currentColour = ColourSchemeProperty.rnaHelices[Integer |
| 204 |
|
.parseInt(currentHelix)]; |
| 205 |
|
} |
| 206 |
0 |
return currentColour; |
| 207 |
|
} |
| 208 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 209 |
0 |
@Override... |
| 210 |
|
public ColourSchemeI getInstance(AlignViewportI view, |
| 211 |
|
AnnotatedCollectionI sg) |
| 212 |
|
{ |
| 213 |
0 |
return new RNAHelicesColour(sg); |
| 214 |
|
} |
| 215 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 216 |
0 |
@Override... |
| 217 |
|
public boolean isNucleotideSpecific() |
| 218 |
|
{ |
| 219 |
0 |
return true; |
| 220 |
|
} |
| 221 |
|
|
| 222 |
|
|
| 223 |
|
|
| 224 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 225 |
0 |
@Override... |
| 226 |
|
public boolean isApplicableTo(AnnotatedCollectionI ac) |
| 227 |
|
{ |
| 228 |
0 |
if (ac instanceof AlignmentI && ((AlignmentI) ac).hasRNAStructure()) |
| 229 |
|
{ |
| 230 |
0 |
return true; |
| 231 |
|
} |
| 232 |
|
|
| 233 |
|
|
| 234 |
|
|
| 235 |
|
|
| 236 |
0 |
return false; |
| 237 |
|
} |
| 238 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 239 |
0 |
@Override... |
| 240 |
|
public String getSchemeName() |
| 241 |
|
{ |
| 242 |
0 |
return JalviewColourScheme.RNAHelices.toString(); |
| 243 |
|
} |
| 244 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 245 |
0 |
@Override... |
| 246 |
|
public boolean isSimple() |
| 247 |
|
{ |
| 248 |
0 |
return false; |
| 249 |
|
} |
| 250 |
|
} |