use of ffx.potential.bonded.ResidueEnumerations.NucleicAcid3 in project ffx by mjschnie.
the class RotamerLibrary method measureNARotamer.
/**
* Measure the current torsions of a nucleic acid Residue, starting from the
* 5'-most torsion.
*
* Chi[0]-chi[6] in order are: delta (i-1), epsilon (i-1), zeta (i-1), alpha
* (i), beta (i), gamma (i) and delta (i) for residue i.
*
* @param residue Residue to be measured.
* @param chi Array to be filled with torsion values.
* @param print Verbosity flag.
*/
public static void measureNARotamer(Residue residue, double[] chi, boolean print) {
NucleicAcid3 name = NucleicAcid3.valueOf(residue.getName());
Residue prevResidue = residue.getPreviousResidue();
Torsion torsion;
Atom C5s = (Atom) residue.getAtomNode("C5\'");
Atom C4s = (Atom) residue.getAtomNode("C4\'");
Atom C3s = (Atom) residue.getAtomNode("C3\'");
Atom O3s = (Atom) residue.getAtomNode("O3\'");
Atom O5s = (Atom) residue.getAtomNode("O5\'");
Atom P = (Atom) residue.getAtomNode("P");
/*
* Start by measuring delta (i-1) if available, working up to delta. If
* there is no prior residue, start measuring from the 5'-most torsion.
*/
if (prevResidue == null) {
switch(name) {
case GUA:
case ADE:
case DGU:
case DAD:
case CYT:
case URI:
case THY:
case DCY:
case DTY:
/*
* If there is an H5T, measure alpha based on H5T. Else,
* measure zeta (i-1) based on OP3 and alpha on P.
*/
Atom H5T = (Atom) residue.getAtomNode("H5T");
if (H5T != null) {
torsion = H5T.getTorsion(O5s, C5s, C4s);
chi[4] = torsion.getValue();
if (print) {
logger.info(torsion.toString());
}
} else {
Atom OP3 = (Atom) residue.getAtomNode("OP3");
if (OP3 != null) {
torsion = OP3.getTorsion(P, O5s, C5s);
chi[3] = torsion.getValue();
if (print) {
logger.info(torsion.toString());
}
}
torsion = P.getTorsion(O5s, C5s, C4s);
chi[4] = torsion.getValue();
if (print) {
logger.info(torsion.toString());
}
}
break;
default:
break;
}
} else {
switch(name) {
case GUA:
case ADE:
case DGU:
case DAD:
case CYT:
case URI:
case THY:
case DCY:
case DTY:
Atom O3sPrev = (Atom) prevResidue.getAtomNode("O3\'");
Atom C3sPrev = (Atom) prevResidue.getAtomNode("C3\'");
Atom C4sPrev = (Atom) prevResidue.getAtomNode("C4\'");
Atom C5sPrev = (Atom) prevResidue.getAtomNode("C5\'");
torsion = C5sPrev.getTorsion(C4sPrev, C3sPrev, O3sPrev);
chi[0] = torsion.getValue();
if (print) {
logger.info(torsion.toString());
}
torsion = C4sPrev.getTorsion(C3sPrev, O3sPrev, P);
chi[1] = torsion.getValue();
if (print) {
logger.info(torsion.toString());
}
torsion = C3sPrev.getTorsion(O3sPrev, P, O5s);
chi[2] = torsion.getValue();
if (print) {
logger.info(torsion.toString());
}
torsion = O3sPrev.getTorsion(P, O5s, C5s);
chi[3] = torsion.getValue();
if (print) {
logger.info(torsion.toString());
}
torsion = P.getTorsion(O5s, C5s, C4s);
chi[4] = torsion.getValue();
if (print) {
logger.info(torsion.toString());
}
break;
default:
break;
}
}
/*
* Measure torsions common to all nucleic acids (gamma, delta).
*/
torsion = O5s.getTorsion(C5s, C4s, C3s);
chi[5] = torsion.getValue();
if (print) {
logger.info(torsion.toString());
}
torsion = C5s.getTorsion(C4s, C3s, O3s);
chi[6] = torsion.getValue();
if (print) {
logger.info(torsion.toString());
}
}
use of ffx.potential.bonded.ResidueEnumerations.NucleicAcid3 in project ffx by mjschnie.
the class RotamerLibrary method applyNARotamer.
/**
* Applies a nucleic acid Rotamer, and throws NACorrectionException
* if the Rotamer must be corrected too far to correctly join to Residue
* i-1. correctionThreshold and independent are both special-case variables;
* a non-zero correctionThreshold is used to prune Rotamers with excessively
* large corrections, and independent disables the NA correction, presently
* only performed by saveRotamers.
*
* Note that the independent flag is separate from DEE independence: DEE
* independence is preserved by applying corrections based on a non-variable
* set of coordinates, and is wholly independent of what is happening to
* residue i-1.
*
* Cannot presently handle 3' phosphate caps: I do not know what they would
* be labeled as in PDB files. A template for how to handle 3' phosphate
* caps is written but commented out.
*
* @param residue Residue.
* @param rotamer Rotamer to be applied to Residue.
* @param correctionThreshold Maximum acceptable backbone correction.
* @param independent Whether to draw NA rotamer independent of chain
* context.
* @throws NACorrectionException If correction .GT.
* correctionThreshold.
*/
private static void applyNARotamer(Residue residue, Rotamer rotamer, double correctionThreshold, boolean independent) throws NACorrectionException {
NucleicAcid3 na = NucleicAcid3.valueOf(residue.getName());
Residue prevResidue = residue.getPreviousResidue();
// 3' terminal
boolean is3sTerminal = false;
int sugarPucker;
int prevSugarPucker;
if (residue.getNextResidue() == null) {
is3sTerminal = true;
}
// Check if this is a 3' phosphate being listed as its own residue.
/* if (residue.getAtomList().size() == 1) {
return;
} */
// Could be specified by appplySugarPucker, but that
boolean isDeoxy;
// would be confusing.
switch(na) {
case DTY:
case DGU:
case DAD:
case DCY:
isDeoxy = true;
break;
case GUA:
case CYT:
case URI:
case ADE:
case THY:
default:
isDeoxy = false;
break;
}
// Note: chi values will generally be applied from chi7 to chi1.
// Will have to add an else-if to handle DNA C3'-exo configurations.
// Sugar pucker = 1: North pucker. 2: South pucker. 3: C3'-exo pucker.
sugarPucker = checkPucker(rotamer.chi7);
prevSugarPucker = checkPucker(rotamer.chi1);
// Revert C1', O4', and C4' coordinates to PDB defaults.
Atom C1s = (Atom) residue.getAtomNode("C1\'");
C1s.moveTo(residue.getC1sCoords());
Atom O4s = (Atom) residue.getAtomNode("O4\'");
O4s.moveTo(residue.getO4sCoords());
Atom C4s = (Atom) residue.getAtomNode("C4\'");
C4s.moveTo(residue.getC4sCoords());
// Presently, the exterior method loadPriorAtomicCoordinates() directly
// calls applySugarPucker instead of going through applyRotamer().
applySugarPucker(residue, sugarPucker, isDeoxy, true);
applyNABackbone(residue, rotamer, prevResidue);
if (prevResidue != null && !independent) {
applyNACorrections(residue, prevResidue, rotamer, prevSugarPucker, correctionThreshold, isDeoxy, is3sTerminal);
}
/* else if (!independent) {
startingResidueConsistencyCheck(residue, rotamer, correctionThreshold);
} */
applyNASideAtoms(residue, rotamer, prevResidue, isDeoxy, is3sTerminal, prevSugarPucker);
}
use of ffx.potential.bonded.ResidueEnumerations.NucleicAcid3 in project ffx by mjschnie.
the class MultiResidue method getRotamers.
@Override
public Rotamer[] getRotamers(RotamerLibrary library) {
if (rotamers != null) {
return rotamers;
}
List<Rotamer[]> usual = new ArrayList<>();
int nRots = 0;
for (Residue residue : consideredResidues) {
Rotamer[] rotamers = library.getRotamers(residue);
if (rotamers != null && rotamers.length > 0) {
usual.add(rotamers);
nRots += rotamers.length;
}
}
if (library.getUsingOrigCoordsRotamer()) {
if (originalRotamer == null && (residueType == ResidueType.AA || residueType == ResidueType.NA)) {
ResidueState origState = storeState();
double[] chi = RotamerLibrary.measureRotamer(activeResidue, false);
if (residueType == ResidueType.AA) {
AminoAcid3 aa3 = this.getAminoAcid3();
originalRotamer = new Rotamer(aa3, origState, chi);
} else if (residueType == ResidueType.NA) {
NucleicAcid3 na3 = this.getNucleicAcid3();
originalRotamer = new Rotamer(na3, origState, chi);
}
}
Rotamer[] allRotamers;
if (originalRotamer != null) {
allRotamers = new Rotamer[nRots + 1];
int index;
if (origAtEnd) {
index = 0;
allRotamers[allRotamers.length - 1] = originalRotamer;
} else {
index = 1;
allRotamers[0] = originalRotamer;
}
for (Rotamer[] rotamersI : usual) {
int nrotamers = rotamersI.length;
System.arraycopy(rotamersI, 0, allRotamers, index, nrotamers);
index += nrotamers;
}
} else {
allRotamers = addAllDefaultRotamers(usual, nRots);
}
return allRotamers;
} else {
return addAllDefaultRotamers(usual, nRots);
}
}
Aggregations