Re: [Cdk-user] controlling hydrogen display with DepictionGenerator

2019-08-02 Thread John Mayfield
I think you probably want this:

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


On Fri, 2 Aug 2019 at 16:26, Tim Dudgeon  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 atomsint 
> 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 placeif (numHeavy < 2) {
> atom.setImplicitHydrogenCount(0);
> }
> } else { // non-carbon atomsatom.setImplicitHydrogenCount(0);
> }
> }
>
> Tim
>
>
> On Fri, 2 Aug 2019 at 12:09, Egon Willighagen 
> 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  available for innovative new uses
>> . Join me in asking the American
>> Chemical Society to join the Initiative for Open Citations too
>> .
>>  SpringerNature,
>> the RSC and many others already did .
>>
>> -
>> 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: -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


Re: [Cdk-user] controlling hydrogen display with DepictionGenerator

2019-08-02 Thread Tim Dudgeon

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 
mailto:egon.willigha...@gmail.com>> wrote:




On Fri, Aug 2, 2019 at 11:28 AM John Mayfield
mailto: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  available for innovative new
uses . Join me in asking the
American Chemical Society to join the Initiative for Open
Citations too

.
 SpringerNature,
the RSC and many others already did .

-
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: -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


Re: [Cdk-user] controlling hydrogen display with DepictionGenerator

2019-08-02 Thread John Mayfield
>
> 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?


> 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?

On Fri, 2 Aug 2019 at 12:09, Egon Willighagen 
wrote:

>
>
> On Fri, Aug 2, 2019 at 11:28 AM John Mayfield 
> 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  available for innovative new uses
> . Join me in asking the American
> Chemical Society to join the Initiative for Open Citations too
> .
>  SpringerNature,
> the RSC and many others already did .
>
> -
> 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: -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


Re: [Cdk-user] controlling hydrogen display with DepictionGenerator

2019-08-02 Thread Egon Willighagen
On Fri, Aug 2, 2019 at 11:28 AM John Mayfield 
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  available for innovative new uses
. Join me in asking the American
Chemical Society to join the Initiative for Open Citations too
.
SpringerNature,
the RSC and many others already did .

-
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: -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


Re: [Cdk-user] controlling hydrogen display with DepictionGenerator

2019-08-02 Thread Tim Dudgeon

Hi John,

Iterating the atoms and setting the implicit H count to zero does hide 
the implicit hydrogens but results in two nasty side effects:


1. explicit hydrogens are also not rendered

2. Carbon symbols are displayed (as if the withCarbonSymbols() method 
had been called).


Tim

On 02/08/2019 10:27, John Mayfield wrote:
It's not an option - and I would hesitant to add it as it's "at best 
ambiguous" (quoting Brecher's IUPAC :-)). Symyx/Accelrys/BioVia Draw 
like to hide the hydrogens by default which is where I think the 
acceptability crept in from. You right that for queries there's a 
use-case, but the depiction isn't really set up for rendering queries.


Anyways if you want to do it just add a helper routine to sets the 
implicit hydrogen counts to 0, for non aromatics you can put them


C1C[N]CN([H])C1


image.png
The radicals there are specific to the WebApp so you would just get a 
plain N - I may actually make than option as I don't like it (Noel 
Talked me into it).


Other option You can also use the old *BasicAtomGenerator* which never 
puts hydrogens on anything...


John

On Thu, 1 Aug 2019 at 18:12, Tim Dudgeon > wrote:


Can someone point to examples of how to control the display of
hydrogens
when depicting using DepictionGenerator?

It looks like implicit hydrogens are displayed on terminal and hetero
atoms which is not unreasonable, but what if I ONLY want explicit
hydrogens to be displayed (e.g. when depicting a query structure)
or I
don't want any hydrogens to be displayed?



___
Cdk-user mailing list
Cdk-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/cdk-user

___
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user


Re: [Cdk-user] controlling hydrogen display with DepictionGenerator

2019-08-02 Thread John Mayfield
It's not an option - and I would hesitant to add it as it's "at best
ambiguous" (quoting Brecher's IUPAC :-)). Symyx/Accelrys/BioVia Draw like
to hide the hydrogens by default which is where I think the acceptability
crept in from. You right that for queries there's a use-case, but the
depiction isn't really set up for rendering queries.

Anyways if you want to do it just add a helper routine to sets the implicit
hydrogen counts to 0, for non aromatics you can put them

C1C[N]CN([H])C1


[image: image.png]
The radicals there are specific to the WebApp so you would just get a plain
N - I may actually make than option as I don't like it (Noel Talked me into
it).

Other option You can also use the old *BasicAtomGenerator* which never puts
hydrogens on anything...

John

On Thu, 1 Aug 2019 at 18:12, Tim Dudgeon  wrote:

> Can someone point to examples of how to control the display of hydrogens
> when depicting using DepictionGenerator?
>
> It looks like implicit hydrogens are displayed on terminal and hetero
> atoms which is not unreasonable, but what if I ONLY want explicit
> hydrogens to be displayed (e.g. when depicting a query structure) or I
> don't want any hydrogens to be displayed?
>
>
>
> ___
> Cdk-user mailing list
> Cdk-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
___
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user


[Cdk-user] controlling hydrogen display with DepictionGenerator

2019-08-01 Thread Tim Dudgeon
Can someone point to examples of how to control the display of hydrogens 
when depicting using DepictionGenerator?


It looks like implicit hydrogens are displayed on terminal and hetero 
atoms which is not unreasonable, but what if I ONLY want explicit 
hydrogens to be displayed (e.g. when depicting a query structure) or I 
don't want any hydrogens to be displayed?




___
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user