Skip to content

Commit

Permalink
change subpackage to submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
philopon committed Jan 15, 2016
1 parent 33e6325 commit 9206f65
Show file tree
Hide file tree
Showing 98 changed files with 124 additions and 241 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ __pycache__
/.id_rsa
/.id_rsa.pub
/docs/_build
/docs/api
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ clean:

.PHONY: apidoc
apidoc:
$(SPHINXAPIDOC) -o api ../mordred
$(SPHINXAPIDOC) -o api --separate ../mordred
sed -i.bak -e 's/:undoc-members:/:imported-members:/g' api/*
rm api/*.bak

Expand Down
1 change: 1 addition & 0 deletions mordred/AcidBase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._acid_base import AcidicGroupCount, BasicGroupCount
1 change: 0 additions & 1 deletion mordred/AcidBase/__init__.py

This file was deleted.

3 changes: 3 additions & 0 deletions mordred/Atom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from ._atom_count import AtomCount
from ._aromatic import AromaticAtomsCount
from ._carbon_types import CarbonTypes, HybridizationRatio
1 change: 0 additions & 1 deletion mordred/Atom/__init__.py

This file was deleted.

12 changes: 0 additions & 12 deletions mordred/Atom/_descriptor.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/Autocorrelation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._autocorrelation import ATS, AATS, ATSC, AATSC, MATS, GATS
1 change: 0 additions & 1 deletion mordred/Autocorrelation/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/BCUT.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._bcut import BCUT
1 change: 0 additions & 1 deletion mordred/BCUT/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/BaryszMatrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._barysz_matrix import BaryszMatrix
1 change: 0 additions & 1 deletion mordred/BaryszMatrix/__init__.py

This file was deleted.

4 changes: 4 additions & 0 deletions mordred/Bond.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from ._bond_types import BondCount
from ._aromatic import AromaticBondsCount
from ._hbond import HBondAcceptor, HBondDonor
from ._rotatable_bond import RotatableBondsCount, RotatableBondsRatio
1 change: 0 additions & 1 deletion mordred/Bond/__init__.py

This file was deleted.

13 changes: 0 additions & 13 deletions mordred/Bond/_descriptor.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/Chi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._chi import Chi
1 change: 0 additions & 1 deletion mordred/Chi/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/Constitutional.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._constitutional import Sum, Mean
1 change: 0 additions & 1 deletion mordred/Constitutional/__init__.py

This file was deleted.

2 changes: 2 additions & 0 deletions mordred/DetourMatrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from ._detour_matrix import DetourMatrix
from ._detour_index import DetourIndex
1 change: 0 additions & 1 deletion mordred/DetourMatrix/__init__.py

This file was deleted.

10 changes: 0 additions & 10 deletions mordred/DetourMatrix/_descriptor.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/DistanceMatrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._distance_matrix import DistanceMatrix
1 change: 0 additions & 1 deletion mordred/DistanceMatrix/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/EState.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._e_state import AtomTypeEState
1 change: 0 additions & 1 deletion mordred/EState/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/EccentricConnectivityIndex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._eccentric_connectivity_index import EccentricConnectivityIndex
1 change: 0 additions & 1 deletion mordred/EccentricConnectivityIndex/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/FragmentComplexity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._fragment_complexity import FragmentComplexity
1 change: 0 additions & 1 deletion mordred/FragmentComplexity/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/Framework.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._framework import Framework
1 change: 0 additions & 1 deletion mordred/Framework/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/InformationContent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._information_content import InformationContent
1 change: 0 additions & 1 deletion mordred/InformationContent/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/KappaShapeIndex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._kappa_shape_index import KappaShapeIndex
1 change: 0 additions & 1 deletion mordred/KappaShapeIndex/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/Lipinski.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._lipinski import LipinskiLike
1 change: 0 additions & 1 deletion mordred/Lipinski/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/MolecularDistanceEdge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._molecular_distance_edge import MolecularDistanceEdge
1 change: 0 additions & 1 deletion mordred/MolecularDistanceEdge/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/Polarizability.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._polarizability import APol, BPol
1 change: 0 additions & 1 deletion mordred/Polarizability/__init__.py

This file was deleted.

9 changes: 0 additions & 9 deletions mordred/Property/_descriptor.py → mordred/Property.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,3 @@
from ._mc_gowan_volume import McGowanVolume
from ._vdw_volume_abc import VdwVolumeABC
from ._wildman_crippen_logp import WildmanCrippenLogP

_descriptors = [
Weight,
McGowanVolume,
VdwVolumeABC,
WildmanCrippenLogP,
]

__all__ = [d.__name__ for d in _descriptors]
1 change: 0 additions & 1 deletion mordred/Property/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/RingCount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._ring_count import RingCount
1 change: 0 additions & 1 deletion mordred/RingCount/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/TPSA.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._tpsa import TPSA
1 change: 0 additions & 1 deletion mordred/TPSA/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/TopologicalCharge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._topological_charge import TopologicalCharge
1 change: 0 additions & 1 deletion mordred/TopologicalCharge/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/TopologicalIndex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._topological_index import Diameter, Radius, TopologicalShapeIndex, PetitjeanIndex
1 change: 0 additions & 1 deletion mordred/TopologicalIndex/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/WalkCount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._walk_count import WalkCount
1 change: 0 additions & 1 deletion mordred/WalkCount/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/WienerIndex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._wiener_index import WienerIndex
1 change: 0 additions & 1 deletion mordred/WienerIndex/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions mordred/ZagrebIndex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._zagreb_index import ZagrebIndex
1 change: 0 additions & 1 deletion mordred/ZagrebIndex/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion mordred/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from ._base import Descriptor, Calculator
from ._base import Descriptor, Calculator, all_descriptors
6 changes: 1 addition & 5 deletions mordred/AcidBase/_descriptor.py → mordred/_acid_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .._base import Descriptor
from ._base import Descriptor
from rdkit import Chem


Expand Down Expand Up @@ -49,7 +49,3 @@ class BasicGroupCount(SmartsCount):
"[$(N=C-N)]",
"[$(N-C=N)]",
]


_descriptors = [AcidicGroupCount, BasicGroupCount]
__all__ = [d.__name__ for d in _descriptors]
File renamed without changes.
2 changes: 1 addition & 1 deletion mordred/Atom/_atom_count.py → mordred/_atom_count.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .._base import Descriptor
from ._base import Descriptor


class AtomCount(Descriptor):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .._base import Descriptor
from .. import _atomic_property
from ._base import Descriptor
from . import _atomic_property
import numpy as np
from .._common import DistanceMatrix
from ._common import DistanceMatrix


class AutocorrelationBase(Descriptor):
Expand Down Expand Up @@ -318,6 +318,3 @@ def calculate(self, mol, avec, gmat, gsum, cavec):
n = (gmat * (W - W.T) ** 2).sum() / (4 * (gsum or np.nan))
d = (cavec ** 2).sum() / (len(avec) - 1)
return n / d

_descriptors = [ATS, AATS, ATSC, AATSC, MATS, GATS]
__all__ = [d.__name__ for d in _descriptors]
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from .._base import Descriptor
from .. import _atomic_property
from ._base import Descriptor
from . import _atomic_property
from rdkit import Chem
from scipy.sparse.csgraph import shortest_path
import numpy as np
from .._matrix_attributes import methods, get_method
from ._matrix_attributes import methods, get_method


class BaryszMatrixDescriptor(Descriptor):
Expand Down Expand Up @@ -85,7 +85,3 @@ def __init__(self, prop='Z', method='SpMax'):

def calculate(self, mol, result):
return result


_descriptors = [BaryszMatrix]
__all__ = [d.__name__ for d in _descriptors]
21 changes: 21 additions & 0 deletions mordred/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
from six import with_metaclass
from abc import ABCMeta, abstractmethod
from types import ModuleType
import os
from importlib import import_module

from inspect import getsourcelines

try:
from inspect import getfullargspec as getargspec
except ImportError:
Expand Down Expand Up @@ -274,3 +277,21 @@ def __call__(self, mol):
(desc.descriptor_name, self._calculate(desc, cache))
for desc in self.descriptors
)


def all_descriptors():
r'''
yield all descriptors
Returns:
iterator<module>: all modules
'''

base_dir = os.path.dirname(__file__)

for name in os.listdir(base_dir):
name, ext = os.path.splitext(name)
if name[:1] == '_' or ext != '.py':
continue

yield import_module('..' + name, __name__)
8 changes: 2 additions & 6 deletions mordred/BCUT/_descriptor.py → mordred/_bcut.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .._base import Descriptor
from .. import _atomic_property
from ._base import Descriptor
from . import _atomic_property
import numpy as np


Expand Down Expand Up @@ -102,7 +102,3 @@ def calculate(self, mol, bev):
return np.sort(bev)[nth]
else:
return np.nan


_descriptors = [BCUT]
__all__ = [d.__name__ for d in _descriptors]
2 changes: 1 addition & 1 deletion mordred/Bond/_bond_types.py → mordred/_bond_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .._base import Descriptor
from ._base import Descriptor
from rdkit.Chem import BondType


Expand Down
2 changes: 1 addition & 1 deletion mordred/Atom/_carbon_types.py → mordred/_carbon_types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import defaultdict
from .._base import Descriptor
from ._base import Descriptor


class CarbonTypesBase(Descriptor):
Expand Down
8 changes: 2 additions & 6 deletions mordred/Chi/_descriptor.py → mordred/_chi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .._base import Descriptor
from .. import _atomic_property
from ._base import Descriptor
from . import _atomic_property
from rdkit import Chem
from networkx import Graph
from collections import namedtuple
Expand Down Expand Up @@ -186,7 +186,3 @@ def calculate(self, mol, chi=None):
x /= len(node_sets) or np.nan

return x


_descriptors = [Chi]
__all__ = [d.__name__ for d in _descriptors]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .._base import Descriptor
from .. import _atomic_property
from ._base import Descriptor
from . import _atomic_property
from rdkit import Chem


Expand Down Expand Up @@ -72,7 +72,3 @@ def dependencies(self):

def calculate(self, mol, S):
return S / mol.GetNumAtoms()


_descriptors = [Sum, Mean]
__all__ = [d.__name__ for d in _descriptors]
4 changes: 2 additions & 2 deletions mordred/DetourMatrix/_index.py → mordred/_detour_index.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .._base import Descriptor
from ._matrix import detour_matrix
from ._base import Descriptor
from ._detour_matrix import detour_matrix


class DetourIndex(Descriptor):
Expand Down
4 changes: 2 additions & 2 deletions mordred/DetourMatrix/_matrix.py → mordred/_detour_matrix.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import networkx
import numpy as np
from .._base import Descriptor
from .. import _matrix_attributes as ma
from ._base import Descriptor
from . import _matrix_attributes as ma


class LongestSimplePath(object):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .._base import Descriptor
from .._common import DistanceMatrix as D
from .._matrix_attributes import methods, get_method
from ._base import Descriptor
from ._common import DistanceMatrix as D
from ._matrix_attributes import methods, get_method


class DistanceMatrix(Descriptor):
Expand Down Expand Up @@ -48,7 +48,3 @@ def __init__(self, method='SpMax'):

def calculate(self, mol, result):
return result


_descriptors = [DistanceMatrix]
__all__ = [d.__name__ for d in _descriptors]
5 changes: 1 addition & 4 deletions mordred/EState/_descriptor.py → mordred/_e_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .._base import Descriptor
from ._base import Descriptor
from rdkit.Chem import EState as ES
from numpy import nan
from functools import reduce
Expand Down Expand Up @@ -100,6 +100,3 @@ def calculate(self, mol, E):
return float(getattr(builtins, self.aggregate)(indices))
except ValueError: # min, max to empty list
return nan

_descriptors = [AtomTypeEState]
__all__ = [d.__name__ for d in _descriptors]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .._base import Descriptor
from .._common import Eccentricity, Valence
from ._base import Descriptor
from ._common import Eccentricity, Valence


class EccentricConnectivityIndex(Descriptor):
Expand Down Expand Up @@ -36,7 +36,3 @@ def dependencies(self):

def calculate(self, mol, E, V):
return (E.astype('int') * V).sum()


_descriptors = [EccentricConnectivityIndex]
__all__ = [d.__name__ for d in _descriptors]

0 comments on commit 9206f65

Please sign in to comment.