public static void main(String[] args) { double[][] arg1 = {{1, 1, 1}, {2, 3, 2}, {4, 7, 3}}; DenseDoubleMatrix2D obj1 = new DenseDoubleMatrix2D(arg1); // rot double[][] arg2 = {{5, 5, 5}, {8, 8, 8}, {2, 2, 2}}; DenseDoubleMatrix2D obj2 = new DenseDoubleMatrix2D(arg2); // grŸn double[][] arg3 = {{4, 5, 6}, {3, 2, 1}, {1, 2, 1}}; DenseDoubleMatrix2D obj3 = new DenseDoubleMatrix2D(arg3); // schwarz System.out.println("obj1\n" + obj1); System.out.println("obj2\n" + obj2); System.out.println("obj3\n" + obj3); double[][][] pair21 = {arg1, arg2}; Transformation trans21 = Kabsch.calculateTransformation(pair21); // grŸn -> rot DenseDoubleMatrix2D rot21 = trans21.peekRotation(); DenseDoubleMatrix1D trl21 = trans21.peekTranslation(); System.out.println("rot21\n" + rot21); System.out.println("trl21\n" + trl21); double[][][] pair12 = {arg2, arg1}; Transformation trans12 = Kabsch.calculateTransformation(pair12); // grŸn -> rot DenseDoubleMatrix2D rot12 = trans12.peekRotation(); DenseDoubleMatrix1D trl12 = trans12.peekTranslation(); System.out.println("rot12\n" + rot12); System.out.println("trl12\n" + trl12); double[][][] pair32 = {arg2, arg3}; Transformation trans32 = Kabsch.calculateTransformation(pair32); // schwarz -> grŸn DenseDoubleMatrix2D rot32 = trans32.peekRotation(); DenseDoubleMatrix1D trl32 = trans32.peekTranslation(); System.out.println("rot32\n" + rot32); System.out.println("trl32\n" + trl32.toString()); DenseDoubleMatrix2D arg2onarg1 = new DenseDoubleMatrix2D(trans21.transform(arg2)); // grŸn -> rot System.out.println(arg2onarg1.toString()); DenseDoubleMatrix2D uni21 = createUniMatrix(rot21, trl21); DenseDoubleMatrix2D uni32 = createUniMatrix(rot32, trl32); System.out.println("uni21\n" + uni21.toString()); System.out.println("uni32\n" + uni32.toString()); Algebra alg = new Algebra(); DenseDoubleMatrix2D result = (DenseDoubleMatrix2D) alg.mult( DoubleFactory2D.dense.identity(4), computeTransitiveTransformation( (DenseDoubleMatrix2D) DoubleFactory2D.dense.identity(4), uni32, uni21)); System.out.println("action results\n" + result); System.out.println("moved points\n" + movePoints(result, obj3).toString()); }
/** * main function for calling HubeRDP * * @param args no args needed * @throws Exception */ public static void main(String[] args) { // allocate memory String pairsString = null, pdbpath = null; // get command Line Arguments CommandLineParser clp = new CommandLineParser(args); pairsString = clp.getStringArg("--pairs"); pdbpath = clp.getStringArg("--pdb"); clp = null; // clp -> GC // load joblist PairFile pairfile = new PairFile(pairsString); LinkedList<String[]> joblist = pairfile.getJoblist(); // set test data PDBEntry templateStructure = null; PDBEntry targetStructure = null; // initialize PDBFileReader PDBFileReader fr = new PDBFileReader(); // construct RDP HubeRDP rdp = new HubeRDP(); // set scoring Scoring scoring = new SimpleScoring(); rdp.setScoring(scoring); // add oracles rdp.addOracle(new RDPOracle(scoring)); LocalSequenceGotoh gotoh = new LocalSequenceGotoh(-10.0, -2.0, bioinfo.alignment.matrices.QuasarMatrix.DAYHOFF_MATRIX); // initialize TM stuff TMMain tmmain = new TMMain(); // initialize output stuff Locale.setDefault(Locale.US); DecimalFormat df = new DecimalFormat("0.0000"); System.out.println("RDP-Scr\tRMSD\tGDT\tTM-Scr\tdepth\tGot-Scr\tRMSD\tGDT\tTM-Scr"); // INNER LOOP for (String[] job : joblist) { try { // load data templateStructure = fr.readPDBFromFile(pdbpath + job[0] + ".pdb"); targetStructure = fr.readPDBFromFile(pdbpath + job[1] + ".pdb"); // construct rdp tree RDPProblem root = new RDPProblem(templateStructure, targetStructure.getSequence()); RDPSolutionTree t = new RDPSolutionTree(root); // construct priority queue RDPPriorityQueue pq = new RDPPriorityQueue(t.getRoot()); // execute rdp algorithm rdp.rdp(t, pq); // Solutions are now in t.getRoot(); // get HubeRDP's (first) alignment SequenceAlignment rdpAlignment = t.getRoot().getTA().get(0).getThreading().asSequenceAlignment(); SequenceAlignment gotohAlignment = gotoh.align(templateStructure.getSequence(), targetStructure.getSequence()); Transformation rdptmtr = tmmain.calculateTransformation(rdpAlignment, templateStructure, targetStructure); Transformation gotohtmtr = tmmain.calculateTransformation(gotohAlignment, templateStructure, targetStructure); System.out.println( job[0] + "\t" + job[1] + "\t" + df.format(rdpAlignment.getScore()) + "\t" + df.format(rdptmtr.getRmsd()) + "\t" + df.format(rdptmtr.getGdt()) + "\t" + df.format(rdptmtr.getTmscore()) + "\t" + (t.getDepth() / 2) + "\t" + df.format(gotohAlignment.getScore()) + "\t" + df.format(gotohtmtr.getRmsd()) + "\t" + df.format(gotohtmtr.getGdt()) + "\t" + df.format(gotohtmtr.getTmscore())); } catch (Exception e) { System.err.println("Error occured: " + e.getLocalizedMessage()); e.printStackTrace(); } } }