Skip to content
Greg Landrum edited this page Dec 4, 2019 · 5 revisions

High level functions

All functions are in the structurepipeline module

  • structurepipeline.check_molblock(Mol block) -> tuple of (score, warning) tuples sorted by decreasing score
  • structurepipeline.standardize_molblock(Mol block) -> Mol block
  • structurepipeline.standardize_mol(RDKit mol) -> RDKit mol
  • structurepipeline.get_parent_molblock(Mol block) -> Mol block, exclude flag
  • structurepipeline.get_parent_mol(RDKit_mol) -> RDKit mol, exclude flag

Examples:

    >>> import structurepipeline
    >>> structurepipeline.check_molblock(''' 
    ...   Mrv1810 02151908462D           
    ...  
    ...   4  3  0  0  0  0            999 V2000 
    ...     2.2321    4.4196    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0 
    ...     3.0023    4.7153    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0 
    ...     1.4117    4.5059    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0 
    ...     1.9568    3.6420    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0 
    ...   1  2  1  1  0  0  0 
    ...   1  3  1  0  0  0  0 
    ...   1  4  1  0  0  0  0 
    ... M  END 
    ... ''')                                                                                                            
    ((5, 'InChi_RDKit/Mol stereo mismatch'),)
    >>> mb = structurepipeline.standardize_molblock('''
    ...   Mrv1810 07121910172D          
    ... 
    ...   4  3  0  0  0  0            999 V2000
    ...    -2.5038    0.4060    0.0000 C   0  0  3  0  0  0  0  0  0  0  0  0
    ...    -2.5038    1.2310    0.0000 O   0  5  0  0  0  0  0  0  0  0  0  0
    ...    -3.2182   -0.0065    0.0000 N   0  3  0  0  0  0  0  0  0  0  0  0
    ...    -1.7893   -0.0065    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    ...   1  2  1  0  0  0  0
    ...   1  3  1  0  0  0  0
    ...   1  4  1  4  0  0  0
    ... M  CHG  2   2  -1   3   1
    ... M  END
    ... ''')
    >>> print(mb)
    
         RDKit          2D
    
      4  3  0  0  0  0  0  0  0  0999 V2000
       -2.5038    0.4060    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
       -2.5038    1.2310    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
       -3.2182   -0.0065    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
       -1.7893   -0.0065    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
      1  2  1  0
      1  3  1  0
      1  4  1  0
    M  END

    >>> mb,exclude = structurepipeline.get_parent_molblock('''
    ...   Mrv1810 07121910262D          
    ... 
    ...   3  1  0  0  0  0            999 V2000
    ...    -5.2331    1.1053    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    ...    -4.5186    1.5178    0.0000 N   0  3  0  0  0  0  0  0  0  0  0  0
    ...    -2.8647    1.5789    0.0000 Cl  0  5  0  0  0  0  0  0  0  0  0  0
    ...   1  2  1  0  0  0  0
    ... M  CHG  2   2   1   3  -1
    ... M  END
    ... ''')
    >>> print(mb)
    
         RDKit          2D
    
      2  1  0  0  0  0  0  0  0  0999 V2000
       -5.2331    1.1053    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
       -4.5186    1.5178    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
      1  2  1  0
    M  END
    
    >>> 


Clone this wiki locally