Java Code Examples for org.biojava.nbio.structure.align.model.AFPChain#setProbability()

The following examples show how to use org.biojava.nbio.structure.align.model.AFPChain#setProbability() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FatCatAligner.java    From biojava with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * run AFP chaining allowing up to maxTra flexible regions.
 * Input is original coordinates.
 *
 */
private static Group[] chainAfp(FatCatParameters params,AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException{

	// we don;t want to rotate input atoms, do we?
	Atom[] ca2clone = StructureTools.cloneAtomArray(ca2);

	List<AFP> afpSet = afpChain.getAfpSet();

	if (debug)
		System.out.println("entering chainAfp");
	int afpNum = afpSet.size();

	if ( afpNum < 1)
		return new Group[0];

	long bgtime = System.currentTimeMillis();
	if(debug)    {
		System.out.println(String.format("total AFP %d\n", afpNum));
	}

	//run AFP chaining

	AFPChainer.doChainAfp(params,afpChain ,ca1,ca2);

	int afpChainLen = afpChain.getAfpChainLen();

	if(afpChainLen < 1)     {

		afpChain.setShortAlign(true);
		return new Group[0];
	} //very short alignment

	long chaintime = System.currentTimeMillis();
	if(debug)    {

		System.out.println("Afp chaining: time " + (chaintime-bgtime));
	}

	// do post processing

	AFPPostProcessor.postProcess(params, afpChain,ca1,ca2);

	// Optimize the final alignment

	AFPOptimizer.optimizeAln(params, afpChain,ca1,ca2);

	AFPOptimizer.blockInfo( afpChain);

	AFPOptimizer.updateScore(params,afpChain);

	AFPAlignmentDisplay.getAlign(afpChain,ca1,ca2);

	Group[] twistedPDB = AFPTwister.twistPDB(afpChain, ca1, ca2clone);

	SigEva sig =  new SigEva();
	double probability = sig.calSigAll(params, afpChain);
	afpChain.setProbability(probability);
	double normAlignScore = sig.calNS(params,afpChain);
	afpChain.setNormAlignScore(normAlignScore);
	double tmScore = AFPChainScorer.getTMScore(afpChain, ca1, ca2,false);
	afpChain.setTMScore(tmScore);

	/*

	SIGEVA  sig;
	probability = sig.calSigAll(maxTra, sparse, pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength, blockNum - 1);
	normAlignScore = sig.calNS(pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength, blockNum - 1);

	 */

	//if(maxTra == 0)       probability = sig.calSigRigid(pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength);
	//else  probability = sig.calSigFlexi(pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength, blockNum - 1);

	if(debug)    {

		long nowtime = System.currentTimeMillis();
		long diff = nowtime - chaintime;
		System.out.println("Alignment optimization: time "+ diff);

		System.out.println("score:      " + afpChain.getAlignScore());
		System.out.println("opt length: " + afpChain.getOptLength());
		System.out.println("opt rmsd:   "+ afpChain.getTotalRmsdOpt());

	}
	return twistedPDB;

}