private void initialize() {
		
		Cigar cig = read.getCigar();
		if (cig.getCigarElements().size()==0) {
			System.err.println("No cigar elements for read: " + read.toString() + ", skipping, mq is : " + read.getMappingQuality() );
			initialized = true;
			return;
		}
		CigarElement firstEl = cig.getCigarElement(0);
		
		//If no indels don't do anything
		if (firstEl.getLength() == cig.getReferenceLength()) {
			initialized = true;
            refToReadMap = defaultMap;
			return;
		}
		
		boolean consumingRead = true;
		boolean consumingReference = true;
		
		//56 is maximum deletion length we tolerate. remember we have -1's for every base on the read that missing in the reference,
		//so we need extra space in the map for all those -1's 
		refToReadMap = new int[ cig.getReferenceLength()+101 ];
		int refPos = 0;
		int readPos = 0;
		for(CigarElement el : cig.getCigarElements()) {
			consumingRead = el.getOperator().consumesReadBases();
			consumingReference = el.getOperator().consumesReferenceBases();
			
			for(int j=0; j<el.getLength(); j++) {
				int index = -1;
				
				if (consumingRead) {
					index = readPos;
					readPos++;
				}
				
				if (consumingReference) {
				
					refToReadMap[refPos] = index;
					refPos++;
					
				}
				
				
				
			}
		}
		
		initialized = true;
	}