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:
from benchlingapi import Session
session = Session("your_secret_benchling_api_key")
From there, you can access various models:
session.DNASequence
session.AASequence
session.Oligo
session.Folder
session.Project
session.Registry
session.Translation
session.EntitySchema
session.Batch
session.CustomEntity
Finding models:
# 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:
dna = session.DNASequence.one()
dna.name = "My new name"
dna.bases = "AGGTAGGGTAGGGCCAGAGA"
# update the sequence on the server
dna.update()
Saving new models:
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:
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!
Metadata
Release files for benchlingapi 2.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| benchlingapi-2.1.12.tar.gz | 21.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| benchlingapi-2.1.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.6 kB
Release files / benchlingapi-2.1.12.tar.gz
| Download URL | benchlingapi-2.1.12.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ee7f03919a4ac27441601d35d52fa877db95a00f8b5c788ac37aff187d692a2
|
|
BLAKE2b-256 checksum How to use checksums |
8d3ed438187289d120508725d5769762468d7980030a79b86ad61d278d54b937
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.17 CPython/3.7.4 Darwin/18.7.0
|
Release files / benchlingapi-2.1.12-py3-none-any.whl
| Download URL | benchlingapi-2.1.12-py3-none-any.whl |
|---|---|
| Size | 23.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10e5786a2b23fe6557475aac6f42e6f3218654f09e8ca6824820d2cba46019fb
|
|
BLAKE2b-256 checksum How to use checksums |
f2007d2f5d70cc508e31ae7d4244b85274384aa67628984c20073518dd5e2be0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.17 CPython/3.7.4 Darwin/18.7.0
|