public void writeContigs(int threadNumber, String dir){
		long time = System.currentTimeMillis();
		
		File f = new File(dir);
		if (!f.exists()) f.mkdir();
		else{
			File[] ff = f.listFiles();
			for (int i = 0; i < ff.length; i++) {
				ff[i].delete();
			}
		}
		
		ContigLoaderThread[] threads = new ContigLoaderThread[threadNumber];
		for (int j = 0; j < threadNumber; j++) {
			ContigLoaderThread clt = new ContigLoaderThread(j,this, dir);
			clt.start();
			threads[j]=clt;
			System.out.println("thread "+j+" started");
		}
		
		for (int i = 0; i < threads.length; i++) {
			try {
				threads[i].join();
			} catch (InterruptedException e) {
				System.out.println("Can't join thread "+i);
				e.printStackTrace();
			}
		}		
		System.out.println("Contigs loadded. Total working time: "+(System.currentTimeMillis()-time)+" ms");		
	}