use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.
the class ProteinLigandInteractionProfiler method writePolymerInteractions.
public void writePolymerInteractions(Chain chain, Path outputPath) {
try {
Path outputDirectoryPath = createTemporaryOutputDirectory();
Structure structure = chain.getParentStructure();
String[] commandLineCall = composePolymerCommandLineCall(structure, outputDirectoryPath, chain.getChainIdentifier().getChainId());
// execute command
executeCommandLineCall(commandLineCall);
Path output = outputDirectoryPath.resolve("report.xml");
Files.copy(output, outputPath);
} catch (Exception e) {
throw new ComputationException(e);
}
}
use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.
the class ProteinLigandInteractionProfiler method parseMetalComplexes.
private void parseMetalComplexes(Structure structure, Element interactionElement, List<Interaction> interactions) {
Elements metalComplexes = interactionElement.getElementsByTag("metal_complex");
metalComplexes.stream().map(element -> parseMetalComplex(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 parsePiCationInteraction.
private Optional<PiCationInteraction> parsePiCationInteraction(Structure structure, Element element) {
// TODO check if direction can be reversed: protein is pi system, ligand is cation
// TODO: potentially half interaction
Optional<Element> optionalCationCoordinateElement = element.getElementsByTag("protcoo").stream().findFirst();
if (!optionalCationCoordinateElement.isPresent()) {
return Optional.empty();
}
Element cationCoordinateElement = optionalCationCoordinateElement.get();
double[] cationCoordinates = new double[] { Double.valueOf(cationCoordinateElement.getElementsByTag("x").first().text()), Double.valueOf(cationCoordinateElement.getElementsByTag("y").first().text()), Double.valueOf(cationCoordinateElement.getElementsByTag("z").first().text()) };
String chainId = element.getElementsByTag("reschain").first().text();
int residueNumber = Integer.valueOf(element.getElementsByTag("resnr").first().text());
Optional<Group> optionalCationGroup = structure.select().chainId(chainId).residueNumber(residueNumber).asOptionalGroup();
if (!optionalCationGroup.isPresent()) {
return Optional.empty();
}
Group cationGroup = optionalCationGroup.get();
Optional<Atom> optionalCation = cationGroup.atoms().min(Comparator.comparingDouble(atom -> atom.calculate().distanceFast(cationCoordinates)));
if (!optionalCation.isPresent()) {
return Optional.empty();
}
Atom cation = optionalCation.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 PiCationInteraction(cation, piAtoms, cationGroup, piGroup));
}
use of de.bioforscher.jstructure.model.structure.Structure in project jstructure by JonStargaryen.
the class ProteinLigandInteractionProfiler method parseHydrogenBonds.
private void parseHydrogenBonds(Structure structure, Element interactionElement, List<Interaction> interactions) {
Elements hydrogenBonds = interactionElement.getElementsByTag("hydrogen_bond");
hydrogenBonds.stream().map(element -> parseHydrogenBond(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 parseSaltBridges.
private void parseSaltBridges(Structure structure, Element interactionElement, List<Interaction> interactions) {
Elements saltBridges = interactionElement.getElementsByTag("salt_bridge");
saltBridges.stream().map(element -> parseSaltBridge(structure, element)).filter(Optional::isPresent).map(Optional::get).forEach(interactions::add);
}
Aggregations