Debian Codegraph @

current/assemble/AbstractExploreThread.java

raw symbols SCIP
1 package assemble;
2
3 import shared.KillSwitch;
4 import structures.ByteBuilder;
5 import ukmer.Kmer;
6
7 /**
8 * Searches for dead ends.
9 * @author Brian Bushnell
10 * @date Jul 20, 2015
11 *
12 */
13 abstract class AbstractExploreThread extends ShaveObject implements Runnable {
14
15 /**
16 * Constructor
17 */
18 public AbstractExploreThread(int id_, int kbig_){
19 id=id_;
20 myKmer=new Kmer(kbig_);
21 myKmer2=new Kmer(kbig_);
22 thread=new Thread(this);
23 }
24
25 @Override
26 public final void run(){
27 //TODO:
28
29 //With processNextVictims enabled, the number of dead ends found drops from the first pass to the next, then stabilizes.
30 //So, they are not being reset correctly.
31
32 //Also, the number found - even with one thread - is nondeterministic if both are enabled.
33 //Unstable whether or not processNextVictims is disabled. But that's probably to be expected as the count is not exact.
34 //What should be exact is the number of kmers removed for being dead ends.
35
36 //The number is lower than expected. 65k for 600k reads with errors. Most are bubbles, but 40% should be dead ends, or 240k.
37
38 while(processNextTable(myKmer, myKmer2)){}
39 while(processNextVictims(myKmer, myKmer2)){}
40
41 for(int i=0; i<removeMatrixT.length; i++){
42 for(int j=0; j<removeMatrixT.length; j++){
43 if((i==F_BRANCH || i==B_BRANCH) && (j==F_BRANCH || j==B_BRANCH)){
44 bubblesFoundT+=removeMatrixT[i][j];
45 }
46 }
47 }
48 }
49
50 boolean processNextTable(){return processNextTable(myKmer, myKmer2);}
51 abstract boolean processNextTable(final Kmer kmer, Kmer temp);
52
53 boolean processNextVictims(){return processNextVictims(myKmer, myKmer);}
54 abstract boolean processNextVictims(final Kmer kmer, Kmer temp);
55
56 /*--------------------------------------------------------------*/
57
58 public final void start(){thread.start();}
59 public final Thread.State getState(){return thread.getState();}
60 public final void join() throws InterruptedException{thread.join();}
61
62 /*--------------------------------------------------------------*/
63
64 long kmersTestedT=0;
65 long deadEndsFoundT=0;
66 long bubblesFoundT=0;
67
68 final int id;
69 final Kmer myKmer, myKmer2;
70
71 final int[] leftCounts=KillSwitch.allocInt1D(4);
72 final int[] rightCounts=KillSwitch.allocInt1D(4);
73 final ByteBuilder builderT=new ByteBuilder();
74
75 long[][] countMatrixT=new long[MAX_CODE+1][MAX_CODE+1];
76 long[][] removeMatrixT=new long[MAX_CODE+1][MAX_CODE+1];
77
78 public final Thread thread;
79
80 }