use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.
the class ProteinLigandInteractionProfiler method parsePiStackingInteractions.
private void parsePiStackingInteractions(Structure structure, Element interactionElement, List<Interaction> interactions) {
Elements piStackingInteractions = interactionElement.getElementsByTag("pi_stack");
piStackingInteractions.stream().map(element -> parsePiStackingInteraction(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 ProteinLigandInteractionProfiler method parseWaterBridges.
private void parseWaterBridges(Structure structure, Element interactionElement, List<Interaction> interactions) {
Elements waterBridges = interactionElement.getElementsByTag("water_bridge");
waterBridges.stream().map(element -> parseWaterBridge(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 ProteinLigandInteractionProfiler method annotatePolymerInteractions.
private InteractionContainer annotatePolymerInteractions(Chain chain) {
try {
Path outputDirectoryPath = createTemporaryOutputDirectory();
Structure structure = chain.getParentStructure();
String[] commandLineCall = composePolymerCommandLineCall(structure, outputDirectoryPath, chain.getChainIdentifier().getChainId());
// execute command
executeCommandLineCall(commandLineCall);
Path outputPath = outputDirectoryPath.resolve("report.xml");
Document document = Jsoup.parse(outputPath.toFile(), "UTF-8");
return parseDocument(structure, document);
} catch (Exception e) {
throw new ComputationException(e);
}
}
use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.
the class ProteinLigandInteractionProfiler method parsePiCationInteractions.
private void parsePiCationInteractions(Structure structure, Element interactionElement, List<Interaction> interactions) {
Elements piCationInteractions = interactionElement.getElementsByTag("pi_cation_interaction");
piCationInteractions.stream().map(element -> parsePiCationInteraction(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 ProteinLigandInteractionProfiler method parseSaltBridge.
private Optional<SaltBridge> parseSaltBridge(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> saltAtoms = element.getElementsByTag("idx").stream().map(Element::text).map(pdbSerial -> selectAtom(structure, pdbSerial)).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
if (saltAtoms.isEmpty()) {
return Optional.empty();
}
Group saltGroup = saltAtoms.get(0).getParentGroup();
return Optional.of(new SaltBridge(atom1, saltAtoms, group1, saltGroup));
}
Aggregations