benchlingapi


Namebenchlingapi JSON
Version 2.1.12 PyPI version JSON
download
home_pagehttps://www.github.com/klavinslab/benchling-api
SummaryAn unofficial python wrapper for the Benchling API
upload_time2020-02-13 00:27:32
maintainerJustin Vrana
docs_urlNone
authorJustin Vrana
requires_python>=3.5.2,<4.0.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # BenchlingAPI

[![PyPI version](https://badge.fury.io/py/benchlingapi.svg)](https://badge.fury.io/py/benchlingapi)

The (unofficial) python API wrapper for Benchling. For more information,
see documentation at https://klavinslab.github.io/benchling-api/index.

## Installation

```
pip install benchlingapi -U
```

## Getting Started

Initialize a session using your Benchling-provided API key:

```python
from benchlingapi import Session
session = Session("your_secret_benchling_api_key")
```

From there, you can access various models:

```python
session.DNASequence
session.AASequence
session.Oligo
session.Folder
session.Project
session.Registry
session.Translation
session.EntitySchema
session.Batch
session.CustomEntity
```

Finding models:

```python
# get one model
dna = session.DNASequence.one()

# find a specific model by its id
dna = session.DNASequence.find('sdg_4tg23')

# get the last 50 amino acids
proteins = session.AASequence.last(50)

# get a registry by name
registry = session.Registry.find_by_name("Klavins Lab Registry")
```

Updating models:

```python
dna = session.DNASequence.one()
dna.name = "My new name"
dna.bases = "AGGTAGGGTAGGGCCAGAGA"

# update the sequence on the server
dna.update()
```

Saving new models:

```python
folder = session.Folder.find_by_name("My API Folder")
dna = session.DNASequence(
    name = 'my new dna',
    bases = 'AGGTAGGATGGCCA',
    folder_id = folder.id,
    is_circular = False
)

# save the dna to your Benchling account
dna.save()
```

Registering models to your registry:

```python
dna.set_schema("My DNA Schema")
dna.register()
```

See the documentation for more information: https://klavinslab.github.io/benchling-api/index

## Testing

Testing is done using `pytest`. Tests will create live requests to a Benchling account.
Since testing is done live, a Benchling account will need to be setup along with testing
data.

To run tests, you must have a Benchling Account with an API key. Tests require a file in
'tests/secrets/config.json' with the following format:

```
{
  "credentials": {
    "api_key": "asdahhjwrthsdfgadfadfgadadsfa"
  },
  "sharelinks": [
    "https://benchling.com/s/seq-asdfadsfaee"
  ],
  "project": {
    "name": "API"
  },
  "trash_folder": {
    "name": "API_Trash"
  },
  "inventory_folder": {
    "name": "API_Inventory"
  }
}
```

On the Benchling side of things, in the account liked to the `credentials["api_key"]`, you must
have a project corresponding to the `project["name"]` value above. Within this project, you should
have two folder corresponding to the `trash_folder` and `inventory_folder` values above. Additionally,
you should have at least one example of an AminoAcid, DNASequence, CustomEntity, and Oligo stored within
your `inventory_folder`. Tests will copy the examples from the `inventory_folder` for downstream tests.
After the tests, conclude, inventory in the `trash_folder` will get archived.

#### Happy Cloning!

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.github.com/klavinslab/benchling-api",
    "name": "benchlingapi",
    "maintainer": "Justin Vrana",
    "docs_url": null,
    "requires_python": ">=3.5.2,<4.0.0",
    "maintainer_email": "justin.vrana@gmail.com",
    "keywords": "",
    "author": "Justin Vrana",
    "author_email": "justin.vrana@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8d/3e/d438187289d120508725d5769762468d7980030a79b86ad61d278d54b937/benchlingapi-2.1.12.tar.gz",
    "platform": "",
    "description": "# BenchlingAPI\n\n[![PyPI version](https://badge.fury.io/py/benchlingapi.svg)](https://badge.fury.io/py/benchlingapi)\n\nThe (unofficial) python API wrapper for Benchling. For more information,\nsee documentation at https://klavinslab.github.io/benchling-api/index.\n\n## Installation\n\n```\npip install benchlingapi -U\n```\n\n## Getting Started\n\nInitialize a session using your Benchling-provided API key:\n\n```python\nfrom benchlingapi import Session\nsession = Session(\"your_secret_benchling_api_key\")\n```\n\nFrom there, you can access various models:\n\n```python\nsession.DNASequence\nsession.AASequence\nsession.Oligo\nsession.Folder\nsession.Project\nsession.Registry\nsession.Translation\nsession.EntitySchema\nsession.Batch\nsession.CustomEntity\n```\n\nFinding models:\n\n```python\n# get one model\ndna = session.DNASequence.one()\n\n# find a specific model by its id\ndna = session.DNASequence.find('sdg_4tg23')\n\n# get the last 50 amino acids\nproteins = session.AASequence.last(50)\n\n# get a registry by name\nregistry = session.Registry.find_by_name(\"Klavins Lab Registry\")\n```\n\nUpdating models:\n\n```python\ndna = session.DNASequence.one()\ndna.name = \"My new name\"\ndna.bases = \"AGGTAGGGTAGGGCCAGAGA\"\n\n# update the sequence on the server\ndna.update()\n```\n\nSaving new models:\n\n```python\nfolder = session.Folder.find_by_name(\"My API Folder\")\ndna = session.DNASequence(\n    name = 'my new dna',\n    bases = 'AGGTAGGATGGCCA',\n    folder_id = folder.id,\n    is_circular = False\n)\n\n# save the dna to your Benchling account\ndna.save()\n```\n\nRegistering models to your registry:\n\n```python\ndna.set_schema(\"My DNA Schema\")\ndna.register()\n```\n\nSee the documentation for more information: https://klavinslab.github.io/benchling-api/index\n\n## Testing\n\nTesting is done using `pytest`. Tests will create live requests to a Benchling account.\nSince testing is done live, a Benchling account will need to be setup along with testing\ndata.\n\nTo run tests, you must have a Benchling Account with an API key. Tests require a file in\n'tests/secrets/config.json' with the following format:\n\n```\n{\n  \"credentials\": {\n    \"api_key\": \"asdahhjwrthsdfgadfadfgadadsfa\"\n  },\n  \"sharelinks\": [\n    \"https://benchling.com/s/seq-asdfadsfaee\"\n  ],\n  \"project\": {\n    \"name\": \"API\"\n  },\n  \"trash_folder\": {\n    \"name\": \"API_Trash\"\n  },\n  \"inventory_folder\": {\n    \"name\": \"API_Inventory\"\n  }\n}\n```\n\nOn the Benchling side of things, in the account liked to the `credentials[\"api_key\"]`, you must\nhave a project corresponding to the `project[\"name\"]` value above. Within this project, you should\nhave two folder corresponding to the `trash_folder` and `inventory_folder` values above. Additionally,\nyou should have at least one example of an AminoAcid, DNASequence, CustomEntity, and Oligo stored within\nyour `inventory_folder`. Tests will copy the examples from the `inventory_folder` for downstream tests.\nAfter the tests, conclude, inventory in the `trash_folder` will get archived.\n\n#### Happy Cloning!\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An unofficial python wrapper for the Benchling API",
    "version": "2.1.12",
    "project_urls": {
        "Documentation": "http://klavinslab.org/benchling-api/",
        "Homepage": "https://www.github.com/klavinslab/benchling-api",
        "Repository": "https://pypi.org/project/benchlingapi/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2007d2f5d70cc508e31ae7d4244b85274384aa67628984c20073518dd5e2be0",
                "md5": "059954b1936b2cfb145e5c7262df99a6",
                "sha256": "10e5786a2b23fe6557475aac6f42e6f3218654f09e8ca6824820d2cba46019fb"
            },
            "downloads": -1,
            "filename": "benchlingapi-2.1.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "059954b1936b2cfb145e5c7262df99a6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5.2,<4.0.0",
            "size": 23017,
            "upload_time": "2020-02-13T00:27:30",
            "upload_time_iso_8601": "2020-02-13T00:27:30.827580Z",
            "url": "https://files.pythonhosted.org/packages/f2/00/7d2f5d70cc508e31ae7d4244b85274384aa67628984c20073518dd5e2be0/benchlingapi-2.1.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8d3ed438187289d120508725d5769762468d7980030a79b86ad61d278d54b937",
                "md5": "655c2bc95e348fea0c5d0ddec94f4e08",
                "sha256": "8ee7f03919a4ac27441601d35d52fa877db95a00f8b5c788ac37aff187d692a2"
            },
            "downloads": -1,
            "filename": "benchlingapi-2.1.12.tar.gz",
            "has_sig": false,
            "md5_digest": "655c2bc95e348fea0c5d0ddec94f4e08",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5.2,<4.0.0",
            "size": 21544,
            "upload_time": "2020-02-13T00:27:32",
            "upload_time_iso_8601": "2020-02-13T00:27:32.405446Z",
            "url": "https://files.pythonhosted.org/packages/8d/3e/d438187289d120508725d5769762468d7980030a79b86ad61d278d54b937/benchlingapi-2.1.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-02-13 00:27:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "klavinslab",
    "github_project": "benchling-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "benchlingapi"
}
        
Elapsed time: 0.10024s