(byte[] bytes)
| 368 | } |
| 369 | |
| 370 | public static final boolean isLowComplexity2(byte[] bytes) { |
| 371 | int length = bytes.length; |
| 372 | int t1 = Math.min(Byte.MAX_VALUE, Math.round(length * LOW_COMPLEXITY_THRESHOLD_SHORT_SEQ)); |
| 373 | int t2 = Math.min(Byte.MAX_VALUE, Math.round(length * LOW_COMPLEXITY_THRESHOLD_SHORT_SEQ / 2)); |
| 374 | int t3 = Math.min(Byte.MAX_VALUE, Math.round(length * LOW_COMPLEXITY_THRESHOLD_SHORT_SEQ / 3)); |
| 375 | |
| 376 | byte nf1[] = new byte[4]; |
| 377 | byte nf2[][] = new byte[4][4]; |
| 378 | byte nf3[][][] = new byte[4][4][4]; |
| 379 | |
| 380 | int c3 = nucleotideArrayIndex(bytes[0]); |
| 381 | int c2 = nucleotideArrayIndex(bytes[1]); |
| 382 | int c1 = nucleotideArrayIndex(bytes[2]); |
| 383 | |
| 384 | ++nf1[c3]; |
| 385 | ++nf1[c2]; |
| 386 | ++nf1[c1]; |
| 387 | |
| 388 | if (c3 != c2) { |
| 389 | ++nf2[c3][c2]; |
| 390 | } |
| 391 | if (c2 != c1) { |
| 392 | ++nf2[c2][c1]; |
| 393 | } |
| 394 | |
| 395 | if (c3 != c2 || c2 != c1 || c3 != c1) { |
| 396 | ++nf3[c3][c2][c1]; |
| 397 | } |
| 398 | |
| 399 | for (int i=3; i<length; ++i) { |
| 400 | c3 = c2; |
| 401 | c2 = c1; |
| 402 | c1 = nucleotideArrayIndex(bytes[i]); |
| 403 | |
| 404 | if (++nf1[c1] >= t1) |
| 405 | return true; // homopolymer runs |
| 406 | if (c2 != c1 && ++nf2[c2][c1] >= t2) |
| 407 | return true; // di-nucleotide repeat |
| 408 | if ((c3 != c2 || c2 != c1 || c3 != c1) && ++nf3[c3][c2][c1] >= t3) |
| 409 | return true; // tri-nucleotide repeat |
| 410 | } |
| 411 | |
| 412 | // check bias in di/tri-nucleotide content |
| 413 | return (nf1[0]+nf1[1]>=t1 || nf1[0]+nf1[2]>=t1 || nf1[0]+nf1[3]>=t1 || |
| 414 | nf1[1]+nf1[2]>=t1 || nf1[1]+nf1[3]>=t1 || nf1[2]+nf1[3]>=t1); |
| 415 | } |
| 416 | |
| 417 | public static final boolean isRepeat(String seq) { |
| 418 | final float repeatThreshold = 0.9f; |
no test coverage detected