InformaticsMatters / fragnet

Fragment network tooling
Apache License 2.0
1 stars 0 forks source link

Allow to fetch synthons for a molecule #44

Closed tdudgeon closed 3 years ago

tdudgeon commented 3 years ago

As part of the work for Ox Uni (Ruben Sanchez Garcia) we need to allow to fetch "synthons" for a molecule. That is fragments of a molecule, similar to Python code like this:

        labels = set()
    for record in tx.run('MATCH (fa:F2 {smiles: $smiles})-[e:FRAG*]->(f:F2) RETURN e',
                            smiles=smiles):
        edges = record['e']
        for edge in edges:
            s = edge['label']
            tokens = s.split('|')
            add_required_synthons(labels, tokens[1])
            add_required_synthons(labels, tokens[4])
    return list(labels)

Possibly the neighbourhood search could be adapted for this, but as only child fragments and only available molecules are needed a new endpoint might be better.

tdudgeon commented 3 years ago

Implemented as the rest/v2/search/fragments endpoint. The results are a simple JSON list of child fragments. Not sure if anything more sophisticated is needed.