dai != dr . getRecord( ) . aligns . end( ); dai ++ )
dai != dr . getRecord( ) . aligns . end( ); ++ dai )
void ParseAlign (Mapping_t & mapping){  DeltaReader_t dr;  Reference_t * refp;  ID_t id;  stringstream ss;  ReadMap_t * currmp;  ReadAlign_t * currap;  vector<DeltaAlignment_t>::const_iterator dai;  pair<map<string, Reference_t>::iterator, bool> insret;  dr . open (OPT_AlignName);  currmp = NULL;  //-- Process the delta input  while ( dr . readNextHeadersOnly( ) )    {      insret = mapping . references . insert	(map<string, Reference_t>::value_type	 (dr . getRecord( ) . idR, Reference_t( )));      refp = &((insret . first) -> second);      //-- If a new reference ID      if ( insret . second )	{	  refp -> id  = &((insret . first) -> first);	  refp -> len = dr . getRecord( ) . lenR;	}      else	assert (refp -> len == (long int)dr . getRecord( ) . lenR);      ss . str (dr . getRecord( ) . idQ);      ss >> id;      assert (!ss . fail( ));      ss . clear( );      //-- If a new read, push it      if ( currmp == NULL || id != currmp -> id )	{	  mapping . reads . push_back (new ReadMap_t( ));	  currmp = mapping . reads . back( );	  currmp -> id = id;	  currmp -> len = dr . getRecord( ) . lenQ;	  currmp -> place = NULL;	  currmp -> mate . read = NULL;	}      //-- For all the alignments in this record      for ( dai  = dr . getRecord( ) . aligns . begin( );	    dai != dr . getRecord( ) . aligns . end( ); dai ++ )	{	  currmp -> all . push_back (new ReadAlign_t ( ));	  currap = currmp -> all . back( );	  currap -> ref = refp;	  currap -> idy = dai -> idy;	  //-- Force ascending coordinates	  if ( dai -> sR < dai -> eR )	    {	      currap -> loR = dai -> sR;	      currap -> hiR = dai -> eR;	    }	  else	    {	      currap -> loR = dai -> eR;	      currap -> hiR = dai -> sR;	    }	  if ( (dai -> sR < dai -> eR  &&  dai -> sQ < dai -> eQ)  ||	       (dai -> sR > dai -> eR  &&  dai -> sQ > dai -> eQ) )	    {	      currap -> ori = FORWARD_CHAR;	      if ( dai -> sQ < dai -> eQ )		{		  currap -> lo = dai -> sQ;		  currap -> hi = dai -> eQ;		}	      else		{		  currap -> lo = dai -> eQ;		  currap -> hi = dai -> sQ;		}	    }	  else	    {	      currap -> ori = REVERSE_CHAR;	      if ( dai -> sQ < dai -> eQ )		{		  currap -> lo = RevComp1 (dai -> eQ, currmp -> len);		  currap -> hi = RevComp1 (dai -> sQ, currmp -> len);		}	      else		{		  currap -> lo = RevComp1 (dai -> sQ, currmp -> len);		  currap -> hi = RevComp1 (dai -> eQ, currmp -> len);		}	    }	}      //-- Sort the alignments by lo read coordinate      sort (currmp -> all.begin( ), currmp -> all.end( ), ReadAlignCmp_t( ));    }  dr . close( );  sort (mapping . reads . begin( ), mapping . reads . end( ), ReadIdCmp_t( ));}