public static void main(String[] args) throws Exception
	{
		HashMap<String, RawDesignMatrixParser> map = RawDesignMatrixParser.getByFullId();
		List<String> bioinformaticsIds = RawDesignMatrixParser.getAllBioinformaticsIDs(map);
		
		//for(String s : bioinformaticsIds)
		//	System.out.println(s);
		
		List<String> taxaHeaders = RawDesignMatrixParser.getTaxaIds();
		
		//for(String s : taxaHeaders)
		//	System.out.println(s);
		
		List<String> mbqcIDs = RawDesignMatrixParser.getAllMBQCIDs(map);
		List<String> wetlabIds = RawDesignMatrixParser.getAllWetlabIDs(map);
		//System.out.println(wetlabIds);
		
		HashMap<String, Double> avgVals = RawDesignMatrixParser.getTaxaAverages(map, taxaHeaders);
		
		HashMap<String,String> kitMap = getManualKitManufacturer();
		
		BufferedWriter writer = new BufferedWriter(new FileWriter(new File(ConfigReader.getMbqcDir() +
				File.separator + "af_out" + File.separator + "pValuesNAVsNonNA.txt")));
		
		writer.write("bioinformaticsLab\tsequencingLab\textractionProtocol\tkitManufacturer\tseqPlusExtraction\ttaxa\tsampleSize\tpValue\tmeanDifference\tfoldChange\tavgTaxa\n");
		
		for(String bio : bioinformaticsIds)
			for( String wet : wetlabIds)
				for(String taxa : taxaHeaders)
					if( avgVals.get(taxa) >= 0.01 )
					{
						HashMap<String, List<RawDesignMatrixParser>> mbqcIDMap = 
								RawDesignMatrixParser.pivotBySampleID(map, bio, wet);
						

						System.out.println(bio + "\t" + wet + "\t" + taxa );
						List<String> extractionProtocols = getAllExtractionNotNA(mbqcIDMap);
						
						for(String extraction : extractionProtocols)
						{
							String kit = kitMap.get(extraction);
							
							if( kit == null)
								throw new Exception("No " + extraction);
							
							writer.write(bio + "\t" + wet + "\t" + extraction +  "\t" + kit + "\t" + wet + "_" + extraction + "\t" + 
											taxa );
							int taxaID = RawDesignMatrixParser.getTaxaID(taxaHeaders,taxa );
							Holder h= getPValueForNAVsOther(map, mbqcIDs, wet, bio, taxaID, extraction,
											mbqcIDMap);
							
							writer.write("\t" + h.sampleSize + "\t");
							
							if( h.pairedResults != null)
								writer.write(h.pairedResults.getPValue() + "\t" + h.meanDifference + "\t" + h.foldChange + "\t");
							else
								writer.write("\t\t\t");
							
							writer.write(avgVals.get(taxa) + "\n");
						}
						
						
					}
		
		writer.flush();  writer.close();

	}