use of io.imgs.coloration.ColoredAtomGenerator.AtomColorer in project Smiles2Monomers by yoann-dufresne.
the class PictureCoverageGenerator method createPNG.
public ColorsMap createPNG(Coverage coverage, File outfile) {
ColorsMap coverageColors = new ColorsMap();
AtomColorer ac = this.cag.getColorer();
IMolecule mol = coverage.getMolecule(false);
List<Color> colors = ColorsGenerator.HsbColorsGeneration(coverage.nbMatchesForCoverage());
int i = 0;
for (Match match : coverage.getUsedMatches()) {
Residue res = match.getResidue();
List<Color> matchesColor = coverageColors.containsKey(res) ? coverageColors.get(res) : new ArrayList<Color>();
for (int idx : match.getAtoms()) {
if (!"H".equals(coverage.getMolecule(true).getAtom(idx).getSymbol()))
ac.setColor(mol.getAtom(idx), colors.get(i));
}
matchesColor.add(colors.get(i));
coverageColors.put(res, matchesColor);
i++;
}
this.createPNG(mol, outfile);
ac.resetColors();
return coverageColors;
}
Aggregations