Exemple #1
0
def main():
    '''
    Commands are in order of dependencies.
    '''
    if len(sys.argv) == 2:
        this_file, command = sys.argv
        if command == 'sentences':
            generate_sentences()  # generates train_sentences.json
            return
        elif command == 'clean_chemicals':
            clean_chemicals()  # generates train_clean_chemicals.json
            return
        elif command == 'match_name':
            match_name()  # generates train_match_name.json
            return
        elif command == 'tag_sentences':
            tag_sentences()  # generates train_tag_sentences.json
            chemtagger.save_map()
            return
        elif command == 'match_inchi':
            match_inchi()  # train_match_inchi.json
            return
        elif command == 'combine':
            combine()  # generates train_match.json
            return
        elif command == 'stats':
            stats()
            return
        elif command == 'abstract_stats':
            abstract_stats()
            return
    print 'Wrong number of arguments. Usage: python rapier.py [sentences, clean_chemicals, match_name, tag_sentences, match_inchi, combine, stats, abstract_stats]'
Exemple #2
0
def main():
    tests = [
        [
            0,
            [(1, ['serine', 'glycine'])],
            '10347152-2',
            'As for flux through serine hydroxymethyltransferase and GCS, the conversion of serine to glycine occurred fairly rapidly, followed by GCS-mediated slow decarboxylation of the accumulated glycine',
        ],
        [
            1,
            [(1, ['3-phosphohydroxypyruvate', 'l-phosphoserine'])],
            '10024454-0',
            'Phosphoserine aminotransferase (PSAT; EC 2.6.1.52), a member of subgroup IV of the aminotransferases, catalyses the conversion of 3-phosphohydroxypyruvate to l-phosphoserine'
        ],
        [
            2,
            [(2, ['methionine', 'methanethiol'])],
            '10482527-7',
            'We therefore propose that in P. putida methionine is converted to methanethiol and then oxidized to methanesulfonate',
        ],
        [
            3,
            [(2, ['ornithine', 'N-alpha-acetylornithine']),
             (5, ['ornithine', 'N-alpha-acetylornithine'])],
            '10692366-1',
            'Only two exceptions had been reported-the Enterobacteriaceae and Myxococcus xanthus (members of the gamma and delta groups of the class Proteobacteria, respectively)-in which ornithine is produced from N-alpha-acetylornithine by a deacylase, acetylornithinase (AOase) (argE encoded)',
        ],
        [
            4,
            [(4, ['l-lysine', 'l-beta-lysine'])],
            '17944492-3',
            'The energetics is here reported for the action of lysine 2,3-aminomutase (LAM), which catalyzes the interconversion of l-lysine and l-beta-lysine',
        ],
        [
            5,
            [(4, ['estrone', 'estradiol'])],
            '8013376-0',
            'Estradiol 17 beta-hydroxysteroid dehydrogenase (17 beta HSD) mediates the interconversion of estrone and estradiol in endocrine-responsive tissues such as the breast',
        ],
        [
            6,
            [(5, ['5-Hydroxymethyltryptophan', '5-hydroxy-4-methyltryptophan', '5-methyltryptophan'])],
            '10587452-4',
            '5-Hydroxymethyltryptophan and 5-hydroxy-4-methyltryptophan are the products from 5-methyltryptophan',
        ],
        [
            7,
            [(6, ['maltose', 'trehalose'])],
            '18505459-2',
            'We show that TreS from Mycobacterium smegmatis, as well as recombinant TreS produced in Escherichia coli, has amylase activity in addition to the maltose <--> trehalose interconverting activity (referred to as MTase)',
        ],
    ]
    for index, output, sid, sent in tests:
        res = extract(sid, sent)
        if res == output:
            print 'Test %s passed.' % index
        else:
            print 'TEST %s FAILED!\nResult: %s\n' % (index, res)
    chemtagger.save_map()
Exemple #3
0
def main():
    '''
    Commands are in order of dependencies.
    '''
    if len(sys.argv) == 2:
        this_file, command = sys.argv
        if command == 'run':
            evaluate()
            chemtagger.save_map()
            return
        elif command == 'stats':
            stats()
            return
    print 'Wrong number of arguments. Usage: python evaluate.py [run, stats]'