use of de.bioforscher.jstructure.model.identifier.ResidueIdentifier in project jstructure by JonStargaryen.
the class A02_CreatePyMolRenderJobsForStrongResidues method composePyMolCommand.
private static Optional<String> composePyMolCommand(Path path) {
try {
String entryId = path.toFile().getName().split("\\.")[0];
String pdbId = Jsoup.parse(path.toFile(), "UTF-8").getElementsByTag("protein").attr("pdb_id");
Structure structure = StructureParser.fromPdbId(pdbId).parse();
Chain chain = structure.chains().findFirst().get();
Start2FoldXmlParser.parse(chain, Start2FoldConstants.XML_DIRECTORY.resolve(entryId + ".xml"));
List<Integer> strongResidues = chain.aminoAcids().filter(aminoAcid -> aminoAcid.getFeature(Start2FoldResidueAnnotation.class).isStrong()).map(AminoAcid::getResidueIdentifier).map(ResidueIdentifier::getResidueNumber).collect(Collectors.toList());
if (strongResidues.isEmpty()) {
return Optional.empty();
}
return Optional.of("delete all" + System.lineSeparator() + "fetch " + pdbId + ", async=0" + System.lineSeparator() + // hide non-relevant stuff
"hide everything" + System.lineSeparator() + "show cartoon, chain A" + System.lineSeparator() + // decolor everything
"color grey80" + System.lineSeparator() + "zoom (chain A)" + System.lineSeparator() + strongResidues.stream().map(res -> "color efr, resi " + res).collect(Collectors.joining(System.lineSeparator())) + System.lineSeparator() + "ray" + System.lineSeparator() + "png " + Start2FoldConstants.PYMOL_DIRECTORY.resolve(entryId + "-strong.png") + System.lineSeparator());
} catch (IOException e) {
return Optional.empty();
}
}
Aggregations