hgraph2graph icon indicating copy to clipboard operation
hgraph2graph copied to clipboard

AssertionError

Open orubaba opened this issue 2 years ago • 12 comments

Hi gurus, pls, I need your help. I am trying to run the get-vocab.py on my small dataset around 100. but keep getting this error as shown below: Is there a way to go around this. the reference for the error is to the mol_graph.py line82: "assert n - m <= 1 #must be connected" image

orubaba avatar Jul 17 '22 05:07 orubaba

I'm having the exact same issue - any idea why this is?

max-unfried avatar Jul 20 '22 10:07 max-unfried

@wengong-jin Can you please suggest a solution for this ? Thanks

NiharikaVadlamudi avatar Aug 02 '22 14:08 NiharikaVadlamudi

Anything that you could suggest - still hung up on it?

max-unfried avatar Aug 08 '22 13:08 max-unfried

+1

AdamIzdebski avatar Sep 26 '22 20:09 AdamIzdebski

Can you post a picture of your molecule / encoded graph? In my experience you get n-m > 1 when there's atoms that aren't connected to the rest of the molecule. This could be because the cluster generation process in find_clusters() wasn't built for a particular combination of rings / bonds

marshallcase avatar Oct 01 '22 16:10 marshallcase

Hi, reopening this as I am currently experiencing the same problem. It says the issue occurs in tree_decomp line 82

Has anybody found a fix yet?

JonathanBroadbent avatar Sep 27 '23 19:09 JonathanBroadbent

Hi,

check out this code and correct your get_vocal.py. let's see if it works. this is what i adjusted.

[image: image.png]

On Wed, Sep 27, 2023 at 9:32 PM JonathanBroadbent @.***> wrote:

Hi, reopening this as I am currently experiencing the same problem. It says the issue occurs in tree_decomp line 82

— Reply to this email directly, view it on GitHub https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1737964626, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVBVXE34PIUE4MT7NVBFVRLX4R5OTANCNFSM53ZE4TNQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Regards, Adeshina

orubaba avatar Sep 28 '23 01:09 orubaba

HI Adeshina,

Thanks for the response, the image you attached only shows alt text. Can you resend it to me?

Jonathan

From: Adeshina John Orubuloye @.> Date: Wednesday, September 27, 2023 at 9:56 PM To: wengong-jin/hgraph2graph @.> Cc: Broadbent, Jonathan /CA @.>, Comment @.> Subject: Re: [wengong-jin/hgraph2graph] AssertionError (Issue #43) Hi,

check out this code and correct your get_vocal.py. let's see if it works. this is what i adjusted.

[image: image.png]

On Wed, Sep 27, 2023 at 9:32 PM JonathanBroadbent @.***> wrote:

Hi, reopening this as I am currently experiencing the same problem. It says the issue occurs in tree_decomp line 82

— Reply to this email directly, view it on GitHub <https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1737964626https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1737964626>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AVBVXE34PIUE4MT7NVBFVRLX4R5OTANCNFSM53ZE4TNQhttps://github.com/notifications/unsubscribe-auth/AVBVXE34PIUE4MT7NVBFVRLX4R5OTANCNFSM53ZE4TNQ> . You are receiving this because you authored the thread.Message ID: @.***>

-- Regards, Adeshina

— Reply to this email directly, view it on GitHubhttps://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1738330411, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BAGO4OZUGGJCB4MEE3VS6N3X4TKMXANCNFSM53ZE4TNQ. You are receiving this because you commented.Message ID: @.***>

JonathanBroadbent avatar Sep 28 '23 17:09 JonathanBroadbent

Hi,

sorry for that. hope this works this time.

On Thu, Sep 28, 2023 at 7:12 PM JonathanBroadbent @.***> wrote:

HI Adeshina,

Thanks for the response, the image you attached only shows alt text. Can you resend it to me?

Jonathan

From: Adeshina John Orubuloye @.> Date: Wednesday, September 27, 2023 at 9:56 PM To: wengong-jin/hgraph2graph @.> Cc: Broadbent, Jonathan /CA @.>, Comment @.> Subject: Re: [wengong-jin/hgraph2graph] AssertionError (Issue #43) Hi,

check out this code and correct your get_vocal.py. let's see if it works. this is what i adjusted.

[image: image.png]

On Wed, Sep 27, 2023 at 9:32 PM JonathanBroadbent @.***> wrote:

Hi, reopening this as I am currently experiencing the same problem. It says the issue occurs in tree_decomp line 82

— Reply to this email directly, view it on GitHub < https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1737964626 < https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1737964626>>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AVBVXE34PIUE4MT7NVBFVRLX4R5OTANCNFSM53ZE4TNQ < https://github.com/notifications/unsubscribe-auth/AVBVXE34PIUE4MT7NVBFVRLX4R5OTANCNFSM53ZE4TNQ>>

. You are receiving this because you authored the thread.Message ID: @.***>

-- Regards, Adeshina

— Reply to this email directly, view it on GitHub< https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1738330411>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/BAGO4OZUGGJCB4MEE3VS6N3X4TKMXANCNFSM53ZE4TNQ>.

You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1739718579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVBVXE7VJCH4TH4QNAHXB6DX4WVZXANCNFSM53ZE4TNQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Regards, Adeshina

orubaba avatar Sep 29 '23 04:09 orubaba

Hi Adeshina,

Sorry, I still do not see any image. Perhaps you could upload it by replying directly on github? Or email me directly? @.***)

Jonathan

From: Adeshina John Orubuloye @.> Date: Friday, September 29, 2023 at 12:37 AM To: wengong-jin/hgraph2graph @.> Cc: Broadbent, Jonathan /CA @.>, Comment @.> Subject: Re: [wengong-jin/hgraph2graph] AssertionError (Issue #43) Hi,

sorry for that. hope this works this time.

On Thu, Sep 28, 2023 at 7:12 PM JonathanBroadbent @.***> wrote:

HI Adeshina,

Thanks for the response, the image you attached only shows alt text. Can you resend it to me?

Jonathan

From: Adeshina John Orubuloye @.> Date: Wednesday, September 27, 2023 at 9:56 PM To: wengong-jin/hgraph2graph @.> Cc: Broadbent, Jonathan /CA @.>, Comment @.> Subject: Re: [wengong-jin/hgraph2graph] AssertionError (Issue #43) Hi,

check out this code and correct your get_vocal.py. let's see if it works. this is what i adjusted.

[image: image.png]

On Wed, Sep 27, 2023 at 9:32 PM JonathanBroadbent @.***> wrote:

Hi, reopening this as I am currently experiencing the same problem. It says the issue occurs in tree_decomp line 82

— Reply to this email directly, view it on GitHub < https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1737964626https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1737964626 < https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1737964626https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1737964626>>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AVBVXE34PIUE4MT7NVBFVRLX4R5OTANCNFSM53ZE4TNQhttps://github.com/notifications/unsubscribe-auth/AVBVXE34PIUE4MT7NVBFVRLX4R5OTANCNFSM53ZE4TNQ < https://github.com/notifications/unsubscribe-auth/AVBVXE34PIUE4MT7NVBFVRLX4R5OTANCNFSM53ZE4TNQhttps://github.com/notifications/unsubscribe-auth/AVBVXE34PIUE4MT7NVBFVRLX4R5OTANCNFSM53ZE4TNQ>>

. You are receiving this because you authored the thread.Message ID: @.***>

-- Regards, Adeshina

— Reply to this email directly, view it on GitHub< https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1738330411https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1738330411>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/BAGO4OZUGGJCB4MEE3VS6N3X4TKMXANCNFSM53ZE4TNQhttps://github.com/notifications/unsubscribe-auth/BAGO4OZUGGJCB4MEE3VS6N3X4TKMXANCNFSM53ZE4TNQ>.

You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub <https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1739718579https://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1739718579>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AVBVXE7VJCH4TH4QNAHXB6DX4WVZXANCNFSM53ZE4TNQhttps://github.com/notifications/unsubscribe-auth/AVBVXE7VJCH4TH4QNAHXB6DX4WVZXANCNFSM53ZE4TNQ> . You are receiving this because you authored the thread.Message ID: @.***>

-- Regards, Adeshina

— Reply to this email directly, view it on GitHubhttps://github.com/wengong-jin/hgraph2graph/issues/43#issuecomment-1740305221, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BAGO4O462PX5P5JZVCVEDATX4ZGBTANCNFSM53ZE4TNQ. You are receiving this because you commented.Message ID: @.***>

JonathanBroadbent avatar Sep 29 '23 15:09 JonathanBroadbent

import sys import argparse from hgraph import * from rdkit import Chem from multiprocessing.dummy import Pool

def process(data): vocab = set() for line in data: s = line.strip("\r\n ") hmol = MolGraph(s) for node,attr in hmol.mol_tree.nodes(data=True): smiles = attr['smiles'] vocab.add( attr['label'] ) for i,s in attr['inter_label']: vocab.add( (smiles, s) ) return vocab

if name == "main":

parser = argparse.ArgumentParser()
parser.add_argument('--ncpu', type=int, default=1)
args = parser.parse_args()

data = [mol for line in sys.stdin for mol in line.split()[:2]]
data = list(set(data))

batch_size = len(data) // args.ncpu + 1
batches = [data[i : i + batch_size] for i in range(0, len(data), batch_size)]

with Pool(args.ncpu) as pool:
    vocab_list = pool.map(process, batches, chunksize=1)
    vocab = [(x,y) for vocab in vocab_list for x,y in vocab]

orubaba avatar Sep 30 '23 02:09 orubaba

Interestingly, I removed all contents from line 34 downwards (I don't know why that should solve the problem for me) and it ran well. sorry you couldn't get the img. I was responding within my mail. let's see if it works. btw, chatgpt was really helpful with the error clearings.

orubaba avatar Sep 30 '23 02:09 orubaba