Exemple #1
0
def main():
    parser = argparse.ArgumentParser(
        description=
        'Process parameters for collecting findings from primitive adapter')
    parser.add_argument('-username', required=True, help='username')
    parser.add_argument('-password', required=True, help='password')
    args = parser.parse_args()

    api = KnowledgeHubAPI(server='TEST',
                          client_secret='39c644b3-1f23-4d94-a71f-e0fb43ebd760')
    api.login(args.username, args.password)

    compoundSmile = api.ChemistryService().getSMILESByName('omeprazole')
    similar_compounds = api.SimilarityService().get(compoundSmile[0])

    names = []
    smiles = []
    similarities = []

    if similar_compounds is not None:
        for similar_compound in similar_compounds:
            names.append(similar_compound['name'])
            smiles.append(similar_compound['smiles'])
            similarities.append(similar_compound['distance'])

    studies = filterStudies(api.eToxSys().getStudiesByCompoundNames(names))
    print(f'Found {len(studies)} studies.')
    for study in studies:
        print(study)

    api.SemanticService().getSocs(studies)
    otherStudies = [
        study for study in studies if study['FINDING']['__soc'] == 'Other'
    ]
    print(f'#others:{len(otherStudies)}')
Exemple #2
0
def main():
    parser = argparse.ArgumentParser(description='test similarity service')
    parser.add_argument('-username', required=True, help='username')
    parser.add_argument('-password', required=True, help='password')
    args = parser.parse_args()

    api = KnowledgeHubAPI()
    api.set_server('DEV')
    api = KnowledgeHubAPI(server='TEST', client_secret='39c644b3-1f23-4d94-a71f-e0fb43ebd760')
    api.login('*****@*****.**', 'Crosby99!')
    status = api.SimilarityService().spaces()
    print(f'status={status}')
    omeprazole = 'COc1ccc2[nH]c([S+]([O-])Cc3ncc(C)c(OC)c3C)nc2c1'
    # omeprazole = 'CCC1=C(C)CN(C(=O)NCCC2=CC=C(C=C2)S(=O)(=O)NC(=O)NC2CCC(C)CC2)C1-Cl'
    similar_compounds = api.SimilarityService().get(omeprazole)

    pprint.pprint(similar_compounds)
from knowledgehub.api import KnowledgeHubAPI

api = KnowledgeHubAPI(server='DEV',
                      client_secret='3db5a6d7-4694-48a4-8a2e-e9c30d78f9ab')
api.login('tester', 'tester')
compoundSmile = api.ChemicalService().getSMILESByName('omeprazole')
print(f'Found SMILES {compoundSmile[0]} for {"omeprazole"}')
similar_compounds = api.SimilarityService().get(compoundSmile)
print(f'similar compounds:{similar_compounds}')