File: ClumpTools.java

package info (click to toggle)
bbmap 39.20%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 26,008 kB
  • sloc: java: 312,743; sh: 18,096; python: 5,247; ansic: 2,074; perl: 96; makefile: 39; xml: 38
file content (50 lines) | stat: -rwxr-xr-x 1,290 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package clump;

import java.util.ArrayList;

import bloom.KCountArray;
import fileIO.ReadWrite;
import shared.Shared;
import stream.ConcurrentCollectionReadInputStream;
import stream.Read;

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