public static final Atom getAtomForAligPos(AFPChain afpChain,int chainNr, int aligPos, Atom[] ca , boolean getPrevious ) throws StructureException{
		int[] optLen = afpChain.getOptLen();
		// int[][][] optAln = afpChain.getOptAln();

		if ( optLen == null)
			return null;

		if (chainNr < 0 || chainNr > 1){
			throw new StructureException("So far only pairwise alignments are supported, but you requested results for alinged chain nr " + chainNr);
		}

		//if (  afpChain.getAlgorithmName().startsWith("jFatCat")){

		/// for FatCat algorithms...
		int capos = getUngappedFatCatPos(afpChain, chainNr, aligPos);
		if ( capos < 0) {

			capos = getNextFatCatPos(afpChain, chainNr, aligPos,getPrevious);

			//System.out.println(" got next" + capos + " for " + chainNr + " alignedPos: " + aligPos);
		} else {
			//System.out.println("got aligned fatcat position: " + capos + " " + chainNr + " for alig pos: " + aligPos);
		}

		if ( capos < 0) {
			System.err.println("could not match position " + aligPos + " in chain " + chainNr +". Returing null...");
			return null;
		}
		if ( capos > ca.length){
			System.err.println("Atom array "+ chainNr + " does not have " + capos +" atoms. Returning null.");
			return null;
		}
		return ca[capos];
		//}

		//
		//
		//      int ungappedPos = getUngappedPos(afpChain, aligPos);
		//      System.out.println("getAtomForAligPOs " + aligPos  + " " + ungappedPos );
		//      return ca[ungappedPos];
		//
		//      if ( ungappedPos >= optAln[bk][chainNr].length)
		//         return null;
		//      int pos = optAln[bk][chainNr][ungappedPos];
		//      if ( pos > ca.length)
		//         return null;
		//      return ca[pos];
	}
public static final Atom getAtomForAligPos ( AFPChain afpChain , int chainNr , int aligPos , Atom [ ] ca , boolean getPrevious ) throws StructureException { int [ ] optLen = afpChain . getOptLen ( ) ; if ( optLen == null ) return null ; if ( chainNr < 0 || chainNr > 1 ) { throw new StructureException ( "So far only pairwise alignments are supported, but you requested results for alinged chain nr " + chainNr ) ; } int capos = getUngappedFatCatPos ( afpChain , chainNr , aligPos ) ; if ( capos < 0 ) { capos = getNextFatCatPos ( afpChain , chainNr , aligPos , getPrevious ) ; } else { } if ( capos < 0 ) { System . err . println ( "could not match position " + aligPos + " in chain " + chainNr + ". Returing null..." ) ; return null ; } if ( capos > ca . length ) { System . err . println ( "Atom array " + chainNr + " does not have " + capos + " atoms. Returning null." ) ; return null ; } return ca [ capos ] ; }
Return the atom at alignment position aligPos. at the present only works with block 0
@param chainNr the number of the aligned pair. 0... first chain, 1... second chain.
@param afpChain an afpChain object
@param aligPos position on the alignment
@param getPrevious gives the previous position if false, gives the next posible atom
@return a CA atom that is at a particular position of the alignment