jpayne@68: package clump; jpayne@68: jpayne@68: import java.util.ArrayList; jpayne@68: jpayne@68: import bloom.KCountArray; jpayne@68: import fileIO.ReadWrite; jpayne@68: import shared.Shared; jpayne@68: import stream.ConcurrentCollectionReadInputStream; jpayne@68: import stream.Read; jpayne@68: jpayne@68: /** jpayne@68: * @author Brian Bushnell jpayne@68: * @date Nov 12, 2015 jpayne@68: * jpayne@68: */ jpayne@68: public class ClumpTools { jpayne@68: jpayne@68: public static KCountArray table(){ jpayne@68: return table; jpayne@68: } jpayne@68: jpayne@68: public static synchronized KCountArray getTable(ArrayList reads, int k, int minCount){ jpayne@68: fname1=fname2=null; jpayne@68: table=null; jpayne@68: ConcurrentCollectionReadInputStream cris=new ConcurrentCollectionReadInputStream(reads, null, -1); jpayne@68: cris.start(); jpayne@68: table=PivotSet.makeKcaStatic(cris, k, minCount, Shared.AMINO_IN); jpayne@68: ReadWrite.closeStream(cris); jpayne@68: return table; jpayne@68: } jpayne@68: jpayne@68: public static synchronized KCountArray getTable(String fname1_, String fname2_, int k_, int minCount_){ jpayne@68: if(fname1==null || !fname1.equals(fname1_) || table==null){ jpayne@68: fname1=fname1_; jpayne@68: fname2=fname2_; jpayne@68: String[] args=new String[] {"in1="+fname1, "in2="+fname2, "k="+k_, "minCount="+minCount_}; jpayne@68: table=PivotSet.makeSet(args); jpayne@68: } jpayne@68: return table; jpayne@68: } jpayne@68: jpayne@68: public static synchronized void clearTable() { jpayne@68: fname1=fname2=null; jpayne@68: table=null; jpayne@68: } jpayne@68: jpayne@68: private static String fname1=null, fname2=null; jpayne@68: private static KCountArray table=null; jpayne@68: jpayne@68: }