wengong-jin / hgraph2graph

Hierarchical Generation of Molecular Graphs using Structural Motifs
MIT License
375 stars 109 forks source link

MolGraph for cyclic structures #4

Closed rouzbeh-afrasiabi closed 4 years ago

rouzbeh-afrasiabi commented 4 years ago

In the previous implementation of mol_graph for JTVA (https://github.com/wengong-jin/icml18-jtnn/blob/1d298810e193ce2eef1252f653ea2a3794bdf66b/fast_jtnn/chemutils.py) the code included the following block which merged rings, this step seems to be missing from the new implementation. Could you please clarify if this is the case.


  #Merge Rings with intersection > 2 atoms
  for i in range(len(cliques)):
      #only focus on rings skip other cliques
      if len(cliques[i]) <= 2: continue
      for atom in cliques[i]:
          for j in nei_list[atom]:
              if i >= j or len(cliques[j]) <= 2: continue
              inter = set(cliques[i]) & set(cliques[j])
              if len(inter) > 2:
                  cliques[i].extend(cliques[j])
                  cliques[i] = list(set(cliques[i]))
                  cliques[j] = []
  cliques = [c for c in cliques if len(c) > 0]  `
wengong-jin commented 4 years ago

Hi,

Yes. This is now handled by the motif extraction script generation/poly_hgraph/find_fragments.py

Wengong

rouzbeh-afrasiabi commented 4 years ago

Thank you for the quick response and clarifying Wengong.