/** * voronoi data container for multiple sequence scoring on model will be initialized * * @param model * @return voronoi data reuced and decomposited by given pdbmodel grid will be used and generated */ @Override public void prepareSequenceScoring(Object model) { PDBEntry entry = (PDBEntry) model; data = new VoronoiData(entry.getId()); data.reducePDB(entry); data.fillGridWithoutClashes(gridExtend, gridDensity, gridClash); voro.decomposite(data); data.detectOuterGrid(minContact); }
/** * @param pdb * @param type * @return voronoi data reuced and decomposited by given pdbmodel no grid will be used */ public VoronoiData prepareSimple(PDBEntry pdb, VoroPrepType type) { VoronoiData data; data = new VoronoiData(pdb.getId()); data.reducePDB(type, pdb); voro.decomposite(data); return data; }
/** * for whenever we need to only make sequence fragments * * @param pdb the entry to disassemble * @param l a list of protein fragments * @param fLength the desired length of protein fragments * @return the new list of fragments */ public static LinkedList<char[]> disassemble( PDBEntry pdb, LinkedList<char[]> l, int fragmentLength) { char[] pdbChar = new char[pdb.length()]; for (int i = 0; i < pdb.length(); i++) { pdbChar[i] = pdb.getAminoAcid(i).getName().getOneLetterCode().charAt(0); } for (int i = 0; i < pdb.length() - fragmentLength; i++) { char[] temp = new char[fragmentLength]; for (int j = 0; j < fragmentLength; j++) { temp[j] = pdbChar[i + j]; } l.add(temp); } return l; }
/** * normal preparation of data in solvent * * @param pdb * @param gridExtend * @param gridDensity * @param gridClash * @param minContact * @return voronoi data reuced and decomposited by given pdbmodel grid will be used and generated */ public VoronoiData prepareWithGrid( PDBEntry pdb, double gridExtend, double gridDensity, double gridClash, double minContact) { VoronoiData data; data = new VoronoiData(pdb.getId()); data.reducePDB(pdb); data.fillGridWithoutClashes(gridExtend, gridDensity, gridClash); voro.decomposite(data); data.detectOuterGrid(minContact); return data; }
/** * goes through a PDB Entry and reads protein fragments using the CA atoms * * @param pdb the entry to crunch * @param l a list of protein fragments * @param fLength the desired length of protein fragments * @return the new list of fragments */ public static LinkedList<ProteinFragment> crunchBackboneN( PDBEntry pdb, String secStruct, LinkedList<ProteinFragment> l, int fLength) { try { String curSecStruct = ""; for (int i = 0; i < pdb.length() - fLength; i++) { Atom[] temp = new Atom[fLength]; for (int j = i; j < i + fLength; j++) { temp[j - i] = pdb.getAminoAcid(j).getAtomByType(AtomType.CA); } curSecStruct = secStruct.substring(i, i + fLength); ProteinFragment tempFrag = new ProteinFragment(pdb.getId() + "_" + i, curSecStruct, temp, fLength); l.add(tempFrag); } return l; } catch (Exception e) { System.out.println("Entry " + pdb.getId() + " probably has incomplete records."); } return null; }
/** * alternative version that returns the sequence along with the other stuff. * * @param pdb the entry to crunch * @param l a list of protein fragments * @param fLength the desired length of protein fragments * @return the new list of fragments */ public static List<ProteinFragment> crunchBackboneSeq( PDBEntry pdb, List<ProteinFragment> l, int fLength) { try { AminoAcid tempAA = new AminoAcid("ALA", 0); StringBuilder seq = new StringBuilder(); for (int i = 0; i < pdb.length() - fLength; i++) { Atom[] temp = new Atom[fLength]; seq.delete(0, fLength); for (int j = i; j < i + fLength; j++) { tempAA = pdb.getAminoAcid(j); seq.append(tempAA.getName().getOneLetterCode()); temp[j - i] = tempAA.getAtomByType(AtomType.CA).clone(); } ProteinFragment tempFrag = new ProteinFragment(pdb.getId() + "_" + i, seq.toString(), temp, fLength); l.add(tempFrag); } return l; } catch (Exception e) { System.out.println("Entry " + pdb.getId() + " probably has incomplete records."); e.printStackTrace(); } return null; }
/** * 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(); } } }