| 1 |
package clump; |
| 2 |
|
| 3 |
import java.util.ArrayList; |
| 4 |
|
| 5 |
import bloom.KCountArray; |
| 6 |
import fileIO.ReadWrite; |
| 7 |
import shared.Shared; |
| 8 |
import stream.ConcurrentCollectionReadInputStream; |
| 9 |
import stream.Read; |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
public class ClumpTools { |
| 17 |
|
| 18 |
public static KCountArray table(){ |
| 19 |
return table; |
| 20 |
} |
| 21 |
|
| 22 |
public static synchronized KCountArray getTable(ArrayList<Read> reads, int k, int minCount){ |
| 23 |
fname1=fname2=null; |
| 24 |
table=null; |
| 25 |
ConcurrentCollectionReadInputStream cris=new ConcurrentCollectionReadInputStream(reads, null, -1); |
| 26 |
cris.start(); |
| 27 |
table=PivotSet.makeKcaStatic(cris, k, minCount, Shared.AMINO_IN); |
| 28 |
ReadWrite.closeStream(cris); |
| 29 |
return table; |
| 30 |
} |
| 31 |
|
| 32 |
public static synchronized KCountArray getTable(String fname1_, String fname2_, int k_, int minCount_){ |
| 33 |
if(fname1==null || !fname1.equals(fname1_) || table==null){ |
| 34 |
fname1=fname1_; |
| 35 |
fname2=fname2_; |
| 36 |
String[] args=new String[] {"in1="+fname1, "in2="+fname2, "k="+k_, "minCount="+minCount_}; |
| 37 |
table=PivotSet.makeSet(args); |
| 38 |
} |
| 39 |
return table; |
| 40 |
} |
| 41 |
|
| 42 |
public static synchronized void clearTable() { |
| 43 |
fname1=fname2=null; |
| 44 |
table=null; |
| 45 |
} |
| 46 |
|
| 47 |
private static String fname1=null, fname2=null; |
| 48 |
private static KCountArray table=null; |
| 49 |
|
| 50 |
} |