/** * Sets both peptide object that are interconnected by this cross-linker. * * @param prePeptide - PolyPeptide object of the preAtom. * @param postPeptide - PolyPeptide object of the postAtom. * @return {@code TRUE} if both peptides contain both cross-linked atoms, {@code FALSE} otherwise. */ public final boolean setPeptides(final PolyPeptide prePeptide, final PolyPeptide postPeptide) { for (AminoAcid aa : prePeptide) { if (aa.getAllAtoms().contains(this.preAtom)) { this.preAtomPeptide = prePeptide; } if (aa.getAllAtoms().contains(this.postAtom)) { this.postAtomPeptide = prePeptide; } } // here the order must be inverse, i.e. first check for post than for // pre atom to allow for "self-cross-links". Self-cross-links are // cross-links between two identical atom, which is physically // incorrect but might be requested over a distance file. for (AminoAcid aa : postPeptide) { if (aa.getAllAtoms().contains(this.postAtom)) { this.postAtomPeptide = postPeptide; } if (aa.getAllAtoms().contains(this.preAtom)) { this.preAtomPeptide = postPeptide; } } if (this.preAtomPeptide != null && this.postAtomPeptide != null) { return true; } return false; }
/** * 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; }
/** * 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(); }