public List formatResults(){
		List results = new ArrayList();
		Iterator i = searchResults.iterator();
		String lastSampleId = "";
		String preSampleId = "";
		String preAssay = "";
		List oneSampleRows = new ArrayList();
		int dupResult = 0;
		boolean newSample = false;
		while(i.hasNext()){
			Result r = (Result)i.next();
			String sampleId = r.getSampleId();
			String assay = r.getAssay();
			String result = r.getResult();
			//log.debug(" sampleId is " + sampleId + " assay is " + assay);
			
			if(!preSampleId.equals(sampleId)){
				for(int a=0;a<oneSampleRows.size();a++){
					Result[] oneRow = (Result[])oneSampleRows.get(a);
					results.add(oneRow);
				}
				oneSampleRows = new ArrayList();
				Result[] oneRow = new Result[assays.size()];
				oneSampleRows.add(oneRow);
				preSampleId = sampleId;
				newSample = true;
				//log.debug("sample id changed, now the preSampleId is " + preSampleId);
			}else{
				newSample = false;
			}
			
				
			int columnNo = assays.indexOf(assay);
			
			if(doStat){
				assayStats[columnNo].addOneGenoType(result);
			}
			
			if(format.equals("yes")){
				r.setResult(haploviewFormatResult(result));
			}
			
			
			// not a dup result
			if(!preAssay.equals(assay) || newSample){
				dupResult = 0;
				preAssay = assay;
				
			}else{
				dupResult++;
				if(oneSampleRows.size()<= dupResult){
					Result[] oneRow = new Result[assays.size()];
					oneSampleRows.add(oneRow);
					int sampleRowNo = sampleIds.indexOf(sampleId);
					sampleIds.add(sampleRowNo+1,sampleId);
				}
			}
			//log.debug("the dupResult is "+ dupResult);
			Result[] oneRow = (Result[])oneSampleRows.get(dupResult);
			oneRow[columnNo] = r;
			
		
		}
		for(int a=0;a<oneSampleRows.size();a++){
			Result[] oneRow = (Result[])oneSampleRows.get(a);
			results.add(oneRow);
		}
		return results;
	}