Exemplo n.º 1
0
parser.add_argument("--verbose",  action="store_true",
                    help="Verbose logging")

opts = parser.parse_args()

store = DescriptaStore(opts.storage)
if opts.seperator == ",":
    writer = csv.writer(sys.stdout)
elif opts.seperator == "\t":
    writer = csv.writer(sys.stdout, dialiect=csv.excel_tab)

if opts.keep_missing_descriptors:
    opts.keep_calculatedflags = True

if opts.output_name:
    writer.writerow(['Name'] + store.getDescriptorNames(opts.keep_calculatedflags))
else:        
    writer.writerow(store.getDescriptorNames(opts.keep_calculatedflags))

if not opts.namefile:
    indices = range(len(store))
else:
    def idx_getter(namefile):
        for line in open(namefile):
            try:
                idx = store.lookupName(line.strip())
                yield idx
            except:
                logging.warning("Name %r not found in store", line.strip())
                continue
    indices = idx_getter(opts.namefile)
import sys
from rdkit import rdBase
rdBase.DisableLog("rdApp.*")


parser = argparse.ArgumentParser()
parser.add_argument("storage",
                    help="directory in which to store the descriptors")
parser.add_argument("storage2",
                    help="directory in which to store the descriptors")

opts = parser.parse_args()
store1 = DescriptaStore(opts.storage)
store2 = DescriptaStore(opts.storage2)

if store1.getDescriptorNames() != store2.getDescriptorNames():
    logging.warning("Storages are not compatible, columns are different")
    s1 = set(store1.getDescriptorNames())
    s2 = set(store2.getDescriptorNames())
    
    if s1 == s2:
        logging.warning("Columns are the same but reordered")
    else:
        logging.warning("Extra columns in store1:\n\t%s", "\n\t".join(s1-s2))
        logging.warning("Extra columns in store2:\n\t%s", "\n\t".join(s2-s1))
        
    for i,(a,b) in enumerate(zip(store1.getDescriptorNames(),
                                 store2.getDescriptorNames())):
        if a != b:
            logging.warning("First differing element at index %s (%s != %s)", i,a,b)
            break