flatkinson / standardiser Goto Github PK
View Code? Open in Web Editor NEWMolecular standardisation tool
Molecular standardisation tool
Hi there,
I'm trying to go through the tutorial but have some exceptions.
In the tutorial, it says from "standardise import standardise". Should this be "from standardizer import standardise"?
It returns an error saying that " module 'standardiser.standardise' has no attribute 'apply'"
How can I resolve this problem?
Thanks in advanced,
Melvin
$ 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())
Hello,
Any chance of a new PyPI / Github release so there is a python3-compatible version available?
Thanks,
Simon
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.
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]
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
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!
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!
maybe you want it too.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.