import os.path

xml_dir = '../xml/'

if not os.path.exists(xml_dir):
    os.makedirs(xml_dir)

# width fot text wrap
HTML_WRAP_WIDTH = 79

courseName = "$course$/Default for Chemistry/Reactant/"
path = "http://opsin.ch.cam.ac.uk/opsin/"

question_count = 1
products_all = func.get_molecules()

# Open a file to write
f = open(xml_dir + "miss_react_jme.xml", "w")

print "Name of the file: ", f.name

f.write('<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n')
f.write('<quiz>\n')
f.close()

for products in products_all:
    reagents_all = func.get_reagents_react(products[4])  # products - fgroup
    for reagents in reagents_all:
        react_group = reagents[1]  # reagents - reactant
        react_base = products[1]  # products - base
Exemple #2
0
# Create by Hanlin Hu
# On Nov 06 2016
# Copyright: All rights reserved

#!/usr/bin/env python2.7
import sys
sys.path.append('../')

import lib.functions as func

cursor = func.get_molecules()
for row in cursor:
    print(row)
Exemple #3
0
#!/usr/bin/env python2.7
import sys

sys.path.append('../')

import lib.functions as func
import lib.cirpy as cir  # ref: http://cirpy.readthedocs.io/en/latest/

import os.path

smi_dir = '../smi/'

if not os.path.exists(smi_dir):
    os.makedirs(smi_dir)

extension_name = '.smi'

molecules_all = func.get_molecules()
for molecules in molecules_all:
    molecules_name = molecules[0]  # molecules name
    molecules_smi = cir.resolve(str(molecules_name), 'smiles')

    file_name = molecules_name
    f = open(str(smi_dir) + str(file_name) + str(extension_name),
             'w+')  # w+ : write (overwrite exists)
    f.write(str(molecules_smi))
    f.close()

print "Finish"
Exemple #4
0
import os.path

xml_dir = '../xml/'

if not os.path.exists(xml_dir):
    os.makedirs(xml_dir)

# width fot text wrap
HTML_WRAP_WIDTH = 79

courseName = "$course$/Default for Chemistry/Product/"
path = "http://opsin.ch.cam.ac.uk/opsin/"

question_count = 1
reactants_all = func.get_molecules()

# Open a file to write
f = open(xml_dir + "miss_prod_jme.xml", "w")

print "Name of the file: ", f.name

f.write('<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n')
f.write('<quiz>\n')
f.close()

for reactants in reactants_all:
    reagents_all = func.get_reagents_prod(reactants[4])  # reagents - fgroup
    for reagents in reagents_all:
        prod_group = reagents[2]  # reagents - product
        prod_base = reactants[1]  # reactants - base