public static void abundantOTUToSparseThreeColumn(String abundantOTUClust, String outFile,
			HashMap<String, String> sequenceToSampleMap) throws Exception
	{
		File in = new File(abundantOTUClust);
		
		BufferedReader reader = 
			abundantOTUClust.toLowerCase().endsWith("gz") ?
				new BufferedReader(new InputStreamReader( 
						new GZIPInputStream( new FileInputStream( in) ) ))
				:
					new BufferedReader(new FileReader(in));

		BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));
				
		String nextLine = reader.readLine();
				
		while(nextLine != null)
		{
			if( ! nextLine.startsWith("#Consensus"))
				throw new Exception("Unexpected first line " + nextLine);
	
			HashMap<String, Integer> countMap = new HashMap<String, Integer>();
					
			StringTokenizer sToken = new StringTokenizer(nextLine, " \t=");
			sToken.nextToken();
			String otuName = sToken.nextToken();
			System.out.println(otuName);
			sToken.nextToken();  sToken.nextToken();
			Integer.parseInt(sToken.nextToken());
					
			nextLine = reader.readLine();
			while( nextLine != null && ! nextLine.startsWith("#Consensus"))
			{
				sToken = new StringTokenizer(nextLine);
				sToken.nextToken();  sToken.nextToken();
				String seqID = sToken.nextToken();
				
				String sampleId = sequenceToSampleMap.get(seqID);
				
				if( sampleId == null)
					throw new Exception("could not find " + sampleId);
				
				Integer count = countMap.get(sampleId);
				
				if( count == null)
					count =0;
				
				count++;
				
				countMap.put(sampleId, count);
				
				nextLine = reader.readLine();
			}
			
			for(String s : countMap.keySet())
			{
				writer.write(s + "\t" + otuName + "\t" + countMap.get(s) + "\n");
			}
			
			writer.flush();
		}
			
	writer.flush(); writer.close();
	}