Java Code Examples for org.biojava.nbio.structure.align.model.AFPChain#getFocusRes2()
The following examples show how to use
org.biojava.nbio.structure.align.model.AFPChain#getFocusRes2() .
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: AFPTwister.java From biojava with GNU Lesser General Public License v2.1 | 5 votes |
/** * Set the list of equivalent residues in the two proteins given a list of * AFPs * * WARNING: changes the values for FocusRes1, focusRes2 and FocusResn in * afpChain! * * @param afpChain * the AFPChain to store resuts * @param afpn * nr of afp * @param afpPositions * @param listStart * @return nr of eq residues */ public static int afp2Res(AFPChain afpChain, int afpn, int[] afpPositions, int listStart) { int[] res1 = afpChain.getFocusRes1(); int[] res2 = afpChain.getFocusRes2(); int minLen = afpChain.getMinLen(); int n = 0; List<AFP> afpSet = afpChain.getAfpSet(); for (int i = listStart; i < listStart + afpn; i++) { int a = afpPositions[i]; for (int j = 0; j < afpSet.get(a).getFragLen(); j++) { if (n >= minLen) { throw new RuntimeException( "Error: too many residues in AFPChainer.afp2Res!"); } res1[n] = afpSet.get(a).getP1() + j; res2[n] = afpSet.get(a).getP2() + j; n++; } } afpChain.setFocusRes1(res1); afpChain.setFocusRes2(res2); afpChain.setFocusResn(n); if (n == 0) { logger.warn("n=0!!! + " + afpn + " " + listStart + " " + afpPositions.length); } return n; }
Example 2
Source File: AFPChainer.java From biojava with GNU Lesser General Public License v2.1 | 4 votes |
/** //return the rmsd of the residues from the segments that form the given AFP list //this value can be a measurement (1) for the connectivity of the AFPs * * @param afpn * @param afpPositions the positions of AFPs to work on. * @param listStart the starting position in the list of AFPs * @param afpChain * @param ca1 * @param ca2 * @return rmsd */ protected static double calAfpRmsd(int afpn, int[] afpPositions, int listStart, AFPChain afpChain,Atom[] ca1, Atom[] ca2) { if (debug) System.out.println("XXX calling afp2res "+ afpn + " " + afpPositions.length); int focusResn = AFPTwister.afp2Res(afpChain,afpn, afpPositions, listStart); int[] focusRes1 = afpChain.getFocusRes1(); int[] focusRes2 = afpChain.getFocusRes2(); if (debug) System.out.println("XXX calculating calAfpRmsd: " + focusResn + " " + focusRes1.length + " " + focusRes2.length + " " + afpChain.getMinLen() + " " ); double rmsd = getRmsd(focusResn, focusRes1, focusRes2 , afpChain,ca1, ca2); return rmsd; }
Example 3
Source File: AFPTwister.java From biojava with GNU Lesser General Public License v2.1 | 4 votes |
/** * superimposing according to the optimized alignment * * @param afpChain * @param ca1 * @param ca2 * @return Group array twisted. * @throws StructureException */ public static Group[] twistOptimized(AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException { Atom[] optTwistPdb = new Atom[ca2.length]; int gPos = -1; for (Atom a : ca2) { gPos++; optTwistPdb[gPos] = a; } int blockNum = afpChain.getBlockNum(); int b2 = 0; int e2 = 0; int focusResn = 0; int[] focusRes1 = afpChain.getFocusRes1(); int[] focusRes2 = afpChain.getFocusRes2(); if (focusRes1 == null) { focusRes1 = new int[afpChain.getCa1Length()]; afpChain.setFocusRes1(focusRes1); } if (focusRes2 == null) { focusRes2 = new int[afpChain.getCa2Length()]; afpChain.setFocusRes2(focusRes2); } int[] optLen = afpChain.getOptLen(); int[][][] optAln = afpChain.getOptAln(); for (int bk = 0; bk < blockNum; bk++) { // THIS IS TRANSFORMING THE ORIGINAL ca2 COORDINATES, NO CLONING... // copies the atoms over to iniTwistPdb later on in modifyCod transformOrigPDB(optLen[bk], optAln[bk][0], optAln[bk][1], ca1, ca2, afpChain, bk); // transform pro2 according to comparison of pro1 and pro2 at give // residues if (bk > 0) { b2 = e2; } if (bk < blockNum - 1) { // bend at the middle of two consecutive // blocks e2 = optAln[bk][1][optLen[bk] - 1]; e2 = (optAln[bk + 1][1][0] - e2) / 2 + e2; } else { e2 = ca2.length; } cloneAtomRange(optTwistPdb, ca2, b2, e2); for (int i = 0; i < optLen[bk]; i++) { focusRes1[focusResn] = optAln[bk][0][i]; focusRes2[focusResn] = optAln[bk][1][i]; focusResn++; } } int totalLenOpt = focusResn; logger.debug("calrmsdopt for {} residues", focusResn); double totalRmsdOpt = calCaRmsd(ca1, optTwistPdb, focusResn, focusRes1, focusRes2); logger.debug("got opt RMSD: {}", totalRmsdOpt); int optLength = afpChain.getOptLength(); if (totalLenOpt != optLength) { logger.warn("Final alignment length is different {} {}", totalLenOpt, optLength); } logger.debug("final alignment length {}, rmsd {}", focusResn, totalRmsdOpt); afpChain.setTotalLenOpt(totalLenOpt); afpChain.setTotalRmsdOpt(totalRmsdOpt); return StructureTools.cloneGroups(optTwistPdb); }