private static void writeResampledFile(OtuWrapper wrapper, 
				List<Integer> resampledList, boolean discrete, boolean allSameDepth,
				int maxIndex, int maxDepth) throws Exception
	{
		File outFile = 
				new File(
						ConfigReader.getBigDataScalingFactorsDir() 
						+ File.separator + "risk" + 
						File.separator + "dirk" 
						+ File.separator + "resample" + File.separator + 
						"resampled" + (discrete ? "" :"continious") + "_" + 
						(allSameDepth ? "sameDepth" : "") +  ".txt"
						);
		
		System.out.println(outFile.getAbsolutePath());
		
		BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));
		
		writer.write( "sample" );
		
		for( int x=0; x < wrapper.getOtuNames().size(); x++)
			writer.write("\t" + wrapper.getOtuNames().get(x));

		writer.write("\n");
		
		for( int x=0;x < wrapper.getSampleNames().size(); x++)
		{
			int depth = wrapper.getCountsForSample(x);
			System.out.println( x + " depth= " + depth);
			writer.write("sample_" + depth);
			int[] counts = 
					discrete ? resample(wrapper, resampledList, 
							allSameDepth ? maxDepth : depth) :
					 resampleContinious(wrapper, resampledList, x,maxIndex,maxDepth, allSameDepth );
			
			for( int y=0; y < counts.length; y++)
				writer.write("\t" + counts[y]);
			
			writer.write("\n");
			writer.flush();
		}
		
		writer.close();
		
	}