| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.analysis; |
| 22 |
|
|
| 23 |
|
import static org.testng.AssertJUnit.assertEquals; |
| 24 |
|
import static org.testng.AssertJUnit.assertNull; |
| 25 |
|
|
| 26 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 27 |
|
import jalview.datamodel.Annotation; |
| 28 |
|
import jalview.datamodel.Profile; |
| 29 |
|
import jalview.datamodel.ProfileI; |
| 30 |
|
import jalview.datamodel.ProfilesI; |
| 31 |
|
import jalview.datamodel.ResidueCount; |
| 32 |
|
import jalview.datamodel.Sequence; |
| 33 |
|
import jalview.datamodel.SequenceGroup; |
| 34 |
|
import jalview.datamodel.SequenceI; |
| 35 |
|
import jalview.gui.JvOptionPane; |
| 36 |
|
|
| 37 |
|
import java.util.Hashtable; |
| 38 |
|
|
| 39 |
|
import org.testng.annotations.BeforeClass; |
| 40 |
|
import org.testng.annotations.Test; |
| 41 |
|
|
| |
|
| 93.5% |
Uncovered Elements: 15 (231) |
Complexity: 12 |
Complexity Density: 0.06 |
|
| 42 |
|
public class AAFrequencyTest |
| 43 |
|
{ |
| 44 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 45 |
1 |
@BeforeClass(alwaysRun = true)... |
| 46 |
|
public void setUpJvOptionPane() |
| 47 |
|
{ |
| 48 |
1 |
JvOptionPane.setInteractiveMode(false); |
| 49 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
| 50 |
|
} |
| 51 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (33) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
| 52 |
1 |
@Test(groups = { "Functional" })... |
| 53 |
|
public void testCalculate_noProfile() |
| 54 |
|
{ |
| 55 |
1 |
SequenceI seq1 = new Sequence("Seq1", "CAG-T"); |
| 56 |
1 |
SequenceI seq2 = new Sequence("Seq2", "CAC-T"); |
| 57 |
1 |
SequenceI seq3 = new Sequence("Seq3", "C---G"); |
| 58 |
1 |
SequenceI seq4 = new Sequence("Seq4", "CA--t"); |
| 59 |
1 |
SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 }; |
| 60 |
1 |
int width = seq1.getLength(); |
| 61 |
1 |
ProfilesI result = AAFrequency.calculate(seqs, width, 0, width, false); |
| 62 |
|
|
| 63 |
|
|
| 64 |
1 |
ProfileI col = result.get(0); |
| 65 |
1 |
assertEquals(100f, col.getPercentageIdentity(false)); |
| 66 |
1 |
assertEquals(100f, col.getPercentageIdentity(true)); |
| 67 |
1 |
assertEquals(4, col.getMaxCount()); |
| 68 |
1 |
assertEquals("C", col.getModalResidue()); |
| 69 |
1 |
assertNull(col.getCounts()); |
| 70 |
|
|
| 71 |
|
|
| 72 |
1 |
col = result.get(1); |
| 73 |
1 |
assertEquals(75f, col.getPercentageIdentity(false)); |
| 74 |
1 |
assertEquals(100f, col.getPercentageIdentity(true)); |
| 75 |
1 |
assertEquals(3, col.getMaxCount()); |
| 76 |
1 |
assertEquals("A", col.getModalResidue()); |
| 77 |
|
|
| 78 |
|
|
| 79 |
1 |
col = result.get(2); |
| 80 |
1 |
assertEquals(25f, col.getPercentageIdentity(false)); |
| 81 |
1 |
assertEquals(50f, col.getPercentageIdentity(true)); |
| 82 |
1 |
assertEquals(1, col.getMaxCount()); |
| 83 |
1 |
assertEquals("CG", col.getModalResidue()); |
| 84 |
|
|
| 85 |
|
|
| 86 |
1 |
col = result.get(3); |
| 87 |
1 |
assertEquals(0f, col.getPercentageIdentity(false)); |
| 88 |
1 |
assertEquals(0f, col.getPercentageIdentity(true)); |
| 89 |
1 |
assertEquals(0, col.getMaxCount()); |
| 90 |
1 |
assertEquals("", col.getModalResidue()); |
| 91 |
|
|
| 92 |
|
|
| 93 |
1 |
col = result.get(4); |
| 94 |
1 |
assertEquals(75f, col.getPercentageIdentity(false)); |
| 95 |
1 |
assertEquals(75f, col.getPercentageIdentity(true)); |
| 96 |
1 |
assertEquals(3, col.getMaxCount()); |
| 97 |
1 |
assertEquals("T", col.getModalResidue()); |
| 98 |
|
} |
| 99 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
| 100 |
1 |
@Test(groups = { "Functional" })... |
| 101 |
|
public void testCalculate_withProfile() |
| 102 |
|
{ |
| 103 |
1 |
SequenceI seq1 = new Sequence("Seq1", "CAGT"); |
| 104 |
1 |
SequenceI seq2 = new Sequence("Seq2", "CACT"); |
| 105 |
1 |
SequenceI seq3 = new Sequence("Seq3", "C--G"); |
| 106 |
1 |
SequenceI seq4 = new Sequence("Seq4", "CA-t"); |
| 107 |
1 |
SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 }; |
| 108 |
1 |
int width = seq1.getLength(); |
| 109 |
1 |
ProfilesI result = AAFrequency.calculate(seqs, width, 0, width, true); |
| 110 |
|
|
| 111 |
1 |
ProfileI profile = result.get(0); |
| 112 |
1 |
assertEquals(4, profile.getCounts().getCount('C')); |
| 113 |
1 |
assertEquals(4, profile.getHeight()); |
| 114 |
1 |
assertEquals(4, profile.getNonGapped()); |
| 115 |
|
|
| 116 |
1 |
profile = result.get(1); |
| 117 |
1 |
assertEquals(3, profile.getCounts().getCount('A')); |
| 118 |
1 |
assertEquals(4, profile.getHeight()); |
| 119 |
1 |
assertEquals(3, profile.getNonGapped()); |
| 120 |
|
|
| 121 |
1 |
profile = result.get(2); |
| 122 |
1 |
assertEquals(1, profile.getCounts().getCount('C')); |
| 123 |
1 |
assertEquals(1, profile.getCounts().getCount('G')); |
| 124 |
1 |
assertEquals(4, profile.getHeight()); |
| 125 |
1 |
assertEquals(2, profile.getNonGapped()); |
| 126 |
|
|
| 127 |
1 |
profile = result.get(3); |
| 128 |
1 |
assertEquals(3, profile.getCounts().getCount('T')); |
| 129 |
1 |
assertEquals(1, profile.getCounts().getCount('G')); |
| 130 |
1 |
assertEquals(4, profile.getHeight()); |
| 131 |
1 |
assertEquals(4, profile.getNonGapped()); |
| 132 |
|
} |
| 133 |
|
|
| |
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
1PASS
|
|
| 134 |
0 |
@Test(groups = { "Functional" }, enabled = false)... |
| 135 |
|
public void testCalculate_withProfileTiming() |
| 136 |
|
{ |
| 137 |
0 |
SequenceI seq1 = new Sequence("Seq1", "CAGT"); |
| 138 |
0 |
SequenceI seq2 = new Sequence("Seq2", "CACT"); |
| 139 |
0 |
SequenceI seq3 = new Sequence("Seq3", "C--G"); |
| 140 |
0 |
SequenceI seq4 = new Sequence("Seq4", "CA-t"); |
| 141 |
0 |
SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 }; |
| 142 |
|
|
| 143 |
|
|
| 144 |
0 |
int width = seq1.getLength(); |
| 145 |
0 |
AAFrequency.calculate(seqs, width, 0, width, true); |
| 146 |
|
|
| 147 |
0 |
int reps = 100000; |
| 148 |
0 |
long start = System.currentTimeMillis(); |
| 149 |
0 |
for (int i = 0; i < reps; i++) |
| 150 |
|
{ |
| 151 |
0 |
AAFrequency.calculate(seqs, width, 0, width, true); |
| 152 |
|
} |
| 153 |
0 |
System.out.println(System.currentTimeMillis() - start); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
|
| 157 |
|
|
| 158 |
|
|
| 159 |
|
|
| 160 |
|
|
| 161 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
| 162 |
1 |
@Test(groups = { "Functional" })... |
| 163 |
|
public void testCompleteConsensus_includeGaps_showLogo() |
| 164 |
|
{ |
| 165 |
|
|
| 166 |
|
|
| 167 |
|
|
| 168 |
1 |
SequenceI seq1 = new Sequence("Seq1", "CAG-T"); |
| 169 |
1 |
SequenceI seq2 = new Sequence("Seq2", "CAC-T"); |
| 170 |
1 |
SequenceI seq3 = new Sequence("Seq3", "C---G"); |
| 171 |
1 |
SequenceI seq4 = new Sequence("Seq4", "CA--t"); |
| 172 |
1 |
SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 }; |
| 173 |
1 |
int width = seq1.getLength(); |
| 174 |
1 |
ProfilesI profiles = AAFrequency.calculate(seqs, width, 0, width, true); |
| 175 |
|
|
| 176 |
1 |
AlignmentAnnotation consensus = new AlignmentAnnotation("Consensus", |
| 177 |
|
"PID", new Annotation[width]); |
| 178 |
1 |
AAFrequency.completeConsensus(consensus, profiles, 0, 5, false, true, |
| 179 |
|
4); |
| 180 |
|
|
| 181 |
1 |
Annotation ann = consensus.annotations[0]; |
| 182 |
1 |
assertEquals("C 100%", ann.description); |
| 183 |
1 |
assertEquals("C", ann.displayCharacter); |
| 184 |
1 |
ann = consensus.annotations[1]; |
| 185 |
1 |
assertEquals("A 75%", ann.description); |
| 186 |
1 |
assertEquals("A", ann.displayCharacter); |
| 187 |
1 |
ann = consensus.annotations[2]; |
| 188 |
1 |
assertEquals("C 25%; G 25%", ann.description); |
| 189 |
1 |
assertEquals("+", ann.displayCharacter); |
| 190 |
1 |
ann = consensus.annotations[3]; |
| 191 |
1 |
assertEquals("", ann.description); |
| 192 |
1 |
assertEquals("-", ann.displayCharacter); |
| 193 |
1 |
ann = consensus.annotations[4]; |
| 194 |
1 |
assertEquals("T 75%; G 25%", ann.description); |
| 195 |
1 |
assertEquals("T", ann.displayCharacter); |
| 196 |
|
} |
| 197 |
|
|
| 198 |
|
|
| 199 |
|
|
| 200 |
|
|
| 201 |
|
|
| 202 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
| 203 |
1 |
@Test(groups = { "Functional" })... |
| 204 |
|
public void testCompleteConsensus_ignoreGaps_noLogo() |
| 205 |
|
{ |
| 206 |
|
|
| 207 |
|
|
| 208 |
|
|
| 209 |
1 |
SequenceI seq1 = new Sequence("Seq1", "CAG-T"); |
| 210 |
1 |
SequenceI seq2 = new Sequence("Seq2", "CAC-T"); |
| 211 |
1 |
SequenceI seq3 = new Sequence("Seq3", "C---G"); |
| 212 |
1 |
SequenceI seq4 = new Sequence("Seq4", "CA--t"); |
| 213 |
1 |
SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 }; |
| 214 |
1 |
int width = seq1.getLength(); |
| 215 |
1 |
ProfilesI profiles = AAFrequency.calculate(seqs, width, 0, width, true); |
| 216 |
|
|
| 217 |
1 |
AlignmentAnnotation consensus = new AlignmentAnnotation("Consensus", |
| 218 |
|
"PID", new Annotation[width]); |
| 219 |
1 |
AAFrequency.completeConsensus(consensus, profiles, 0, 5, true, false, |
| 220 |
|
4); |
| 221 |
|
|
| 222 |
1 |
Annotation ann = consensus.annotations[0]; |
| 223 |
1 |
assertEquals("C 100%", ann.description); |
| 224 |
1 |
assertEquals("C", ann.displayCharacter); |
| 225 |
1 |
ann = consensus.annotations[1]; |
| 226 |
1 |
assertEquals("A 100%", ann.description); |
| 227 |
1 |
assertEquals("A", ann.displayCharacter); |
| 228 |
1 |
ann = consensus.annotations[2]; |
| 229 |
1 |
assertEquals("[CG] 50%", ann.description); |
| 230 |
1 |
assertEquals("+", ann.displayCharacter); |
| 231 |
1 |
ann = consensus.annotations[3]; |
| 232 |
1 |
assertEquals("", ann.description); |
| 233 |
1 |
assertEquals("-", ann.displayCharacter); |
| 234 |
1 |
ann = consensus.annotations[4]; |
| 235 |
1 |
assertEquals("T 75%", ann.description); |
| 236 |
1 |
assertEquals("T", ann.displayCharacter); |
| 237 |
|
} |
| 238 |
|
|
| 239 |
|
|
| 240 |
|
|
| 241 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 242 |
1 |
@Test(groups = { "Functional" })... |
| 243 |
|
public void testExtractProfile() |
| 244 |
|
{ |
| 245 |
|
|
| 246 |
|
|
| 247 |
|
|
| 248 |
|
|
| 249 |
1 |
ProfileI profile = new Profile(200, 30, 70, "G"); |
| 250 |
1 |
ResidueCount counts = new ResidueCount(); |
| 251 |
1 |
counts.put('G', 70); |
| 252 |
1 |
counts.put('R', 60); |
| 253 |
1 |
counts.put('L', 38); |
| 254 |
1 |
counts.put('H', 2); |
| 255 |
1 |
profile.setCounts(counts); |
| 256 |
|
|
| 257 |
|
|
| 258 |
|
|
| 259 |
|
|
| 260 |
|
|
| 261 |
|
|
| 262 |
|
|
| 263 |
|
|
| 264 |
|
|
| 265 |
1 |
int[] extracted = AAFrequency.extractProfile(profile, true); |
| 266 |
1 |
int[] expected = new int[] { 0, 4, 99, 'G', 41, 'R', 35, 'L', 22, 'H', |
| 267 |
|
1 }; |
| 268 |
1 |
org.testng.Assert.assertEquals(extracted, expected); |
| 269 |
|
|
| 270 |
|
|
| 271 |
|
|
| 272 |
|
|
| 273 |
1 |
counts.put('G', 68); |
| 274 |
1 |
counts.put('Q', 1); |
| 275 |
1 |
counts.put('K', 1); |
| 276 |
1 |
extracted = AAFrequency.extractProfile(profile, true); |
| 277 |
1 |
expected = new int[] { 0, 4, 98, 'G', 40, 'R', 35, 'L', 22, 'H', 1 }; |
| 278 |
1 |
org.testng.Assert.assertEquals(extracted, expected); |
| 279 |
|
|
| 280 |
|
} |
| 281 |
|
|
| 282 |
|
|
| 283 |
|
|
| 284 |
|
|
| 285 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 286 |
1 |
@Test(groups = { "Functional" })... |
| 287 |
|
public void testExtractProfile_countGaps() |
| 288 |
|
{ |
| 289 |
|
|
| 290 |
|
|
| 291 |
|
|
| 292 |
|
|
| 293 |
1 |
ProfileI profile = new Profile(200, 30, 70, "G"); |
| 294 |
1 |
ResidueCount counts = new ResidueCount(); |
| 295 |
1 |
counts.put('G', 70); |
| 296 |
1 |
counts.put('R', 60); |
| 297 |
1 |
counts.put('L', 38); |
| 298 |
1 |
counts.put('H', 2); |
| 299 |
1 |
profile.setCounts(counts); |
| 300 |
|
|
| 301 |
|
|
| 302 |
|
|
| 303 |
|
|
| 304 |
|
|
| 305 |
|
|
| 306 |
|
|
| 307 |
|
|
| 308 |
|
|
| 309 |
1 |
int[] extracted = AAFrequency.extractProfile(profile, false); |
| 310 |
1 |
int[] expected = new int[] { AlignmentAnnotation.SEQUENCE_PROFILE, 4, |
| 311 |
|
85, 'G', 35, 'R', 30, 'L', 19, 'H', 1 }; |
| 312 |
1 |
org.testng.Assert.assertEquals(extracted, expected); |
| 313 |
|
|
| 314 |
|
|
| 315 |
|
|
| 316 |
|
|
| 317 |
1 |
counts.put('G', 68); |
| 318 |
1 |
counts.put('Q', 1); |
| 319 |
1 |
counts.put('K', 1); |
| 320 |
1 |
extracted = AAFrequency.extractProfile(profile, false); |
| 321 |
1 |
expected = new int[] { AlignmentAnnotation.SEQUENCE_PROFILE, 4, 84, 'G', |
| 322 |
|
34, 'R', 30, 'L', 19, 'H', 1 }; |
| 323 |
1 |
org.testng.Assert.assertEquals(extracted, expected); |
| 324 |
|
|
| 325 |
|
} |
| 326 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
| 327 |
1 |
@Test(groups = { "Functional" })... |
| 328 |
|
public void testExtractCdnaProfile() |
| 329 |
|
{ |
| 330 |
|
|
| 331 |
|
|
| 332 |
|
|
| 333 |
|
|
| 334 |
1 |
Hashtable profile = new Hashtable(); |
| 335 |
|
|
| 336 |
|
|
| 337 |
|
|
| 338 |
|
|
| 339 |
|
|
| 340 |
|
|
| 341 |
1 |
int[] codonCounts = new int[66]; |
| 342 |
1 |
char[] codon1 = new char[] { 'G', 'C', 'A' }; |
| 343 |
1 |
char[] codon2 = new char[] { 'c', 'C', 'A' }; |
| 344 |
1 |
char[] codon3 = new char[] { 't', 'g', 'A' }; |
| 345 |
1 |
char[] codon4 = new char[] { 'G', 'C', 't' }; |
| 346 |
1 |
int encoded1 = CodingUtils.encodeCodon(codon1); |
| 347 |
1 |
int encoded2 = CodingUtils.encodeCodon(codon2); |
| 348 |
1 |
int encoded3 = CodingUtils.encodeCodon(codon3); |
| 349 |
1 |
int encoded4 = CodingUtils.encodeCodon(codon4); |
| 350 |
1 |
codonCounts[2 + encoded1] = 30; |
| 351 |
1 |
codonCounts[2 + encoded2] = 70; |
| 352 |
1 |
codonCounts[2 + encoded3] = 9; |
| 353 |
1 |
codonCounts[2 + encoded4] = 1; |
| 354 |
1 |
codonCounts[0] = 120; |
| 355 |
1 |
codonCounts[1] = 110; |
| 356 |
1 |
profile.put(AAFrequency.PROFILE, codonCounts); |
| 357 |
|
|
| 358 |
|
|
| 359 |
|
|
| 360 |
|
|
| 361 |
|
|
| 362 |
|
|
| 363 |
|
|
| 364 |
|
|
| 365 |
|
|
| 366 |
1 |
int[] extracted = AAFrequency.extractCdnaProfile(profile, true); |
| 367 |
1 |
int[] expected = new int[] { AlignmentAnnotation.CDNA_PROFILE, 3, 98, |
| 368 |
|
encoded2, 63, encoded1, 27, encoded3, 8 }; |
| 369 |
1 |
org.testng.Assert.assertEquals(extracted, expected); |
| 370 |
|
} |
| 371 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
| 372 |
1 |
@Test(groups = { "Functional" })... |
| 373 |
|
public void testExtractCdnaProfile_countGaps() |
| 374 |
|
{ |
| 375 |
|
|
| 376 |
|
|
| 377 |
|
|
| 378 |
|
|
| 379 |
1 |
Hashtable profile = new Hashtable(); |
| 380 |
|
|
| 381 |
|
|
| 382 |
|
|
| 383 |
|
|
| 384 |
|
|
| 385 |
|
|
| 386 |
1 |
int[] codonCounts = new int[66]; |
| 387 |
1 |
char[] codon1 = new char[] { 'G', 'C', 'A' }; |
| 388 |
1 |
char[] codon2 = new char[] { 'c', 'C', 'A' }; |
| 389 |
1 |
char[] codon3 = new char[] { 't', 'g', 'A' }; |
| 390 |
1 |
char[] codon4 = new char[] { 'G', 'C', 't' }; |
| 391 |
1 |
int encoded1 = CodingUtils.encodeCodon(codon1); |
| 392 |
1 |
int encoded2 = CodingUtils.encodeCodon(codon2); |
| 393 |
1 |
int encoded3 = CodingUtils.encodeCodon(codon3); |
| 394 |
1 |
int encoded4 = CodingUtils.encodeCodon(codon4); |
| 395 |
1 |
codonCounts[2 + encoded1] = 30; |
| 396 |
1 |
codonCounts[2 + encoded2] = 70; |
| 397 |
1 |
codonCounts[2 + encoded3] = 9; |
| 398 |
1 |
codonCounts[2 + encoded4] = 1; |
| 399 |
1 |
codonCounts[0] = 120; |
| 400 |
1 |
codonCounts[1] = 110; |
| 401 |
1 |
profile.put(AAFrequency.PROFILE, codonCounts); |
| 402 |
|
|
| 403 |
|
|
| 404 |
|
|
| 405 |
|
|
| 406 |
|
|
| 407 |
|
|
| 408 |
|
|
| 409 |
|
|
| 410 |
|
|
| 411 |
1 |
int[] extracted = AAFrequency.extractCdnaProfile(profile, false); |
| 412 |
1 |
int[] expected = new int[] { AlignmentAnnotation.CDNA_PROFILE, 3, 90, |
| 413 |
|
encoded2, 58, encoded1, 25, encoded3, 7 }; |
| 414 |
1 |
org.testng.Assert.assertEquals(extracted, expected); |
| 415 |
|
} |
| |
|
| 100% |
Uncovered Elements: 0 (26) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
| 416 |
1 |
@Test(groups= {"Functional"})... |
| 417 |
|
public void testExtractSSProfileForSequenceGroup() |
| 418 |
|
{ |
| 419 |
1 |
Sequence sq = new Sequence("ASD","ASD"); |
| 420 |
1 |
Annotation h=new Annotation("H","",'H',0f),e=new Annotation("E","",'E',0f); |
| 421 |
1 |
AlignmentAnnotation aa_allh = new AlignmentAnnotation("Secondary Structure","Foo h", new Annotation[] {h,h,h}); |
| 422 |
1 |
AlignmentAnnotation aa_allh2 = new AlignmentAnnotation("Secondary Structure","Foo h2", new Annotation[] {h,h,h}); |
| 423 |
1 |
AlignmentAnnotation aa_alle = new AlignmentAnnotation("Secondary Structure","Foo e", new Annotation[] {e,e,e}); |
| 424 |
1 |
AlignmentAnnotation aa_allc = new AlignmentAnnotation("Secondary Structure","Foo c", new Annotation[] {null,null,null}); |
| 425 |
|
|
| 426 |
1 |
SequenceGroup sg = new SequenceGroup(); |
| 427 |
1 |
sq.addAlignmentAnnotation(aa_allc); |
| 428 |
1 |
sq.addAlignmentAnnotation(aa_alle); |
| 429 |
1 |
sq.addAlignmentAnnotation(aa_allh); |
| 430 |
1 |
sq.addAlignmentAnnotation(aa_allh2); |
| 431 |
|
|
| 432 |
|
|
| 433 |
1 |
sg.addSequence(sq, false); |
| 434 |
1 |
sg.addAnnotationFromTree(aa_alle); |
| 435 |
|
|
| 436 |
1 |
ProfilesI profile; |
| 437 |
|
|
| 438 |
1 |
profile = AAFrequency.calculateSS(new SequenceI[] {sq}, 3, 1, 3, false, "All", sg); |
| 439 |
1 |
assertEquals("E",profile.get(1).getModalSS()); |
| 440 |
1 |
assertEquals(1,profile.getCount()); |
| 441 |
1 |
assertEquals(1,profile.get(1).getSeqWithSSCount()); |
| 442 |
|
|
| 443 |
|
|
| 444 |
1 |
profile = AAFrequency.calculateSS(new SequenceI[] {sq}, 3, 1, 3, false, null, sg); |
| 445 |
1 |
assertEquals("E",profile.get(1).getModalSS()); |
| 446 |
|
|
| 447 |
|
|
| 448 |
1 |
profile = AAFrequency.calculateSS(new SequenceI[] {sq}, 3, 1, 3, false, "All", null); |
| 449 |
1 |
assertEquals("H",profile.get(1).getModalSS()); |
| 450 |
1 |
assertEquals(4,profile.getCount()); |
| 451 |
1 |
assertEquals(1,profile.get(1).getSeqWithSSCount()); |
| 452 |
|
|
| 453 |
|
|
| 454 |
1 |
profile = AAFrequency.calculateSS(new SequenceI[] {sq}, 3, 1, 3, false, null, null); |
| 455 |
1 |
assertEquals("H",profile.get(1).getModalSS()); |
| 456 |
|
} |
| 457 |
|
} |