Beispiel #1
0
def cairo_out_test():
    import molfile
    import time
    cid = 22646404
    #cid = 1373132
    #cid = 18305969
    #cid = 19815256
    f = file("%d.mol" % cid, "r")
    mol = molfile.file_to_mol(f)
    f.close()
    import cairo_out
    mol.normalize_bond_length(25)
    mol.remove_unimportant_hydrogens()
    c = cairo_out.cairo_out(scaling=4.0,
                            margin=10,
                            font_size=16,
                            bond_second_line_shortening=0.15,
                            bond_width=6,
                            line_width=2.0,
                            antialias_drawing=True,
                            antialias_text=True)
    #c.background_color = (1,1,0.6)
    c.show_hydrogens_on_hetero = True
    t = time.time()
    c.mol_to_cairo(mol, "%d.png" % cid)
    c.mol_to_cairo(mol, "%d.pdf" % cid, format="pdf")
    c.mol_to_cairo(mol, "%d.svg" % cid, format="svg")
    print time.time() - t
Beispiel #2
0
def cairo_out_test_wedge():
    import molfile
    import time
    f = file( "untitled0.mol", "r")
    mol = molfile.file_to_mol( f)
    f.close()
    import cairo_out
    mol.normalize_bond_length( 30)
    mol.remove_unimportant_hydrogens()
    c = cairo_out.cairo_out( scaling=1.0, antialias_text=True, color_bonds=True, color_atoms=True)
    t = time.time()
    c.mol_to_cairo( mol, "untitled0.png")
    print time.time()-t
Beispiel #3
0
def cairo_out_test3d():
    import molfile
    f = file( "1.mol", "r")
    mol = molfile.file_to_mol( f)
    f.close()
    import cairo_out
    #mol.normalize_bond_length( 25)
    #mol.remove_unimportant_hydrogens()
    c = cairo_out.cairo_out( scaling=1.0, margin=30, font_size=16,
                             bond_second_line_shortening=0.15, bond_width=6,
                             line_width=2.0, antialias_drawing=True,
                             antialias_text=True)
    c.show_hydrogens_on_hetero = True
    c.mol_to_cairo( mol, "1.png")
Beispiel #4
0
def cairo_out_test2():
    import smiles
    #mol = smiles.text_to_mol( "COC(=O)CNC(C1=CC=CC=C1)C2=C(C=CC(=C2)Br)NC(=O)C3=CC(=CC=C3)Cl")
    #mol = smiles.text_to_mol( "c1nccc2c1cncn2")
    mol = smiles.text_to_mol( "CCC=CC(=O)C.CCCC")
    import cairo_out
    mol.normalize_bond_length( 30)
    mol.remove_unimportant_hydrogens()
    c = cairo_out.cairo_out( color_bonds=True, color_atoms=True) #, background_color=(0.4,1,0.5,0.8))
    c.show_hydrogens_on_hetero = True
    c.font_size = 20
    mols = list( mol.get_disconnected_subgraphs())
    c.mols_to_cairo( mols, "test.pdf", format="pdf")
    c.mols_to_cairo( mols, "test.png")
    c.mols_to_cairo( mols, "test.svg", format="svg")
Beispiel #5
0
def cairo_out_test_wedge():
    import molfile
    import time
    f = file("untitled0.mol", "r")
    mol = molfile.file_to_mol(f)
    f.close()
    import cairo_out
    mol.normalize_bond_length(30)
    mol.remove_unimportant_hydrogens()
    c = cairo_out.cairo_out(scaling=1.0,
                            antialias_text=True,
                            color_bonds=True,
                            color_atoms=True)
    t = time.time()
    c.mol_to_cairo(mol, "untitled0.png")
    print time.time() - t
Beispiel #6
0
def cairo_out_test2():
    import smiles
    #mol = smiles.text_to_mol( "COC(=O)CNC(C1=CC=CC=C1)C2=C(C=CC(=C2)Br)NC(=O)C3=CC(=CC=C3)Cl")
    #mol = smiles.text_to_mol( "c1nccc2c1cncn2")
    mol = smiles.text_to_mol("CCC=CC(=O)C.CCCC")
    import cairo_out
    mol.normalize_bond_length(30)
    mol.remove_unimportant_hydrogens()
    c = cairo_out.cairo_out(
        color_bonds=True,
        color_atoms=True)  #, background_color=(0.4,1,0.5,0.8))
    c.show_hydrogens_on_hetero = True
    c.font_size = 20
    mols = list(mol.get_disconnected_subgraphs())
    c.mols_to_cairo(mols, "test.pdf", format="pdf")
    c.mols_to_cairo(mols, "test.png")
    c.mols_to_cairo(mols, "test.svg", format="svg")
Beispiel #7
0
def cairo_out_test3d():
    import molfile
    f = file("1.mol", "r")
    mol = molfile.file_to_mol(f)
    f.close()
    import cairo_out
    #mol.normalize_bond_length( 25)
    #mol.remove_unimportant_hydrogens()
    c = cairo_out.cairo_out(scaling=1.0,
                            margin=30,
                            font_size=16,
                            bond_second_line_shortening=0.15,
                            bond_width=6,
                            line_width=2.0,
                            antialias_drawing=True,
                            antialias_text=True)
    c.show_hydrogens_on_hetero = True
    c.mol_to_cairo(mol, "1.png")
Beispiel #8
0
def cairo_out_test():
    import molfile
    import time
    cid = 22646404
    #cid = 1373132
    #cid = 18305969
    #cid = 19815256
    f = file( "%d.mol" % cid, "r")
    mol = molfile.file_to_mol( f)
    f.close()
    import cairo_out
    mol.normalize_bond_length( 25)
    mol.remove_unimportant_hydrogens()
    c = cairo_out.cairo_out( scaling=4.0, margin=10, font_size=16,
                             bond_second_line_shortening=0.15, bond_width=6,
                             line_width=2.0, antialias_drawing=True,
                             antialias_text=True)
    #c.background_color = (1,1,0.6)
    c.show_hydrogens_on_hetero = True
    t = time.time()
    c.mol_to_cairo( mol, "%d.png" % cid)
    c.mol_to_cairo( mol, "%d.pdf" % cid, format="pdf")
    c.mol_to_cairo( mol, "%d.svg" % cid, format="svg")
    print time.time()-t