/** * Returns a string representation of the PyMol commands to name and place dashes between * cross-linked amino acids. * * @param crossLinkList - CrossLinkList object holding all cross-links found for a protein * complex. * @return String object with PyMol commands. */ private String getEuclideanDistancePyMolCommands(final CrossLinkList crossLinkList) { StringBuffer output = new StringBuffer(); String infile = CrossLinkParameter.getParameter(Parameter.INFILE_PATH); String nl = Constants.LINE_SEPERATOR; String infileWithoutExtension = new File(infile).getName().substring(0, new File(infile).getName().lastIndexOf('.')); for (CrossLink crossLink : crossLinkList) { Atom atom1 = crossLink.getPreAtom(); Atom atom2 = crossLink.getPostAtom(); if (atom1.getChainId() != '_') { output.append( "create chain" + atom1.getChainId() + ", chain " + atom1.getChainId() + " and " + infileWithoutExtension + nl); } if (atom2.getChainId() != '_') { output.append( "create chain" + atom2.getChainId() + ", chain " + atom2.getChainId() + " and " + infileWithoutExtension + nl); } String selection1 = "resn " + atom1.getResidueName().trim() + " and resi " + atom1.getResidueNumber() + " and chain " + atom1.getChainId() + " and name " + atom1.getName().trim() + " and " + infileWithoutExtension; if (atom1.getAlternativeLocation() != ' ') { selection1 += " and alt " + atom1.getAlternativeLocation(); } String selection2 = "resn " + atom2.getResidueName().trim() + " and resi " + atom2.getResidueNumber() + " and chain " + atom2.getChainId() + " and name " + atom1.getName().trim() + " and " + infileWithoutExtension; if (atom2.getAlternativeLocation() != ' ') { selection2 += " and alt " + atom2.getAlternativeLocation(); } String distName = crossLink.getIndex() + "_"; if (Boolean.parseBoolean( CrossLinkParameter.getParameter(Parameter.DO_SOLVENT_PATH_DISTANCE))) { distName += this.decFormat.format(crossLink.getSolventPathDistance()) + "_"; } else { distName += this.decFormat.format(crossLink.getEuclideanDistance()) + "_"; } distName += atom1.getResidueName().trim() + "" + atom1.getResidueNumber() + "" + atom1.getChainId() + atom1.getName().trim(); if (atom1.getAlternativeLocation() != ' ') { distName += atom1.getAlternativeLocation(); } distName += "-" + atom2.getResidueName().trim() + "" + atom2.getResidueNumber() + "" + atom2.getChainId() + atom2.getName().trim(); if (atom2.getAlternativeLocation() != ' ') { distName += atom2.getAlternativeLocation(); } output.append("select pk1, " + selection1 + nl); output.append("select pk2, " + selection2 + nl); output.append("show spheres, pk1" + nl); output.append("show spheres, pk2" + nl); output.append("distance \"" + distName + "\"" + nl); // output.append("cmd.color(\"red\", \"" + distName + "\")" + nl); } output.append("delete pk1" + nl); output.append("delete pk2" + nl); return output.toString(); }
/** * Returns a String representation of this cross-link in distance file format. * * @return String object holding the representation of this cross-link in distance file format. */ public final String toString() { String atomId1 = AminoAcid.getAminoAcidId(preAtom) + "-" + preAtom.getName().trim(); String atomId2 = AminoAcid.getAminoAcidId(postAtom) + "-" + postAtom.getName().trim(); if (preAtom.getAlternativeLocation() != ' ') { atomId1 += "-" + preAtom.getAlternativeLocation(); } if (postAtom.getAlternativeLocation() != ' ') { atomId2 += "-" + postAtom.getAlternativeLocation(); } StringBuffer output = new StringBuffer(); int maxPeptideLength = xwalk.constants.Constants.MAX_PEPTIDE_LENGTH; int minPeptideLength = xwalk.constants.Constants.MIN_PEPTIDE_LENGTH; boolean outputPeptide = false; if (preAtomPeptide != null && postAtomPeptide != null) { outputPeptide = preAtomPeptide.size() <= maxPeptideLength && preAtomPeptide.size() >= minPeptideLength && postAtomPeptide.size() <= maxPeptideLength && postAtomPeptide.size() >= minPeptideLength; } output.append( this.filePath + "\t" + atomId1 + "\t" + atomId2 + "\t" + this.seqDist + "\t" + this.getEuclideanDistance() + "\t"); if (this.getSolventPathDistance() > -0.1 || this.getSolventPathDistance() < -0.9) { output.append(this.getSolventPathDistance() + "\t"); } else { output.append("-\t"); } if (this.doProbability) { output.append(this.getEuclideanDistanceProbability() + "\t"); if (this.getSolventPathDistance() > -0.1 || this.getSolventPathDistance() < -0.9) { output.append(this.getSolventPathDistanceProbability() + "\t"); } else { output.append("-\t"); } } else { output.append("-\t-\t"); } if (outputPeptide) { output.append( this.preAtomPeptide.toStringOneLetterCode() + "-" + this.postAtomPeptide.toStringOneLetterCode()); } else { output.append("-"); } output.append(Constants.LINE_SEPERATOR); return output.toString(); }