I think you probably want this:

new DepictionGenerator().withParam(StandardGenerator.Visibility.class,
                                   new SymbolVisibility() {
                                       @Override
                                       public boolean visible(IAtom
atom, List<IBond> neighbors, RendererModel model) {
                                           return atom.getAtomicNumber() != 6;
                                       }
                                   });


On Fri, 2 Aug 2019 at 16:26, Tim Dudgeon <tdudgeon...@gmail.com> wrote:

> On 02/08/2019 15:42, John Mayfield wrote:
>
> 1. explicit hydrogens are also not rendered
>
>
> Er... I showed the example with the explicit hydrogens being rendered.
> Let's clarify, what does "explicit hydrogen" mean to you?
>
> Sorry, my mistake. The explicit H is displayed. I was getting mixed up
> with too many examples!
>
>
>
>
>> 2. Carbon symbols are displayed (as if the withCarbonSymbols() method had
>> been called).
>
> The "Visibility" option controls this, but the other answer is just don't
> set to zero on carbons?
>
> Is there an example of how to use this "Visibility" option? Doesn't seem
> to be an option of DepictionGenerator.
>
> Not setting to zero on carbons is not so straight forward as you would
> still want this on terminal carbons.
> I suppose these would be carbons with only one bond to a non-hydrogen
> atom. Does this look right?
>
> for (IAtom atom : mol.atoms()) {
>     if (atom.getAtomicNumber() == 6) {
>         // count the number of connections that are heavy atoms        int 
> numHeavy = 0;
>         for (IBond bond : atom.bonds()) {
>             IAtom other = bond.getOther(atom);
>             if (other.getAtomicNumber() > 1) {
>                 numHeavy++;
>             }
>         }
>         // if only one then this is a terminal carbon so we need to leave the 
> Hs in place        if (numHeavy < 2) {
>             atom.setImplicitHydrogenCount(0);
>         }
>     } else { // non-carbon atoms        atom.setImplicitHydrogenCount(0);
>     }
> }
>
> Tim
>
>
> On Fri, 2 Aug 2019 at 12:09, Egon Willighagen <egon.willigha...@gmail.com>
> wrote:
>
>>
>>
>> On Fri, Aug 2, 2019 at 11:28 AM John Mayfield <
>> john.wilkinson...@gmail.com> wrote:
>>
>>> Other option You can also use the old *BasicAtomGenerator* which never
>>> puts hydrogens on anything...
>>>
>>
>> Documentation on the old generator stack can be found in this copy of the
>> Groovy CDK book, "Depiction" chapter:
>>
>>
>> https://figshare.com/articles/Edition_1_4_1_0_of_Groovy_Cheminformatics_with_the_Chemistry_Development_Kit/2057790
>>
>> Egon
>>
>> --
>> Hi, do you like citation networks? Already 51% of all citations are
>> available <https://i4oc.org/> available for innovative new uses
>> <https://twitter.com/hashtag/acs2ioc>. Join me in asking the American
>> Chemical Society to join the Initiative for Open Citations too
>> <https://www.change.org/p/asking-the-american-chemical-society-to-join-the-initiative-for-open-citations>.
>>  SpringerNature,
>> the RSC and many others already did <https://i4oc.org/#publishers>.
>>
>> -----
>> E.L. Willighagen
>> Department of Bioinformatics - BiGCaT
>> Maastricht University (http://www.bigcat.unimaas.nl/)
>> Homepage: http://egonw.github.com/
>> Blog: http://chem-bla-ics.blogspot.com/
>> PubList: https://www.zotero.org/egonw
>> ORCID: 0000-0001-7542-0286 <http://orcid.org/0000-0001-7542-0286>
>> ImpactStory: https://impactstory.org/u/egonwillighagen
>>
>
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to