Molinfo


NameMolinfo JSON
Version 1.5.3 PyPI version JSON
download
home_pageNone
SummaryMolinfo provides comprehensive molecular information and analysis.
upload_time2024-08-25 20:45:39
maintainerNone
docs_urlNone
authorSina Gilassi
requires_python>=3.6
licenseMIT
keywords python chemistry chemistry-visualization molinfo molecular-graph
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Molinfo



![Downloads](https://img.shields.io/pypi/dm/Molinfo) ![PyPI](https://img.shields.io/pypi/v/Molinfo) ![Python Version](https://img.shields.io/pypi/pyversions/Molinfo.svg) ![License](https://img.shields.io/pypi/l/Molinfo)



**MolInfo** is a Python package designed for advanced molecular analysis by converting molecular structures into graph representations. This package enables researchers and chemists to load various molecular file formats, transform them into graphs, and extract valuable information through graph-based methods.



**Features**



* `File Format Support`: Load molecular data from multiple file formats, including SDF and JSON (soon).

* `Graph Conversion`: Transform molecular structures into graph representations for detailed analysis.

* `Functional Group Identification`: Detect and analyze functional groups within the molecular graph.

* `Distance Measurement`: Compute distances between atoms and bonds in the molecular graph.

* `Bond Angle Calculation`: Measure angles between bonds using graph-based methods.



**Getting Started:**



To use Molinfo, simply install the package and import it into your Python script. Refer to the example code snippets above for a quick start.





## Google Colab



You can use the following code to run `Molinfo` in Google Colab:



[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1rQXg92p_jxviVfKJFf_-1qQwmOgrMLUD?usp=sharing)



## Installation



Install molinfo with pip



```python

  pip install molinfo

```



## Documentation



Import package as:



```python

import molinfo as mi

# check version

print(mi.__version__)

```



## Examples



* Create a graph



```python

# sdf file

sdf_file_name_1 = 'test\Structure2D_COMPOUND_CID_261.sdf'

sdf_file = os.path.join(os.getcwd(), sdf_file_name_1)

# create graph

res = mi.create_graph(sdf_file)

print(type(res))

print(res)

```



* Display a graph:



```python

# visualize compound by sdf file

mi.g3d(sdf_file)

```



* Check the availability of functional groups:



```python

# check functional groups

res, comp1 = mi.check_functional_group(sdf_file, res_format='dataframe')

print(res)

```



* Calculate angle/distance between atoms



```python

# distance matrix

res_distance = comp1.distance_matrix(dataframe=True)

print(res_distance)



# distance between two atoms

distance = comp1.distance_atoms(['O1', 'C2'])

print(distance)



# angle between atoms

angle = comp1.angle_atoms(['O1', 'C2', 'H3'])

print(angle)



# dihedral angle

dihedral = comp1.d_angle_atoms(['H6', 'O1', 'C2', 'H3'])

print(dihedral)

```



* Create custom functional groups:



[`atom1-element`][`atom1-number`][`bond-type`][`atom2-element`][`atom2-number`]



|  Bond Types | Format  | 

|:----------|:----------|

| single bond CC   | C1-C2   | 

| double bond CC   | C1=C2   | 

| triple bond CC   | C1#C2   | 



**How to create a custom functional group?**



|  Name |  Symbol | Format |

|:-----------|:------------:|-------------:|

|  cyanide-1     |     CCN   | ["N1#C2"]      |

| custom_fg      | NCH       | ["N1-C2", "C2-H3"]       |

| NC=O | NC=O | ["N1-C2", "C2=O3"] |



And coded as:



```python

# C1-C2#N3

custom_functional_group = [

    {'cyanide': ["C1-C2", "C2#N3"]},

]



# define different custom functional groups as:

# N#C

# NCH

# NCO

custom_functional_group = [

    {'N#C': ["N1#C2"]},

    {'custom_fg': ["N1-C2", "C2-H3"]},

    {'NC=O': ["N1-C2", "C2=O3"]},

]



# create custom graph

custom_g = mi.create_custom_functional_groups(custom_functional_group)



# visualize custom graph

# custom_g.d("cyanide")



# find custom functional groups in a compound

res = mi.check_functional_group(

    sdf_file, functional_groups=[custom_g])

print(res)

```



## FAQ



For any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/) 





## Authors



- [@sinagilassi](https://www.github.com/sinagilassi)


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "Molinfo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "python, chemistry, chemistry-visualization, Molinfo, molecular-graph",
    "author": "Sina Gilassi",
    "author_email": "<sina.gilassi@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e9/41/065bb095f449d0e4d90be8c1ec1d0ba20a470d6829dc2c49e8dadfcbc42e/molinfo-1.5.3.tar.gz",
    "platform": null,
    "description": "\r\n# Molinfo\r\n\r\n\r\n\r\n![Downloads](https://img.shields.io/pypi/dm/Molinfo) ![PyPI](https://img.shields.io/pypi/v/Molinfo) ![Python Version](https://img.shields.io/pypi/pyversions/Molinfo.svg) ![License](https://img.shields.io/pypi/l/Molinfo)\r\n\r\n\r\n\r\n**MolInfo** is a Python package designed for advanced molecular analysis by converting molecular structures into graph representations. This package enables researchers and chemists to load various molecular file formats, transform them into graphs, and extract valuable information through graph-based methods.\r\n\r\n\r\n\r\n**Features**\r\n\r\n\r\n\r\n* `File Format Support`: Load molecular data from multiple file formats, including SDF and JSON (soon).\r\n\r\n* `Graph Conversion`: Transform molecular structures into graph representations for detailed analysis.\r\n\r\n* `Functional Group Identification`: Detect and analyze functional groups within the molecular graph.\r\n\r\n* `Distance Measurement`: Compute distances between atoms and bonds in the molecular graph.\r\n\r\n* `Bond Angle Calculation`: Measure angles between bonds using graph-based methods.\r\n\r\n\r\n\r\n**Getting Started:**\r\n\r\n\r\n\r\nTo use Molinfo, simply install the package and import it into your Python script. Refer to the example code snippets above for a quick start.\r\n\r\n\r\n\r\n\r\n\r\n## Google Colab\r\n\r\n\r\n\r\nYou can use the following code to run `Molinfo` in Google Colab:\r\n\r\n\r\n\r\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1rQXg92p_jxviVfKJFf_-1qQwmOgrMLUD?usp=sharing)\r\n\r\n\r\n\r\n## Installation\r\n\r\n\r\n\r\nInstall molinfo with pip\r\n\r\n\r\n\r\n```python\r\n\r\n  pip install molinfo\r\n\r\n```\r\n\r\n\r\n\r\n## Documentation\r\n\r\n\r\n\r\nImport package as:\r\n\r\n\r\n\r\n```python\r\n\r\nimport molinfo as mi\r\n\r\n# check version\r\n\r\nprint(mi.__version__)\r\n\r\n```\r\n\r\n\r\n\r\n## Examples\r\n\r\n\r\n\r\n* Create a graph\r\n\r\n\r\n\r\n```python\r\n\r\n# sdf file\r\n\r\nsdf_file_name_1 = 'test\\Structure2D_COMPOUND_CID_261.sdf'\r\n\r\nsdf_file = os.path.join(os.getcwd(), sdf_file_name_1)\r\n\r\n# create graph\r\n\r\nres = mi.create_graph(sdf_file)\r\n\r\nprint(type(res))\r\n\r\nprint(res)\r\n\r\n```\r\n\r\n\r\n\r\n* Display a graph:\r\n\r\n\r\n\r\n```python\r\n\r\n# visualize compound by sdf file\r\n\r\nmi.g3d(sdf_file)\r\n\r\n```\r\n\r\n\r\n\r\n* Check the availability of functional groups:\r\n\r\n\r\n\r\n```python\r\n\r\n# check functional groups\r\n\r\nres, comp1 = mi.check_functional_group(sdf_file, res_format='dataframe')\r\n\r\nprint(res)\r\n\r\n```\r\n\r\n\r\n\r\n* Calculate angle/distance between atoms\r\n\r\n\r\n\r\n```python\r\n\r\n# distance matrix\r\n\r\nres_distance = comp1.distance_matrix(dataframe=True)\r\n\r\nprint(res_distance)\r\n\r\n\r\n\r\n# distance between two atoms\r\n\r\ndistance = comp1.distance_atoms(['O1', 'C2'])\r\n\r\nprint(distance)\r\n\r\n\r\n\r\n# angle between atoms\r\n\r\nangle = comp1.angle_atoms(['O1', 'C2', 'H3'])\r\n\r\nprint(angle)\r\n\r\n\r\n\r\n# dihedral angle\r\n\r\ndihedral = comp1.d_angle_atoms(['H6', 'O1', 'C2', 'H3'])\r\n\r\nprint(dihedral)\r\n\r\n```\r\n\r\n\r\n\r\n* Create custom functional groups:\r\n\r\n\r\n\r\n[`atom1-element`][`atom1-number`][`bond-type`][`atom2-element`][`atom2-number`]\r\n\r\n\r\n\r\n|  Bond Types | Format  | \r\n\r\n|:----------|:----------|\r\n\r\n| single bond CC   | C1-C2   | \r\n\r\n| double bond CC   | C1=C2   | \r\n\r\n| triple bond CC   | C1#C2   | \r\n\r\n\r\n\r\n**How to create a custom functional group?**\r\n\r\n\r\n\r\n|  Name |  Symbol | Format |\r\n\r\n|:-----------|:------------:|-------------:|\r\n\r\n|  cyanide-1     |     CCN   | [\"N1#C2\"]      |\r\n\r\n| custom_fg      | NCH       | [\"N1-C2\", \"C2-H3\"]       |\r\n\r\n| NC=O | NC=O | [\"N1-C2\", \"C2=O3\"] |\r\n\r\n\r\n\r\nAnd coded as:\r\n\r\n\r\n\r\n```python\r\n\r\n# C1-C2#N3\r\n\r\ncustom_functional_group = [\r\n\r\n    {'cyanide': [\"C1-C2\", \"C2#N3\"]},\r\n\r\n]\r\n\r\n\r\n\r\n# define different custom functional groups as:\r\n\r\n# N#C\r\n\r\n# NCH\r\n\r\n# NCO\r\n\r\ncustom_functional_group = [\r\n\r\n    {'N#C': [\"N1#C2\"]},\r\n\r\n    {'custom_fg': [\"N1-C2\", \"C2-H3\"]},\r\n\r\n    {'NC=O': [\"N1-C2\", \"C2=O3\"]},\r\n\r\n]\r\n\r\n\r\n\r\n# create custom graph\r\n\r\ncustom_g = mi.create_custom_functional_groups(custom_functional_group)\r\n\r\n\r\n\r\n# visualize custom graph\r\n\r\n# custom_g.d(\"cyanide\")\r\n\r\n\r\n\r\n# find custom functional groups in a compound\r\n\r\nres = mi.check_functional_group(\r\n\r\n    sdf_file, functional_groups=[custom_g])\r\n\r\nprint(res)\r\n\r\n```\r\n\r\n\r\n\r\n## FAQ\r\n\r\n\r\n\r\nFor any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/) \r\n\r\n\r\n\r\n\r\n\r\n## Authors\r\n\r\n\r\n\r\n- [@sinagilassi](https://www.github.com/sinagilassi)\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Molinfo provides comprehensive molecular information and analysis.",
    "version": "1.5.3",
    "project_urls": null,
    "split_keywords": [
        "python",
        " chemistry",
        " chemistry-visualization",
        " molinfo",
        " molecular-graph"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "64ae34fa30a5d03766d12aa1f795e9a69ab9d01d73e83d1827a7d987d32e0b05",
                "md5": "ccf3ffebb15e2bc264b92b40022e2772",
                "sha256": "4a9ddcfd6a2395892605d965b822cbd9c88267f19736d2ead8e179ceef919624"
            },
            "downloads": -1,
            "filename": "Molinfo-1.5.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ccf3ffebb15e2bc264b92b40022e2772",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 40358,
            "upload_time": "2024-08-25T20:45:36",
            "upload_time_iso_8601": "2024-08-25T20:45:36.920783Z",
            "url": "https://files.pythonhosted.org/packages/64/ae/34fa30a5d03766d12aa1f795e9a69ab9d01d73e83d1827a7d987d32e0b05/Molinfo-1.5.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e941065bb095f449d0e4d90be8c1ec1d0ba20a470d6829dc2c49e8dadfcbc42e",
                "md5": "c38098ccdd03747f311d127271b24e23",
                "sha256": "0b0ed71b75303b4b1ec3bf7734f3bee82a6e887a2f9e579fb05ca8138af36e19"
            },
            "downloads": -1,
            "filename": "molinfo-1.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c38098ccdd03747f311d127271b24e23",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 38063,
            "upload_time": "2024-08-25T20:45:39",
            "upload_time_iso_8601": "2024-08-25T20:45:39.009046Z",
            "url": "https://files.pythonhosted.org/packages/e9/41/065bb095f449d0e4d90be8c1ec1d0ba20a470d6829dc2c49e8dadfcbc42e/molinfo-1.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-25 20:45:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "molinfo"
}
        
Elapsed time: 3.09694s