use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.
the class ProteinLigandInteractionProfiler method parsePiStackingInteraction.
private Optional<PiStackingInteraction> parsePiStackingInteraction(Structure structure, Element element) {
// TODO: potentially half interaction
Optional<Element> optionalCoordinateElement = element.getElementsByTag("protcoo").stream().findFirst();
if (!optionalCoordinateElement.isPresent()) {
return Optional.empty();
}
Element coordinateElement = optionalCoordinateElement.get();
double[] coordinates = new double[] { Double.valueOf(coordinateElement.getElementsByTag("x").first().text()), Double.valueOf(coordinateElement.getElementsByTag("y").first().text()), Double.valueOf(coordinateElement.getElementsByTag("z").first().text()) };
String chainId = element.getElementsByTag("reschain").first().text();
int residueNumber = Integer.valueOf(element.getElementsByTag("resnr").first().text());
Optional<Group> optionalGroup1 = structure.select().chainId(chainId).residueNumber(residueNumber).asOptionalGroup();
if (!optionalGroup1.isPresent()) {
return Optional.empty();
}
Group group1 = optionalGroup1.get();
Optional<Atom> optionalAtom1 = group1.atoms().min(Comparator.comparingDouble(atom -> atom.calculate().distanceFast(coordinates)));
if (!optionalAtom1.isPresent()) {
return Optional.empty();
}
Atom atom1 = optionalAtom1.get();
List<Atom> piAtoms = element.getElementsByTag("idx").stream().map(Element::text).map(pdbSerial -> selectAtom(structure, pdbSerial)).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
if (piAtoms.isEmpty()) {
return Optional.empty();
}
Group piGroup = piAtoms.get(0).getParentGroup();
return Optional.of(new PiStackingInteraction(atom1, piAtoms, group1, piGroup));
}
use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.
the class ProteinLigandInteractionProfiler method parseHalogenBonds.
private void parseHalogenBonds(Structure structure, Element interactionElement, List<Interaction> interactions) {
Elements halogenBonds = interactionElement.getElementsByTag("halogen_bond");
halogenBonds.stream().map(element -> parseHalogenBond(structure, element)).filter(Optional::isPresent).map(Optional::get).forEach(interactions::add);
}
use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.
the class EnergyProfileCalculatorTest method shouldAgreeRegardingEnergyTerms.
@Test
public void shouldAgreeRegardingEnergyTerms() throws IOException {
Structure protein = StructureParser.fromPdbId("1bs2").parse();
featureProvider.process(protein);
TestUtils.getResourceAsStream("energy/1bs2.ep2").filter(line -> line.startsWith("ENGY")).map(line -> line.split("\t")).forEach(split -> {
Group group = protein.select().chainName(split[1]).residueNumber(Integer.valueOf(split[2])).asGroup();
Assert.assertEquals("energy values differ for " + group, Double.valueOf(split[5]), group.getFeature(EnergyProfile.class).getSolvationEnergy(), 0.001);
});
}
use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.
the class EnergyProfileCalculatorTest method shouldProcessStructureWithSelenomethionine.
@Test
public void shouldProcessStructureWithSelenomethionine() {
Structure protein = StructureParser.fromPdbId("3TQO").parse();
featureProvider.process(protein);
}
use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.
the class DictionaryOfProteinSecondaryStructureTest method getDSSPAnnotatedStructure.
private String getDSSPAnnotatedStructure(String id) throws IOException, StructureException {
// load structure
org.biojava.nbio.structure.Structure protein = new PDBFileReader().getStructureById(id);
// assign states
new SecStrucCalc().calculate(protein, true);
// return complete DSSP annotation string from BioJava
return protein.getChains().stream().flatMap(chain -> chain.getAtomGroups(GroupType.AMINOACID).stream()).map(aminoAcid -> aminoAcid.getProperty(Group.SEC_STRUC)).map(SecStrucState.class::cast).map(SecStrucState::getType).map(type -> String.valueOf(type.type)).collect(Collectors.joining());
}
Aggregations