/** * Constructor. * * @param atom1 - First protein atom to be connected by the virtual cross-linker. * @param atom2 - Second protein atom to be connected by the virtual cross-linker. */ public CrossLink(final Atom atom1, final Atom atom2) { this( atom1, atom2, Math.abs(atom1.getRank() - atom2.getRank()), Mathematics.distance(atom1.getXYZ(), atom2.getXYZ())); }
/** * Writes a the shortest paths of a list of virtual cross-links into a PDB formated file. * * @param pathFileName - String object holding the path to the PDB file to be written. * @param crossLinkList - List of cross-link objects holding each the the shortest path */ public final void writeSASDpdbFile(final String pathFileName, final CrossLinkList crossLinkList) { StringBuffer content = new StringBuffer(); for (CrossLink crossLink : crossLinkList) { if (crossLink.getPath() != null) { Atom atom1 = crossLink.getPreAtom(); Atom atom2 = crossLink.getPostAtom(); String distName = crossLink.getIndex() + "_" + this.decFormat.format(crossLink.getSolventPathDistance()) + "_" + atom1.getResidueName().trim() + "" + atom1.getResidueNumber() + "" + atom1.getChainId() + "-" + atom2.getResidueName().trim() + "" + atom2.getResidueNumber() + "" + atom2.getChainId() + "_solventPath"; content.append("HEADER " + distName + Constants.LINE_SEPERATOR); content.append(crossLink.getPath().toString(crossLink.getIndex())); content.append("END" + Constants.LINE_SEPERATOR); } } WriteFile file = new WriteFile(); file.setFile(pathFileName); file.write(content.toString()); }
/** * Sets to all amino acids atoms in a protein their associated XlogP values. * * @return float value representing the sum of XlogP values for the protein complex. */ private float setAtomicXlogP() { Hashtable<AminoAcidType, Hashtable<AtomType, Float>> xlogPs = ParameterReader.getXlogPparameterSet(); float sum = 0; for (PolyPeptide polyPeptide : this.polyPeptideComplex) { for (AminoAcid aa : polyPeptide) { for (Atom atom : aa.getAllAtoms()) { if (!atom.getElement().getSymbol().equals("H")) { Hashtable<AtomType, Float> atomicXlogPs = xlogPs.get(aa.getType()); float xlogP = atomicXlogPs.get(atom.getType()); atom.setXlogP(xlogP); sum += xlogP; } else { // hydrogen atoms have always a XlogP value of 0. atom.setXlogP(0); } } } } return sum; }
/** * Maps the hydrophobicity property of the protein on a list of atom. Note, that only atoms within * mm.constants.Constants.PHYSICOCHEMICAL_INFLUENCE_RADIUS will be included in the potential * calculation. * * @param sampleAtoms List of atoms on which potential will be calculated. */ public final void mapHydrophobicity(final AtomList sampleAtoms) { float max = mm.constants.Constants.PHYSICOCHEMICAL_INFLUENCE_RADIUS; for (Atom sampleAtom : sampleAtoms) { for (Atom atom : this.polyPeptideComplex.getAllAtoms()) { float dist = Mathematics.distance(atom.getXYZ(), sampleAtom.getXYZ()); if (dist <= max) { float h = atom.getXlogP(); double s = Mathematics.sigmoidFunction(dist, max); sampleAtom.setHes((float) (sampleAtom.getHes() + (h * s))); } } } }
/** * 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(); }
/** * Checks whether a second cross-link has the same atom identifier, i.e. residue name, residue * number, chain Id and atom name. * * @param crossLink - CrossLink object to be compared to this CrossLink object. * @return {@code TRUE} if both CrossLink object are equal in all atom identifier, {@code FALSE} * otherwise. */ public final boolean equals(final CrossLink crossLink) { Atom preAtom1 = this.getPreAtom(); Atom postAtom1 = this.getPostAtom(); Atom preAtom2 = crossLink.getPreAtom(); Atom postAtom2 = crossLink.getPostAtom(); if (this.equalsInHomolog(crossLink)) { String residueId1 = preAtom1.getChainId() + "#" + preAtom1.getName().trim(); String residueId2 = postAtom1.getChainId() + "#" + postAtom1.getName().trim(); String residueId3 = preAtom2.getChainId() + "#" + preAtom2.getName().trim(); String residueId4 = postAtom2.getChainId() + "#" + postAtom2.getName().trim(); if ((residueId1.equals(residueId3) && residueId2.equals(residueId4)) || (residueId2.equals(residueId3) && residueId1.equals(residueId4))) { return true; } } return false; }