Code Monkey home page Code Monkey logo

standardiser's People

Contributors

flatkinson avatar mnowotka avatar unixjunkie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

standardiser's Issues

unable to import make_logger

With the recent changes,

import make_logger
logger = make_logger.run(__name__)

I am now getting

ImportError: No module named make_logger

What is this module? If I revert it back to

import logging
logger = logging.getLogger(__name__)

I no longer get the error.

when called without parameters, do as if --help was on the CLI

Currently, we have an obscure:

Traceback (most recent call last):
  File "/home/berenger/.local/bin/standardiser", line 11, in <module>
    sys.exit(main())
  File "/home/berenger/.local/lib/python3.6/site-packages/standardiser/bin/standardise_mols.py", line 75, in main
    input_type = os.path.splitext(config.infile)[1] # sdf or smi
  File "/usr/lib/python3.6/posixpath.py", line 122, in splitext
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

error with the pip-installed executable

$ pip install standardiser
$ standardiser 
Traceback (most recent call last):
  File "~/.local/bin/standardiser", line 7, in <module>
    from standardiser.bin.standardiser import main
ImportError: No module named standardiser

$ cat ~/.local/bin/standardiser 
#!/usr/bin/python

# -*- coding: utf-8 -*-
import re
import sys

from standardiser.bin.standardiser import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

documentation apply/run

Hello Francis,
I've been using your standardiser and customising it for my use-case with success, many thanks!
In the documentation 'docs' notebooks a few of the examples (in the notebooks for break_bonds, neutralise, standardise and alternative ) use 'apply' instead of 'run', which is what you settled with afterwards it seems and works with the code. Minor thing but just thought to let you know.
Thanks!

a -j max_jobs option would be nice

Hello,
-j max_jobs: maximum number of process to run in parallel
would be amazing when attempting to standardize a large collection of molecules.

Thanks for this amazing piece of work!

Inappropriate Exclusion of Organic Solvents

The standardiser inappropriately removes organic compounds that are sometimes used as organic solvents. For example, the important metabolite glutamate is removed:

from rdkit import Chem
from standardiser import standardise
smiles = 'NC(CCC(=O)O)C(=O)O' # glutamate
mol = Chem.MolFromSmiles(smiles, sanitize=False)
clean_mol = standardise.apply(mol) # throws no_non_salt exception

One approach to resolving this issue would be allow organic solvents if they are the only organic fragment in the molecule. Here is code that does this:

    organic_salt_frags = []

    non_salt_frags = []

    mol = break_bonds.apply(mol)

    for n, frag in enumerate(Chem.GetMolFrags(mol, asMols=True), 1):

        logger.debug("Starting fragment {n} '{smi}'...".format(n=n, smi=Chem.MolToSmiles(frag)))

        logger.debug("1) Check for non-organic elements...")

        if unsalt.is_nonorganic(frag): continue

        logger.debug("2) Attempting to neutralise (first pass)...")

        frag = neutralise.apply(frag)

        logger.debug("3) Applying rules...")

        frag = rules.apply(frag, output_rules_applied=output_rules_applied, verbose=verbose)

        logger.debug("4) Attempting to neutralise (second pass)...")

        frag = neutralise.apply(frag)

        logger.debug("5) Checking if frag is a salt/solvate...")

        if unsalt.is_salt(frag):

            organic_salt_frags.append(frag)

            continue

        logger.debug("...fragment kept.")

        non_salt_frags.append(frag)

    if len(non_salt_frags) == 0:

        logger.debug("No non-salt frags. If there is a single organic salt frag take it.")

        if len(organic_salt_frags) == 1:

            parent = organic_salt_frags[0]

        else:

            raise StandardiseException("no_non_salt")

    elif len(non_salt_frags) > 1:

        raise StandardiseException("multi_component")

    else:

        parent = non_salt_frags[0]

module 'standardiser.standardise' has no attribute 'apply'

Hi there,

I'm trying to go through the tutorial but have some exceptions.

  1. In the tutorial, it says from "standardise import standardise". Should this be "from standardizer import standardise"?

  2. It returns an error saying that " module 'standardiser.standardise' has no attribute 'apply'"

How can I resolve this problem?

Thanks in advanced,

Melvin

New release?

Hello,

Any chance of a new PyPI / Github release so there is a python3-compatible version available?

Thanks,

Simon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.