public static void main(String[] args) throws Exception
	{
		
		HashMap<String, List<Holder>> dataMap = 
				getMap(ConfigReader.getJobinLabRNASeqDir() + File.separator + "12WeeksVs18WeeksPlusAnnotation.txt");
		
		BufferedWriter writer = new BufferedWriter(new FileWriter(ConfigReader.getJobinLabRNASeqDir() + File.separator + 
				"12WeeksVs18WeeksPlusAnnotationDecoded.txt"));
		
		writer.write("id\tfoldChange\tlnpval\tpValAdjusted\tannotation\tgffFile\tstartPos\t");
		writer.write("cogID\tcogAnnotation\tcogFunctionalChar\tcogFunctionalAnnotation\t");
		writer.write("downProb\tequalProb\tupProb\n");
		
		for(String s : dataMap.keySet())
		{
			List<Holder> list = dataMap.get(s);
			
			double[] emissions = new double[list.size()];
			double[] foldChanges = new double[list.size()];
			
			int index =0;
			for( Holder h : list)
			{
				emissions[index] = h.pVal;
				foldChanges[index] = h.pVal;
				index++;
			}
			
			MarkovModel mm = new DiffExpressMarkovModel();
			ForwardAlgorithm fa = new ForwardAlgorithm(mm, emissions, foldChanges);
			BackwardsAlgorithm ba = new BackwardsAlgorithm(mm, emissions, foldChanges);
			
			index=0;
			for(Holder h : list)
			{
				writer.write(h.fileLine);
			
				double sum = ForwardAlgorithm.logPAddedToQ(ba.getLogProbs()[0][index] + fa.getLogProbs()[0][index], 
						ba.getLogProbs()[1][index] + fa.getLogProbs()[1][index]);
				sum = ForwardAlgorithm.logPAddedToQ(sum, ba.getLogProbs()[2][index] + fa.getLogProbs()[2][index]);
				
				for( int y=0; y <= 2; y++)
				{
					double fTimesB = ba.getLogProbs()[y][index] + fa.getLogProbs()[y][index]; 
					
					if( Double.isInfinite(fTimesB) || Double.isNaN(fTimesB))
						writer.write("\t" + 0);
					else
						writer.write("\t" + Math.exp(fTimesB - sum));
				}
				
				writer.write("\n");
				index++;
			}
			
			writer.flush(); 
		}
		
		writer.flush();  writer.close();
	}